[Insight-users] ExtractImageFilter
Puja Malik
puja.malik@MEMcenter.unibe.ch
Mon, 03 Feb 2003 11:55:47 +0100
--Boundary_(ID_VA6P8ugJgQFCC7Qzl3sqJQ)
Content-type: text/plain; charset=us-ascii
Content-transfer-encoding: 7BIT
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
---------------------------------------
--Boundary_(ID_VA6P8ugJgQFCC7Qzl3sqJQ)
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>It is very possible that I'm not disconnecting the pipeline properly,
I'm not familiar with the proper way to do this.
<p>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!).
<p>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.
<p>Puja
<p>Luis Ibanez wrote:
<blockquote TYPE=CITE>Hi Puja,
<p>Thanks for letting us know of the details,
<p>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.
<p>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.
<p>Probably Jim, can give us a better advice
<br>on how to do this correctly.
<p>----
<p>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.
<p>The arguments for this example are:
<p> xindex yindex xsize ysize
<p>(xindex,yindex) indicate the position of
<br>the first pixel that will be included in
<br>the region.
<p>(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.)
<p>A question:
<br> Apart from the intensity
<br> range changes, is the extracted image
<br> looking ok ?
<p>Thanks
<p> Luis
<p>------
<p>Puja Malik wrote:
<br>>
<br>>
<br>> Hi Luis,
<br>>
<br>> I am processing an MR image of meta format.
I've looked at the
<br>> example in the Software Guide, and adapted
the code. To find the
<br>> intensity range, I use the values given in
the FLTK viewer, in the
<br>> bottom left hand corner.
<br>>
<br>> Just for clarification: The region
size {x, y, z} would have x, y
<br>> and z being the lengths of the sides of the
region right? Or is
<br>> this size computed like a radius? And
the index is the corner from
<br>> where the specified region would start from
right?
<br>>
<br>> Here is my code, perhaps there is something
that I am overlooking.
<br>> My View function displays the image in the
FLTK viewer.
<br>>
<br>> void ExtractImageRegion2(ImageType::Pointer
imIN,
<br>> ImageType::SizeType regSize,
<br>>
ImageType::IndexType regIndex)
<br>> {
<br>>
<br>> typedef itk::ExtractImageFilter<
ImageType, ImageType > FilterType;
<br>> FilterType::Pointer filter =
FilterType::New();
<br>>
<br>> ImageType::Pointer imOUT = ImageType::New();
<br>>
<br>> ImageType::RegionType region;
<br>> region.SetSize(regSize);
<br>> region.SetIndex(regIndex);
<br>>
<br>> filter->SetExtractionRegion(region);
<br>> filter->SetInput(imIN);
<br>> filter->GraftOutput(imOUT);
<br>>
<br>> imOUT = filter->GetOutput();
<br>>
<br>> try
<br>> {
<br>> filter->Update();
<br>> }
<br>> catch( itk::ExceptionObject &
err )
<br>> {
<br>> std::cout <<
"ExceptionObject caught !" << std::endl;
<br>> std::cout <<
err << std::endl;
<br>>
<br>> }
<br>>
<br>> try
<br>> {
<br>> imOUT->Update();
<br>> }
<br>> catch( itk::ExceptionObject
& err )
<br>> {
<br>> std::cout <<
"ExceptionObject caught !" << std::endl;
<br>> std::cout <<
err << std::endl;
<br>>
<br>> }
<br>>
<br>>
<br>> View(imOUT, "this is the region");
<br>> }
<br>>
<br>>
<br>> Thanks for your help!
<br>> Puja
<br>>
<br>>
<br>> Luis Ibanez wrote:
<br>>
<br>> Hi Puja,
<br>>
<br>> The ExtractImageFilter
shouldn't be changing
<br>> the intensity values
of the extracted pixels.
<br>> It is supposed to
simply copy their values
<br>> into a smaller image.
<br>>
<br>> What kind of image
are you processing ?
<br>>
<br>> What method are you
using for computing
<br>> the intensity range
?
<br>>
<br>> (e.g. you could use
the MinimumMaximumImageCalculator.)
<br>>
<br>> BTW an example on
the use of the ExtractImageFilter
<br>> is available under:
<br>>
<br>> Insight/Examples/IO/ImageReadExtractWrite.cxx
<br>>
<br>> and is described
in the SoftwareGuide on the
<br>> section:
<br>>
<br>>
"Reading and Writing Images"
<br>>
<br>> You can experiment
with it by passing 2D images
<br>> and providing the
index and size in the command
<br>> line. It reads and
writes PNG, DICOM, VTK, and
<br>> MetaImage formats.
<br>>
<br>> Please let us know
some more details of what
<br>> you are doing.
<br>>
<br>>
Thanks
<br>>
<br>>
Luis
<br>>
<br>> ----------------------------------
<br>> Puja Malik wrote:
<br>>
<br>> > Hello,
<br>> > I'm having
trouble using the itk ExtractImageFilter.
<br>> >
<br>> > In my implementation,
I use an image of size {512,512,30}.
<br>> The interger
<br>> > range in
this image is from 0 to 272. When I extract a
<br>> region size of
<br>> > the same
size as the image, I get back the correct image.
<br>> However, if I
<br>> > set my index
as {0,0,0} and extract a region size of {511,
<br>> 511, 30},
<br>> > then I get
the correct image back, however the interger range
<br>> is now
<br>> > from 0 to
4161 and the image appears much dimmer. It seems
<br>> that the
<br>> > smaller I
make the region to be extracted, the larger the
<br>> resulting
<br>> > image's interger
range is.
<br>> >
<br>> > Perhaps I'm
not understanding the functionality of the
<br>> > ExtractImageFilter
properly. Does anyone have any idea how I
<br>> could fix
<br>> > this?
<br>> >
<br>> > Thanks,
<br>> > Puja
<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>> ---------------------------------------
<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>> <<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>>
<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>--
---------------------------------------
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
<A HREF="http://www.MEMcenter.unibe.ch">http://www.MEMcenter.unibe.ch</A>
---------------------------------------</pre>
</html>
--Boundary_(ID_VA6P8ugJgQFCC7Qzl3sqJQ)--