[Insight-users] Code for writing a 2D image as a slice of a 3D image

Luis Ibanez luis . ibanez at kitware . com
Wed, 10 Dec 2003 18:29:05 -0500


Hi Radhika,

Please use the PasteImageFilter
http://www . itk . org/Insight/Doxygen/html/classitk_1_1PasteImageFilter . html

Notice that for doing this you may want to use
the RegionOfInterestImageFilter
extract the slices from the 3D data set.

The main difference between the RegionOfInterest filter
http://www . itk . org/Insight/Doxygen/html/classitk_1_1RegionOfInterestImageFilter . html
and the ExtractImageFilter
http://www . itk . org/Insight/Doxygen/html/classitk_1_1ExtractImageFilter . html

is that Extract allows you to change the dimension, that is,
to produce 2D slices from a 3D volume. With RegionOfInterest
you will have to produce 3D volumes that are 1 slice thick.

It depends on what you are doing to the slices ....
If you are running on the slices any filter that relies
on neighborhood information you will have to stick to
the ExtractImageFilter.


Please also look at
http://www . itk . org/pipermail/insight-users/2003-December/005796 . html



Regards,


     Luis


------------------
Radhika Sivaramakrishna wrote:

> Hi Luis,
> Sorry to bug you with so many questions.
>  
> I have a 3D image. I take each slice, do some operations on it and want 
> to put back that slice in my
> 3D image. I know how to extract a slice from the 3D image and do my 
> operations, but do not
> know how to write back that slice at the desired location in the 3D 
> image. I saw that there is a SliceIteratorWithIndex but I am not sure 
> how to use it to go to a particular slice number.
>  
> Thanks
> Radhika
>