[Insight-users] ExtractImageFilter

Puja Malik puja.malik@MEMcenter.unibe.ch
Mon, 03 Feb 2003 14:27:17 +0100


--Boundary_(ID_yolK0NjuVcwqRmteMo41tg)
Content-type: text/plain; charset=us-ascii
Content-transfer-encoding: 7BIT

Hi Luis,

Yes, only the first slice is warped, the rest look ok (except for the change
in intensity range).

I tried verifying the output using filter->GetOutput() as you said and the
same phenomenon occurs.  Here is the code I am now using:

void ExtractImageRegion(ImageType::Pointer imIN, ImageType::SizeType regSize,
                                                   ImageType::IndexType
regIndex)
{

 typedef itk::ExtractImageFilter< ImageType, ImageType > FilterType;
 FilterType::Pointer filter = FilterType::New();

 ImageType::RegionType region;
 region.SetSize(regSize);
 region.SetIndex(regIndex);

 filter->SetExtractionRegion(region);
 filter->SetInput(imIN);

 try
    {
    filter->Update();
    }
  catch( itk::ExceptionObject & err )
    {
    std::cout << "ExceptionObject caught !" << std::endl;
    std::cout << err << std::endl;

    }
    View(filter->GetOutput(), "region");
}

Also, how could I verify that the buffer data is correct in terms of image
size?  I don't think that this could be the problem, since the only size I use
in this program is the size of the region to be extracted (regSize), and
that's given as a parameter in the function call, and there is no time where
it is altered.

I really appreciate your help, Thanks!
Puja


Luis Ibanez wrote:

