[Insight-users] Converting a 2D slice to an image

Karthik Krishnan Karthik.Krishnan at kitware.com
Tue Feb 1 10:43:50 EST 2005


Hi Tim,

Try using ExtractImageFilter since it takes two templated arguments and 
might server your purpose.

typedef itk::Image< char, 3 > Image3D
typedef itk::Image< char, 2 > Image2D
typedef itk::ExtractImageFilter<Image3D,Image2D> FilterType;

Use SetExtractionRegion method to set the dimension of the appropriate 
axis to 0 so as to extract slices perpendicular to that axis.

http://www.itk.org/Doxygen/html/classitk_1_1ExtractImageFilter.html

Hope this helps
thanks
kk


Tim Soper wrote:

>I am trying to convert a 2D slice to an image, but
>only with failed attempts. From what I can make out,
>the best way is to use the PasteImageFilter. This
>doesn't appear to work because the filter only has one
>input, so it appears that the source and destination
>must be the same data type. The following does not
>work for me:
>
>itk::PasteImageFilter<ImageType> PasteFilterType;
>PasteFilterType::Pointer pasteFilter =
>PasteFilterType::New(); 
>pasteFilter->SetSourceImage(slice);
>...
>
>Because I have specified that the PasteImageFilter is
>to operate on 'images'(3D), my 'slice' of
>SliceType(2D) cannot be set as a source. Is there a
>way to do this without iterators? Thanks for any
>advice.
>
>-Tim-
>
>
>		
>__________________________________ 
>Do you Yahoo!? 
>Yahoo! Mail - Helps protect you from nasty viruses. 
>http://promotions.yahoo.com/new_mail
>_______________________________________________
>Insight-users mailing list
>Insight-users at itk.org
>http://www.itk.org/mailman/listinfo/insight-users
>
>  
>



More information about the Insight-users mailing list