[Insight-developers] ExtractImageFilter and reducing dimensions
Wilson Chang
wmcst6+@pitt.edu
Thu, 21 Mar 2002 12:01:15 -0500
This is a multi-part message in MIME format.
------=_NextPart_000_0164_01C1D0D0.1A04ED30
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
It looks as if ExtractImageFilter doesn't allow a change in dimensions. =
Does it seem reasonable to add this functionality to reduce dimensions =
to ExtractImageFilter?
As an API, does calling SetExtractionRegion with a size of 0 as one of =
the dimension to get rid of that particular dimension seem reasonable =
(example below)?:
//
//Lets go from 4-D to 3-D
//get the (x,y,z,6) slice. This might correspond to the 7th time =
slice=20
//in a time-series of 3-D images
//
ExtractImageFilter<4DimImage, 3DimImage> extractor;
extractor->SetInput(4DImage->GetOutput());
extractorIndex =3D {0,0,0,6};
extractorSize =3D {4DImageSize[0], 4DImageSize[1], 4DImageSize[2], =
0};
extractorRegion.SetSize(extractorSize);
extractorRegion.SetIndex(extractorIndex);
extractor->SetExtractionRegion(extractorRegion);
Implementation in ExtractImageFilter would probably entail using an =
iterator to walk through the desired dimensions and copy out the data. =
or is there a better way to do this? As far as I cant tell, adding this =
functionality wont result in a performance hit over the existing code if =
we make a dimension reduction a special case in the code:
if nDimensions to nDimension extraction then use existing code
else if nDimension to (n-m)Dimension, then use an iterator to walk =
through data and copy out data.
thoughts?
wilson
=20
>You might want to look at the ExtractImageFilter. I don't
>know whether it will allow you to have an output image whose dimension =
is less
>than the input's. But that is where I would look for such =
functionality
>>
>>-----Original Message-----
>>From: Damion Shelton [mailto:dmshelto@andrew.cmu.edu]
>>Sent: Tuesday, March 12, 2002 2:49 PM
>>To: Insight Developers
>>Subject: [Insight-developers] dimension reduction / VTK link>>
>>
>>Hi,
>>
>>We're working on a tool for visualizing ITK images (in the context of =
our=20
>>core atom project) and we've run into the following situation:
>>
>>VTK looks attractive, but can only handle 3D images. Is there an easy =
way=20
>>(in ITK) to "lock" N-3 dimensions of an N-d dataset, and get the 3D =
subset=20
>>this defines? E.g., I have a 4D "movie", I want to hold time constant =
and=20
>>extract a 3D "frame".
>>
>>itkVTKImageExport.h doesn't suggest how this should be done, but it =
seems=20
>>like a fairly straightforward problem (interpolation issues aside). =
The=20
>>naive way of doing it would be to compute the indices of interest for =
the=20
>>"locked" dimensions, and then build an output image by looping over =
the >
>>free variables, but this isn't particularly elegant, and for large =
subsets=20
>>could involve a lot of copying.
>>
>>Alternatively, is it possible to use an ImageRegionIterator to =
accomplish=20
>>this, by selecting origin=3D(0,0,0,timeindex) and =
size=3D(xsize,ysize,zsize,1)?=20
>>If so, is there an established method (a filter perhaps) for creating =
an=20
>>image given a source image and an iterator?
>>
>>Also, is the interpretation of the image by itkVTKImageExport affected =
by=20
>>the currently requested/buffered region definition?
>>
>>In a separate but related question, is it possible in ITK to obtain=20
>>arbitrary 2D slices through a 3D volume by defining the equation of a=20
>>cutting plane, as can be done in VTK?
>>
>>Thanks,
>>-Damion-
------=_NextPart_000_0164_01C1D0D0.1A04ED30
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2712.300" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><!--StartFragment --><FONT face=3DArial size=3D2>It looks as if=20
ExtractImageFilter doesn't allow a change in dimensions. Does =
it seem=20
reasonable to add this functionality to reduce dimensions to=20
ExtractImageFilter?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>As an API, does =
calling SetExtractionRegion=20
with a size of 0 as one of the dimension to get rid of that particular =
dimension=20
seem reasonable (example below)?:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2> //</FONT></DIV>
<DIV><FONT face=3DArial size=3D2> //Lets go from 4-D =
to=20
3-D</FONT></DIV>
<DIV><FONT face=3DArial size=3D2> //get the (x,y,z,6) =
slice. =20
This might correspond to the 7th time slice </FONT></DIV>
<DIV><FONT face=3DArial size=3D2> //in a time-series=20
of </FONT><FONT face=3DArial size=3D2>3-D images</FONT></DIV>
<DIV><FONT face=3DArial size=3D2> //</FONT></DIV>
<DIV><FONT face=3DArial size=3D2> =
ExtractImageFilter<4DimImage,=20
3DimImage> extractor;</FONT></DIV>
<DIV><FONT face=3DArial size=3D2> =20
extractor->SetInput(4DImage->GetOutput());<BR> =20
extractorIndex =3D {0,0,0,6};<BR> extractorSize =3D=20
{4DImageSize[0], 4DImageSize[1], 4DImageSize[2], =
0};<BR> =20
extractorRegion.SetSize(extractorSize);<BR> =20
extractorRegion.SetIndex(extractorIndex);<BR> =20
extractor->SetExtractionRegion(extractorRegion);</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Implementation in ExtractImageFilter =
would probably=20
entail using an iterator to walk through the desired dimensions and copy =
out the=20
data. </FONT><FONT face=3DArial size=3D2>or is there a better way =
to do=20
this? As far as I cant tell, adding this functionality wont result =
in a=20
performance hit over the existing code if we make a dimension reduction =
a=20
special case in the code:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>if nDimensions to nDimension =
extraction then=20
use existing code</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>else if nDimension to (n-m)Dimension, =
then use an=20
iterator to walk through data and copy out data.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>thoughts?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>wilson</DIV>
<DIV><BR></DIV></FONT>
<DIV> </DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV><PRE><FONT =
face=3DArial size=3D2>>You might want to look at the =
ExtractImageFilter. I don't
>know whether it will allow you to have an output image whose =
dimension is less
>than the input's. But that is where I would look for such =
functionality
></FONT><FONT face=3DArial size=3D2>>
>>-----Original Message-----
>>From: Damion Shelton [mailto:</FONT><A =
href=3D"mailto:dmshelto@andrew.cmu.edu"><FONT face=3DArial =
size=3D2>dmshelto@andrew.cmu.edu</FONT></A><FONT face=3DArial size=3D2>]
>>Sent: Tuesday, March 12, 2002 2:49 PM
>>To: Insight Developers
>>Subject: [Insight-developers] dimension reduction / VTK =
link>>
>>
>>Hi,
>>
>>We're working on a tool for visualizing ITK images (in the =
context of our=20
>>core atom project) and we've run into the following situation:
>>
>>VTK looks attractive, but can only handle 3D images. Is there an =
easy way=20
>>(in ITK) to "lock" N-3 dimensions of an N-d dataset, and get the =
3D subset=20
>>this defines? E.g., I have a 4D "movie", I want to hold time =
constant and=20
>>extract a 3D "frame".
>>
>>itkVTKImageExport.h doesn't suggest how this should be done, but =
it seems=20
>>like a fairly straightforward problem (interpolation issues =
aside). The=20
>>naive way of doing it would be to compute the indices of =
interest for the=20
>>"locked" dimensions, and then build an output image by looping =
over the >
>>free variables, but this isn't particularly elegant, and for =
large subsets=20
>>could involve a lot of copying.
>>
>>Alternatively, is it possible to use an ImageRegionIterator to =
accomplish=20
>>this, by selecting origin=3D(0,0,0,timeindex) and =
size=3D(xsize,ysize,zsize,1)?=20
>>If so, is there an established method (a filter perhaps) for =
creating an=20
>>image given a source image and an iterator?
>>
>>Also, is the interpretation of the image by itkVTKImageExport =
affected by=20
>>the currently requested/buffered region definition?
>>
>>In a separate but related question, is it possible in ITK to =
obtain=20
>>arbitrary 2D slices through a 3D volume by defining the equation =
of a=20
>>cutting plane, as can be done in VTK?
>>
>>Thanks,
>>-Damion-</FONT></PRE></BODY></HTML>
------=_NextPart_000_0164_01C1D0D0.1A04ED30--