> Hi Puja,
>
> Is the first slice the only one warped ?
>
> warping is usually and indication that the image size is
> incorrect with respect to the buffer data.  For example,
> reciving a buffer of size 256x256 and setting the image
> size to 255x256 will probably give a warping effect.
>
> However, this should corrupt all the slices, not only
> the first one...
>
> I would guess that the abnormal disconection of the
> image from the pipeline is somehow corrupting the
> image buffer.
>
> Could you please verify the output of the extract filter
> just by displaying  the image obtained as
>
> filter->GetOutput()
>
> or by saving it to a file and checking the file afterwards.
> Do this without any of the GraftOutput() procedure...
>
> Let us know what you find.
>
> If what you want is to make sure that the image exists
> when you exit the subroutine, you may want to grab
> the ImagePixelContainer of the image....
>
> Please let us know what is the intended use of the
> output image.
>
>    Thanks
>
>             Luis
>
> --------------------------------------------
> Puja Malik wrote:
>
> > Hi Luis,
> >
> > It is very possible that I'm not disconnecting the pipeline properly,
> > I'm not familiar with the proper way to do this.
> >
> > However, I am getting a processed image as an output, so the filter is
> > definitely doing something (just not what I want it to do!).
> >
> > As for your question, besides the intesnisty ranges, the extracted
> > image seems ok, except for the first slice, which is always warped.
> > It seems that the further away from {0,0,0} the index is, the more
> > warped the first slice becomes.  Very strange.
> >
> > Puja
> >
> > Luis Ibanez wrote:
> >
> >> Hi Puja,
> >>
> >> Thanks for letting us know of the details,
> >>
> >> I found a bit strange the process you are
> >> doing with GraftOutput() and then calling
> >> Update() both in the filter and the image.
> >>
> >> It looks like what you want here is just
> >> to disconect the output image from the
> >> pipeline so it is not destroyed when your
> >> filter goes out of scope.
> >>
> >> Probably Jim, can give us a better advice
> >> on how to do this correctly.
> >>
> >> ----
> >>
> >> The FLTK viewer may not be the most accurate
> >> method for finding the intensity range.
> >> However, we should not find big changes
> >> on the image range.
> >>
> >> The arguments for this example are:
> >>
> >>    xindex yindex  xsize ysize
> >>
> >> (xindex,yindex) indicate the position of
> >> the first pixel that will be included in
> >> the region.
> >>
> >> (xsize,ysize) are the number of pixels
> >> along each dimension of the region.
> >> (it is the total number of pixels, not
> >> a radius.)
> >>
> >> A question:
> >>     Apart from the intensity
> >>     range changes, is the extracted image
> >>     looking ok ?
> >>
> >> Thanks
> >>
> >>      Luis
> >>
> >> ------
> >>
> >> Puja Malik wrote:
> >> >
> >> >
> >> >     Hi Luis,
> >> >
> >> >     I am processing an MR image of meta format.  I've looked at the
> >> >     example in the Software Guide, and adapted the code.  To find the
> >> >     intensity range, I use the values given in the FLTK viewer, in the
> >> >     bottom left hand corner.
> >> >
> >> >     Just for clarification:  The region size {x, y, z} would have x, y
> >> >     and z being the lengths of the sides of the region right?  Or is
> >> >     this size computed like a radius?  And the index is the corner
> >> from
> >> >     where the specified region would start from right?
> >> >
> >> >     Here is my code, perhaps there is something that I am overlooking.
> >> >     My View function displays the image in the FLTK viewer.
> >> >
> >> >     void ExtractImageRegion2(ImageType::Pointer imIN,
> >> >     ImageType::SizeType regSize,
> >> >            ImageType::IndexType regIndex)
> >> >     {
> >> >
> >> >      typedef itk::ExtractImageFilter< ImageType, ImageType >
> >> FilterType;
> >> >       FilterType::Pointer filter = FilterType::New();
> >> >
> >> >      ImageType::Pointer imOUT = ImageType::New();
> >> >
> >> >      ImageType::RegionType region;
> >> >      region.SetSize(regSize);
> >> >      region.SetIndex(regIndex);
> >> >
> >> >      filter->SetExtractionRegion(region);
> >> >      filter->SetInput(imIN);
> >> >      filter->GraftOutput(imOUT);
> >> >
> >> >      imOUT = filter->GetOutput();
> >> >
> >> >      try
> >> >         {
> >> >         filter->Update();
> >> >         }
> >> >       catch( itk::ExceptionObject & err )
> >> >         {
> >> >         std::cout << "ExceptionObject caught !" << std::endl;
> >> >         std::cout << err << std::endl;
> >> >
> >> >         }
> >> >
> >> >         try
> >> >         {
> >> >         imOUT->Update();
> >> >         }
> >> >        catch( itk::ExceptionObject & err )
> >> >         {
> >> >         std::cout << "ExceptionObject caught !" << std::endl;
> >> >         std::cout << err << std::endl;
> >> >
> >> >         }
> >> >
> >> >
> >> >      View(imOUT, "this is the region");
> >> >     }
> >> >
> >> >
> >> >     Thanks for your help!
> >> >     Puja
> >> >
> >> >
> >> >     Luis Ibanez wrote:
> >> >
> >> >         Hi Puja,
> >> >
> >> >         The ExtractImageFilter shouldn't be changing
> >> >         the intensity values of the extracted pixels.
> >> >         It is supposed to simply copy their values
> >> >         into a smaller image.
> >> >
> >> >         What kind of image are you processing ?
> >> >
> >> >         What method are you using for computing
> >> >         the intensity range ?
> >> >
> >> >         (e.g. you could use the MinimumMaximumImageCalculator.)
> >> >
> >> >         BTW an example on the use of the ExtractImageFilter
> >> >         is available under:
> >> >
> >> >         Insight/Examples/IO/ImageReadExtractWrite.cxx
> >> >
> >> >         and is described in the SoftwareGuide on the
> >> >         section:
> >> >
> >> >               "Reading and Writing Images"
> >> >
> >> >         You can experiment with it by passing 2D images
> >> >         and providing the index and size in the command
> >> >         line. It reads and writes PNG, DICOM, VTK, and
> >> >         MetaImage formats.
> >> >
> >> >         Please let us know some more details of what
> >> >         you are doing.
> >> >
> >> >            Thanks
> >> >
> >> >               Luis
> >> >
> >> >         ----------------------------------
> >> >         Puja Malik wrote:
> >> >
> >> >          > Hello,
> >> >          > I'm having trouble using the itk ExtractImageFilter.
> >> >          >
> >> >          > In my implementation, I use an image of size {512,512,30}.
> >> >         The interger
> >> >          > range in this image is from 0 to 272.  When I extract a
> >> >         region size of
> >> >          > the same size as the image, I get back the correct image.
> >> >         However, if I
> >> >          > set my index as {0,0,0} and extract a region size of {511,
> >> >         511, 30},
> >> >          > then I get the correct image back, however the interger
> >> range
> >> >         is now
> >> >          > from 0 to 4161 and the image appears much dimmer.  It seems
> >> >         that the
> >> >          > smaller I make the region to be extracted, the larger the
> >> >         resulting
> >> >          > image's interger range is.
> >> >          >
> >> >          > Perhaps I'm not understanding the functionality of the
> >> >          > ExtractImageFilter properly.  Does anyone have any idea
> >> how I
> >> >         could fix
> >> >          > this?
> >> >          >
> >> >          > Thanks,
> >> >          > Puja
> >> >          >
> >> >          >
> >> >          > --
> >> >          > ---------------------------------------
> >> >          > Puja Malik
> >> >          > Surgical Instruments Group
> >> >          > MEM Research Center for Orthopaedic Surgery
> >> >          > Institute for Surgical Technology and Biomechanics
> >> >          > University of Bern
> >> >          > Murtenstrasse 35, P.O. Box 8354
> >> >          > 3010 Bern, Switzerland
> >> >          > Phone: +41-31-632-8730
> >> >          > Fax: +41-31-632-4951
> >> >          > Email: Puja.Malik@MEMcenter.unibe.ch
> >> >          > http://www.MEMcenter.unibe.ch
> >> >          > ---------------------------------------
> >> >          >
> >> >          >
> >> >
> >> > --
> >> > ---------------------------------------
> >> > Puja Malik
> >> > Surgical Instruments Group
> >> > MEM Research Center for Orthopaedic Surgery
> >> > Institute for Surgical Technology and Biomechanics
> >> > University of Bern
> >> > Murtenstrasse 35, P.O. Box 8354
> >> > 3010 Bern, Switzerland
> >> > Phone: +41-31-632-8730
> >> > Fax: +41-31-632-4951
> >> > Email: Puja.Malik@MEMcenter.unibe.ch
> >> > http://www.MEMcenter.unibe.ch
> >> >
> >> <http://www.MEMcenter.unibe.ch>---------------------------------------
> >> >
> >> >
> >> >
> >> > --
> >> > ---------------------------------------
> >> > Puja Malik
> >> > Surgical Instruments Group
> >> > MEM Research Center for Orthopaedic Surgery
> >> > Institute for Surgical Technology and Biomechanics
> >> > University of Bern
> >> > Murtenstrasse 35, P.O. Box 8354
> >> > 3010 Bern, Switzerland
> >> > Phone: +41-31-632-8730
> >> > Fax: +41-31-632-4951
> >> > Email: Puja.Malik@MEMcenter.unibe.ch
> >> > http://www.MEMcenter.unibe.ch
> >> > ---------------------------------------
> >> >
> >> >
> >>
> >> _______________________________________________
> >> Insight-users mailing list
> >> Insight-users@public.kitware.com
> >> http://public.kitware.com/mailman/listinfo/insight-users
> >>
> >--
> >---------------------------------------
> >Puja Malik
> >Surgical Instruments Group
> >MEM Research Center for Orthopaedic Surgery
> >Institute for Surgical Technology and Biomechanics
> >University of Bern
> >Murtenstrasse 35, P.O. Box 8354
> >3010 Bern, Switzerland
> >Phone: +41-31-632-8730
> >Fax: +41-31-632-4951
> >Email: Puja.Malik@MEMcenter.unibe.ch
> >http://www.MEMcenter.unibe.ch
> >---------------------------------------
> >
> >
>
> _______________________________________________
> Insight-users mailing list
> Insight-users@public.kitware.com
> http://public.kitware.com/mailman/listinfo/insight-users

--
---------------------------------------
Puja Malik
Surgical Instruments Group
MEM Research Center for Orthopaedic Surgery
Institute for Surgical Technology and Biomechanics
University of Bern
Murtenstrasse 35, P.O. Box 8354
3010 Bern, Switzerland
Phone: +41-31-632-8730
Fax: +41-31-632-4951
Email: Puja.Malik@MEMcenter.unibe.ch
http://www.MEMcenter.unibe.ch
---------------------------------------



--Boundary_(ID_yolK0NjuVcwqRmteMo41tg)
Content-type: text/html; charset=us-ascii
Content-transfer-encoding: 7BIT

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Hi Luis,
<p>Yes, only the first slice is warped, the rest look ok (except for the
change in intensity range).
<p>I&nbsp;tried verifying the output using filter->GetOutput()&nbsp;as
you said and the same phenomenon occurs.&nbsp; Here is the code I&nbsp;am
now using:
<p>void ExtractImageRegion(ImageType::Pointer imIN, ImageType::SizeType
regSize,
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
ImageType::IndexType regIndex)
<br>{
<br>&nbsp;
<br>&nbsp;typedef itk::ExtractImageFilter&lt; ImageType, ImageType > FilterType;
<br>&nbsp;FilterType::Pointer filter = FilterType::New();
<br>&nbsp;
<br>&nbsp;ImageType::RegionType region;
<br>&nbsp;region.SetSize(regSize);
<br>&nbsp;region.SetIndex(regIndex);
<br>&nbsp;
<br>&nbsp;filter->SetExtractionRegion(region);
<br>&nbsp;filter->SetInput(imIN);
<br>&nbsp;
<br>&nbsp;try
<br>&nbsp;&nbsp;&nbsp; {
<br>&nbsp;&nbsp;&nbsp; filter->Update();
<br>&nbsp;&nbsp;&nbsp; }
<br>&nbsp; catch( itk::ExceptionObject &amp; err )
<br>&nbsp;&nbsp;&nbsp; {
<br>&nbsp;&nbsp;&nbsp; std::cout &lt;&lt; "ExceptionObject caught !" &lt;&lt;
std::endl;
<br>&nbsp;&nbsp;&nbsp; std::cout &lt;&lt; err &lt;&lt; std::endl;
<br>&nbsp;
<br>&nbsp;&nbsp;&nbsp; }
<br>&nbsp;&nbsp;&nbsp; View(filter->GetOutput(), "region");
<br>}
<p>Also, how could I&nbsp;verify that the buffer data is correct in terms
of image size?&nbsp; I&nbsp;don't think that this could be the problem,
since the only size I&nbsp;use in this program is the size of the region
to be extracted (regSize), and that's given as a parameter in the function
call, and there is no time where it is altered.
<p>I&nbsp;really appreciate your help, Thanks!
<br>Puja
<br>&nbsp;
<p>Luis Ibanez wrote:
<blockquote TYPE=CITE>Hi Puja,
<p>Is the first slice the only one warped ?
<p>warping is usually and indication that the image size is
<br>incorrect with respect to the buffer data.&nbsp; For example,
<br>reciving a buffer of size 256x256 and setting the image
<br>size to 255x256 will probably give a warping effect.
<p>However, this should corrupt all the slices, not only
<br>the first one...
<p>I would guess that the abnormal disconection of the
<br>image from the pipeline is somehow corrupting the
<br>image buffer.
<p>Could you please verify the output of the extract filter
<br>just by displaying&nbsp; the image obtained as
<p>filter->GetOutput()
<p>or by saving it to a file and checking the file afterwards.
<br>Do this without any of the GraftOutput() procedure...
<p>Let us know what you find.
<p>If what you want is to make sure that the image exists
<br>when you exit the subroutine, you may want to grab
<br>the ImagePixelContainer of the image....
<p>Please let us know what is the intended use of the
<br>output image.
<p>&nbsp;&nbsp; Thanks
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Luis
<p>--------------------------------------------
<br>Puja Malik wrote:
<p>> Hi Luis,
<br>>
<br>> It is very possible that I'm not disconnecting the pipeline properly,
<br>> I'm not familiar with the proper way to do this.
<br>>
<br>> However, I am getting a processed image as an output, so the filter
is
<br>> definitely doing something (just not what I want it to do!).
<br>>
<br>> As for your question, besides the intesnisty ranges, the extracted
<br>> image seems ok, except for the first slice, which is always warped.
<br>> It seems that the further away from {0,0,0} the index is, the more
<br>> warped the first slice becomes.&nbsp; Very strange.
<br>>
<br>> Puja
<br>>
<br>> Luis Ibanez wrote:
<br>>
<br>>> Hi Puja,
<br>>>
<br>>> Thanks for letting us know of the details,
<br>>>
<br>>> I found a bit strange the process you are
<br>>> doing with GraftOutput() and then calling
<br>>> Update() both in the filter and the image.
<br>>>
<br>>> It looks like what you want here is just
<br>>> to disconect the output image from the
<br>>> pipeline so it is not destroyed when your
<br>>> filter goes out of scope.
<br>>>
<br>>> Probably Jim, can give us a better advice
<br>>> on how to do this correctly.
<br>>>
<br>>> ----
<br>>>
<br>>> The FLTK viewer may not be the most accurate
<br>>> method for finding the intensity range.
<br>>> However, we should not find big changes
<br>>> on the image range.
<br>>>
<br>>> The arguments for this example are:
<br>>>
<br>>>&nbsp;&nbsp;&nbsp; xindex yindex&nbsp; xsize ysize
<br>>>
<br>>> (xindex,yindex) indicate the position of
<br>>> the first pixel that will be included in
<br>>> the region.
<br>>>
<br>>> (xsize,ysize) are the number of pixels
<br>>> along each dimension of the region.
<br>>> (it is the total number of pixels, not
<br>>> a radius.)
<br>>>
<br>>> A question:
<br>>>&nbsp;&nbsp;&nbsp;&nbsp; Apart from the intensity
<br>>>&nbsp;&nbsp;&nbsp;&nbsp; range changes, is the extracted image
<br>>>&nbsp;&nbsp;&nbsp;&nbsp; looking ok ?
<br>>>
<br>>> Thanks
<br>>>
<br>>>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Luis
<br>>>
<br>>> ------
<br>>>
<br>>> Puja Malik wrote:
<br>>> >
<br>>> >
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp; Hi Luis,
<br>>> >
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp; I am processing an MR image of meta format.&nbsp;
I've looked at the
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp; example in the Software Guide, and adapted
the code.&nbsp; To find the
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp; intensity range, I use the values given
in the FLTK viewer, in the
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp; bottom left hand corner.
<br>>> >
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp; Just for clarification:&nbsp; The region
size {x, y, z} would have x, y
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp; and z being the lengths of the sides of
the region right?&nbsp; Or is
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp; this size computed like a radius?&nbsp;
And the index is the corner
<br>>> from
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp; where the specified region would start
from right?
<br>>> >
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp; Here is my code, perhaps there is something
that I am overlooking.
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp; My View function displays the image in
the FLTK viewer.
<br>>> >
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp; void ExtractImageRegion2(ImageType::Pointer
imIN,
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp; ImageType::SizeType regSize,
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
ImageType::IndexType regIndex)
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp; {
<br>>> >
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; typedef itk::ExtractImageFilter&lt;
ImageType, ImageType >
<br>>> FilterType;
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FilterType::Pointer filter
= FilterType::New();
<br>>> >
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ImageType::Pointer imOUT = ImageType::New();
<br>>> >
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ImageType::RegionType region;
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; region.SetSize(regSize);
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; region.SetIndex(regIndex);
<br>>> >
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; filter->SetExtractionRegion(region);
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; filter->SetInput(imIN);
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; filter->GraftOutput(imOUT);
<br>>> >
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; imOUT = filter->GetOutput();
<br>>> >
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; try
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; filter->Update();
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; catch( itk::ExceptionObject
&amp; err )
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; std::cout &lt;&lt;
"ExceptionObject caught !" &lt;&lt; std::endl;
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; std::cout &lt;&lt;
err &lt;&lt; std::endl;
<br>>> >
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }
<br>>> >
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; try
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; imOUT->Update();
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; catch( itk::ExceptionObject
&amp; err )
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; std::cout &lt;&lt;
"ExceptionObject caught !" &lt;&lt; std::endl;
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; std::cout &lt;&lt;
err &lt;&lt; std::endl;
<br>>> >
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }
<br>>> >
<br>>> >
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; View(imOUT, "this is the region");
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp; }
<br>>> >
<br>>> >
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp; Thanks for your help!
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp; Puja
<br>>> >
<br>>> >
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp; Luis Ibanez wrote:
<br>>> >
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Hi Puja,
<br>>> >
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The ExtractImageFilter
shouldn't be changing
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; the intensity
values of the extracted pixels.
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; It is supposed
to simply copy their values
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; into a smaller
image.
<br>>> >
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; What kind of image
are you processing ?
<br>>> >
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; What method are
you using for computing
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; the intensity
range ?
<br>>> >
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (e.g. you could
use the MinimumMaximumImageCalculator.)
<br>>> >
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; BTW an example
on the use of the ExtractImageFilter
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; is available under:
<br>>> >
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Insight/Examples/IO/ImageReadExtractWrite.cxx
<br>>> >
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; and is described
in the SoftwareGuide on the
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; section:
<br>>> >
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
"Reading and Writing Images"
<br>>> >
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; You can experiment
with it by passing 2D images
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; and providing
the index and size in the command
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; line. It reads
and writes PNG, DICOM, VTK, and
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MetaImage formats.
<br>>> >
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Please let us
know some more details of what
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; you are doing.
<br>>> >
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Thanks
<br>>> >
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Luis
<br>>> >
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ----------------------------------
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Puja Malik wrote:
<br>>> >
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; > Hello,
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; > I'm having
trouble using the itk ExtractImageFilter.
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; >
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; > In my
implementation, I use an image of size {512,512,30}.
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The interger
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; > range
in this image is from 0 to 272.&nbsp; When I extract a
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; region size of
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; > the same
size as the image, I get back the correct image.
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; However, if I
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; > set my
index as {0,0,0} and extract a region size of {511,
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 511, 30},
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; > then I
get the correct image back, however the interger
<br>>> range
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; is now
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; > from 0
to 4161 and the image appears much dimmer.&nbsp; It seems
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; that the
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; > smaller
I make the region to be extracted, the larger the
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; resulting
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; > image's
interger range is.
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; >
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; > Perhaps
I'm not understanding the functionality of the
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; > ExtractImageFilter
properly.&nbsp; Does anyone have any idea
<br>>> how I
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; could fix
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; > this?
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; >
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; > Thanks,
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; > Puja
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; >
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; >
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; > --
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; > ---------------------------------------
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; > Puja Malik
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; > Surgical
Instruments Group
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; > MEM Research
Center for Orthopaedic Surgery
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; > Institute
for Surgical Technology and Biomechanics
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; > University
of Bern
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; > Murtenstrasse
35, P.O. Box 8354
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; > 3010 Bern,
Switzerland
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; > Phone:
+41-31-632-8730
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; > Fax: +41-31-632-4951
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; > Email:
Puja.Malik@MEMcenter.unibe.ch
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; > <a href="http://www.MEMcenter.unibe.ch">http://www.MEMcenter.unibe.ch</a>
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; > ---------------------------------------
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; >
<br>>> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; >
<br>>> >
<br>>> > --
<br>>> > ---------------------------------------
<br>>> > Puja Malik
<br>>> > Surgical Instruments Group
<br>>> > MEM Research Center for Orthopaedic Surgery
<br>>> > Institute for Surgical Technology and Biomechanics
<br>>> > University of Bern
<br>>> > Murtenstrasse 35, P.O. Box 8354
<br>>> > 3010 Bern, Switzerland
<br>>> > Phone: +41-31-632-8730
<br>>> > Fax: +41-31-632-4951
<br>>> > Email: Puja.Malik@MEMcenter.unibe.ch
<br>>> > <a href="http://www.MEMcenter.unibe.ch">http://www.MEMcenter.unibe.ch</a>
<br>>> >
<br>>> &lt;<a href="http://www.MEMcenter.unibe.ch">http://www.MEMcenter.unibe.ch</a>>---------------------------------------
<br>>> >
<br>>> >
<br>>> >
<br>>> > --
<br>>> > ---------------------------------------
<br>>> > Puja Malik
<br>>> > Surgical Instruments Group
<br>>> > MEM Research Center for Orthopaedic Surgery
<br>>> > Institute for Surgical Technology and Biomechanics
<br>>> > University of Bern
<br>>> > Murtenstrasse 35, P.O. Box 8354
<br>>> > 3010 Bern, Switzerland
<br>>> > Phone: +41-31-632-8730
<br>>> > Fax: +41-31-632-4951
<br>>> > Email: Puja.Malik@MEMcenter.unibe.ch
<br>>> > <a href="http://www.MEMcenter.unibe.ch">http://www.MEMcenter.unibe.ch</a>
<br>>> > ---------------------------------------
<br>>> >
<br>>> >
<br>>>
<br>>> _______________________________________________
<br>>> Insight-users mailing list
<br>>> Insight-users@public.kitware.com
<br>>> <a href="http://public.kitware.com/mailman/listinfo/insight-users">http://public.kitware.com/mailman/listinfo/insight-users</a>
<br>>>
<br>>--
<br>>---------------------------------------
<br>>Puja Malik
<br>>Surgical Instruments Group
<br>>MEM Research Center for Orthopaedic Surgery
<br>>Institute for Surgical Technology and Biomechanics
<br>>University of Bern
<br>>Murtenstrasse 35, P.O. Box 8354
<br>>3010 Bern, Switzerland
<br>>Phone: +41-31-632-8730
<br>>Fax: +41-31-632-4951
<br>>Email: Puja.Malik@MEMcenter.unibe.ch
<br>><a href="http://www.MEMcenter.unibe.ch">http://www.MEMcenter.unibe.ch</a>
<br>>---------------------------------------
<br>>
<br>>
<p>_______________________________________________
<br>Insight-users mailing list
<br>Insight-users@public.kitware.com
<br><a href="http://public.kitware.com/mailman/listinfo/insight-users">http://public.kitware.com/mailman/listinfo/insight-users</a></blockquote>

<pre>--&nbsp;
---------------------------------------
Puja Malik
Surgical Instruments Group
MEM Research Center for Orthopaedic Surgery
Institute for Surgical Technology and Biomechanics&nbsp;
University of Bern
Murtenstrasse 35, P.O. Box 8354
3010 Bern, Switzerland
Phone: +41-31-632-8730
Fax: +41-31-632-4951
Email: Puja.Malik@MEMcenter.unibe.ch
<A HREF="http://www.MEMcenter.unibe.ch">http://www.MEMcenter.unibe.ch</A>
---------------------------------------</pre>
&nbsp;</html>

--Boundary_(ID_yolK0NjuVcwqRmteMo41tg)--