Hi all,<br><br>I recently needed something just like what Roger was nice enough to share last month (<a href="http://public.kitware.com/pipermail/insight-users/2007-April/021796.html">http://public.kitware.com/pipermail/insight-users/2007-April/021796.html
</a>).&nbsp;&nbsp;I modified it a bit for my needs, and decided to send this along in case it helps anyone else (although I&#39;m not sure how often other people would find the additional functionality useful).<br><br>This just uses a basic Gaussian filter for the processing, but I was also able to implement a full level set segmentation, operating on 2D slices at a time, by using this as a template.&nbsp;&nbsp;(In case you are curious, I was comparing some tradeoffs of implementing 3D vs 2D segmentation on 3D images)
<br><br>drf<br><br><br>//&nbsp;&nbsp;This programs reads in a 3D image volume, extracts 2D slices, <br>//&nbsp;&nbsp;and performs some 2D filtering on each. The results are inserted <br>//&nbsp;&nbsp;into a 3D output volume of identical dimensions to the input. This 
<br>//&nbsp;&nbsp;is used to perform 2D processing on 3D images without having to <br>//&nbsp;&nbsp;write large numbers of 2D images to disk,&nbsp;&nbsp;simplifying the batch <br>//&nbsp;&nbsp;files used to perform processing.<br>//<br>//&nbsp;&nbsp;Any 2D processing pipeline can be used here; the object that 
<br>//&nbsp;&nbsp;passes its output to the TileImageFilter must be updated inside <br>//&nbsp;&nbsp;the loop (lines 167,168).&nbsp;&nbsp;In this case, a discrete gaussian image <br>//&nbsp;&nbsp;filter is applied to the 2D images before being passed to the tiler.
<br>//<br>//&nbsp;&nbsp;Additionally, 2D slices along the x,y, or z dimensions can be <br>//&nbsp;&nbsp;operated on.&nbsp;&nbsp;The input parameter is collapseDim (0,1,or 2).&nbsp;&nbsp;<br>//&nbsp;&nbsp;For example, a value of 2 &quot;collapses&quot; (or steps through) the 
<br>//&nbsp;&nbsp;z-dimension, yielding many 2D images from the x-y plane.&nbsp;&nbsp;Likewise,&nbsp;&nbsp;<br>//&nbsp;&nbsp;collapseDim=0 collapses x, yielding images from the y-z plane.&nbsp;&nbsp;The <br>//&nbsp;&nbsp;result is permuted so the output has the same dimensions as the original.
<br>//<br>//&nbsp;&nbsp;Thanks to Luis Ibanez for the help and to Roger Bramon Feixas, <br>//&nbsp;&nbsp;who actually coded the loop that puts the images into the tiler:<br>//&nbsp; <a href="http://public.kitware.com/pipermail/insight-users/2007-April/021796.html">
http://public.kitware.com/pipermail/insight-users/2007-April/021796.html</a><br><br><br>#if defined(_MSC_VER)<br>#pragma warning ( disable : 4786 )<br>#endif<br><br>#ifdef __BORLANDC__<br>#define ITK_LEAN_AND_MEAN<br>#endif
<br><br>#include &quot;itkImageFileReader.h&quot;<br>#include &quot;itkImageFileWriter.h&quot;<br>#include &quot;itkExtractImageFilter.h&quot;<br>#include &quot;itkTileImageFilter.h&quot;<br>#include &quot;itkDiscreteGaussianImageFilter.h
&quot;<br>#include &quot;itkRescaleIntensityImageFilter.h&quot;<br>#include &quot;itkImage.h&quot;<br>#include &quot;itkPermuteAxesImageFilter.h&quot;<br><br><br>int main( int argc, char ** argv )<br>{<br>&nbsp;&nbsp;//&nbsp;&nbsp;Check input arguments
<br>&nbsp;&nbsp;if( argc &lt; 3 )<br>&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;std::cerr &lt;&lt; &quot;Usage: &quot; &lt;&lt; std::endl;<br>&nbsp;&nbsp;&nbsp;&nbsp;std::cerr &lt;&lt; argv[0] &lt;&lt; &quot; input3DImageFile&nbsp;&nbsp;output3DImageFile collapseDim&quot; &lt;&lt; std::endl;
<br>&nbsp;&nbsp;&nbsp;&nbsp;return EXIT_FAILURE;<br>&nbsp;&nbsp;&nbsp;&nbsp;}<br><br><br>&nbsp;&nbsp;//&nbsp;&nbsp;Typedefs<br>&nbsp;&nbsp;typedef float&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; InputPixelType;<br>&nbsp;&nbsp;typedef float&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MiddlePixelType;<br>&nbsp;&nbsp;typedef float&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OutputPixelType;<br>&nbsp;&nbsp;typedef unsigned char WritePixelType;
<br><br>&nbsp;&nbsp;typedef itk::Image&lt; InputPixelType,&nbsp;&nbsp;3 &gt;&nbsp;&nbsp;&nbsp;&nbsp;InputImageType;<br>&nbsp;&nbsp;typedef itk::Image&lt; MiddlePixelType, 2 &gt;&nbsp;&nbsp;&nbsp;&nbsp;MiddleImageType;<br>&nbsp;&nbsp;typedef itk::Image&lt; OutputPixelType, 3 &gt;&nbsp;&nbsp;&nbsp;&nbsp;OutputImageType;<br>
&nbsp;&nbsp;typedef itk::Image&lt; WritePixelType,&nbsp;&nbsp;3 &gt;&nbsp;&nbsp;&nbsp;&nbsp;WriteImageType;<br>&nbsp;&nbsp;<br>&nbsp;&nbsp;typedef itk::ImageFileReader&lt; InputImageType&nbsp;&nbsp;&gt;&nbsp;&nbsp;ReaderType;<br>&nbsp;&nbsp;typedef itk::ImageFileWriter&lt; WriteImageType&nbsp;&nbsp;&gt;&nbsp;&nbsp;WriterType;<br>
&nbsp;&nbsp;<br>&nbsp;&nbsp;typedef itk::ExtractImageFilter&lt; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; InputImageType, MiddleImageType&nbsp;&nbsp;&gt;&nbsp;&nbsp;ExtractFilterType;<br>&nbsp;&nbsp;typedef itk::DiscreteGaussianImageFilter&lt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MiddleImageType, MiddleImageType &gt;&nbsp;&nbsp;FilterType;
<br>&nbsp;&nbsp;typedef itk::TileImageFilter&lt; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MiddleImageType, OutputImageType &gt;&nbsp;&nbsp;TileFilterType;<br>&nbsp;&nbsp;typedef itk::RescaleIntensityImageFilter&lt; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OutputImageType, WriteImageType&nbsp;&nbsp;&gt;&nbsp;&nbsp;RescaleFilterType;
<br>&nbsp;&nbsp;typedef itk::PermuteAxesImageFilter&lt; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OutputImageType&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&gt;&nbsp;&nbsp;PermuteFilterType;<br><br><br>&nbsp;&nbsp;//&nbsp;&nbsp;Input/Output filenames<br>&nbsp;&nbsp;const char * inputFilename&nbsp;&nbsp;= argv[1];<br>&nbsp;&nbsp;const char * outputFilename = argv[2];
<br>&nbsp;&nbsp;<br><br>&nbsp;&nbsp;// Reader/Writer instantiations<br>&nbsp;&nbsp;ReaderType::Pointer reader = ReaderType::New();<br>&nbsp;&nbsp;WriterType::Pointer writer = WriterType::New();<br>&nbsp;&nbsp;reader-&gt;SetFileName( inputFilename&nbsp;&nbsp;);<br>&nbsp;&nbsp;writer-&gt;SetFileName( outputFilename );
<br><br><br>&nbsp;&nbsp;//&nbsp;&nbsp;Read input file<br>&nbsp;&nbsp;try <br>&nbsp;&nbsp;&nbsp;&nbsp;{ <br>&nbsp;&nbsp;&nbsp;&nbsp;reader-&gt;Update();<br>&nbsp;&nbsp;&nbsp;&nbsp;} <br>&nbsp;&nbsp;catch( itk::ExceptionObject &amp; err ) <br>&nbsp;&nbsp;&nbsp;&nbsp;{ <br>&nbsp;&nbsp;&nbsp;&nbsp;std::cerr &lt;&lt; &quot;ExceptionObject caught !&quot; &lt;&lt; std::endl; 
<br>&nbsp;&nbsp;&nbsp;&nbsp;std::cerr &lt;&lt; err &lt;&lt; std::endl; <br>&nbsp;&nbsp;&nbsp;&nbsp;return EXIT_FAILURE;<br>&nbsp;&nbsp;&nbsp;&nbsp;} <br><br><br>&nbsp;&nbsp;//&nbsp;&nbsp;Find input image size<br>&nbsp;&nbsp;InputImageType::RegionType inputRegion =<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; reader-&gt;GetOutput()-&gt;GetLargestPossibleRegion();
<br>&nbsp;&nbsp;InputImageType::SizeType size = inputRegion.GetSize();<br>&nbsp;&nbsp;const unsigned int collapseDim&nbsp;&nbsp;= atoi( argv[3] );<br>&nbsp;&nbsp;InputImageType::SizeType::SizeValueType numSlices = size[collapseDim];<br>&nbsp;&nbsp;size[collapseDim] = 0;&nbsp;&nbsp; // collapse dimension ( 3D-&gt;2D )
<br>&nbsp;&nbsp;<br><br>&nbsp;&nbsp;//&nbsp;&nbsp;Set region for 2D extraction<br>&nbsp;&nbsp;InputImageType::IndexType start = inputRegion.GetIndex();<br>&nbsp;&nbsp;InputImageType::RegionType desiredRegion;<br>&nbsp;&nbsp;desiredRegion.SetSize(&nbsp;&nbsp;size&nbsp;&nbsp;);<br>&nbsp;&nbsp;<br><br>&nbsp;&nbsp;//&nbsp;&nbsp;Extract filter instantiation
<br>&nbsp;&nbsp;ExtractFilterType::Pointer extractFilter = ExtractFilterType::New();<br>&nbsp;&nbsp;<br>&nbsp;&nbsp;<br>&nbsp;&nbsp;//&nbsp;&nbsp;2D Gaussian filter instantiation<br>&nbsp;&nbsp;FilterType::Pointer filter = FilterType::New();<br>&nbsp;&nbsp;const double gaussianVariance = 1;
<br>&nbsp;&nbsp;const unsigned int maxKernelWidth = 20;<br>&nbsp;&nbsp;filter-&gt;SetVariance( gaussianVariance );<br>&nbsp;&nbsp;filter-&gt;SetMaximumKernelWidth( maxKernelWidth );<br><br><br>&nbsp;&nbsp;//&nbsp;&nbsp;Tiling filter for inserting 2D results into 3D output volume
<br>&nbsp;&nbsp;//&nbsp;&nbsp;layout=[1,1,0] is code to automatically create necessary image size<br>&nbsp;&nbsp;//&nbsp;&nbsp;&nbsp;&nbsp; for a given number of slices<br>&nbsp;&nbsp;TileFilterType::Pointer tileFilter = TileFilterType::New();<br>&nbsp;&nbsp;TileFilterType::LayoutArrayType layout;
<br>&nbsp;&nbsp;layout[0] = 1;<br>&nbsp;&nbsp;layout[1] = 1;<br>&nbsp;&nbsp;layout[2] = 0;<br>&nbsp;&nbsp;tileFilter-&gt;SetLayout( layout );<br><br><br>&nbsp;&nbsp;//&nbsp;&nbsp;Rescale used to cast float-&gt;char for image writing<br>&nbsp;&nbsp;RescaleFilterType::Pointer rescaler = RescaleFilterType::New();
<br>&nbsp;&nbsp;rescaler-&gt;SetOutputMinimum(&nbsp;&nbsp; 0 );<br>&nbsp;&nbsp;rescaler-&gt;SetOutputMaximum( 255 );<br><br><br>&nbsp;&nbsp;//&nbsp;&nbsp;Set up pipeline<br>&nbsp;&nbsp;extractFilter-&gt;SetInput( reader-&gt;GetOutput() );<br>&nbsp;&nbsp;filter-&gt;SetInput( extractFilter-&gt;GetOutput() );
<br>&nbsp;&nbsp;tileFilter-&gt;SetInput( filter-&gt;GetOutput() );<br><br><br>&nbsp;&nbsp;//&nbsp;&nbsp;Vector of pointers to the many 2D extracted images<br>&nbsp;&nbsp;std::vector&lt; MiddleImageType::Pointer &gt; extracts; <br>&nbsp;&nbsp;<br><br>&nbsp;&nbsp;//&nbsp;&nbsp;Extract 2D slices, perform processing
<br>&nbsp;&nbsp;for(unsigned int sliceNumber = 0; sliceNumber&lt;numSlices; sliceNumber++)<br>&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;start[collapseDim] = sliceNumber;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;desiredRegion.SetIndex( start );<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;extractFilter-&gt;SetExtractionRegion( desiredRegion );
<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;filter-&gt;Update();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;extracts.push_back( filter-&gt;GetOutput() );<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;extracts.back()-&gt;DisconnectPipeline();<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (sliceNumber != 0)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tileFilter-&gt;PushBackInput( 
extracts.back() ); <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;}<br><br>&nbsp;&nbsp;//&nbsp;&nbsp;Update tiling filter<br>&nbsp;&nbsp;tileFilter-&gt;Update();<br><br><br>&nbsp;&nbsp;//&nbsp;&nbsp;Permute image axes to match input<br>&nbsp;&nbsp;PermuteFilterType::Pointer permute = PermuteFilterType::New();<br>
&nbsp;&nbsp;unsigned int permuteAxes[3];<br>&nbsp;&nbsp;switch (collapseDim)<br>&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;case 0:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;permuteAxes[0] = 2;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;permuteAxes[1] = 0;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;permuteAxes[2] = 1;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;case 1:
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;permuteAxes[0] = 0;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;permuteAxes[1] = 2;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;permuteAxes[2] = 1;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;case 2:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;permuteAxes[0] = 0;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;permuteAxes[1] = 1;
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;permuteAxes[2] = 2;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;default:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;permuteAxes[0] = 0;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;permuteAxes[1] = 1;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;permuteAxes[2] = 2;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;}
<br>&nbsp;&nbsp;permute-&gt;SetOrder( permuteAxes );<br>&nbsp;&nbsp;permute-&gt;SetInput( tileFilter-&gt;GetOutput() );<br>&nbsp;&nbsp;<br><br>&nbsp;&nbsp;//&nbsp;&nbsp;Remainder of pipeline<br>&nbsp;&nbsp;//&nbsp;&nbsp;Cast float-&gt;char for image writing<br>&nbsp;&nbsp;rescaler-&gt;SetInput( permute-&gt;GetOutput() );
<br>&nbsp;&nbsp;writer-&gt;SetInput( rescaler-&gt;GetOutput() );<br><br><br>&nbsp;&nbsp;//&nbsp;&nbsp;Update pipeline, write file<br>&nbsp;&nbsp;try <br>&nbsp;&nbsp;&nbsp;&nbsp;{ <br>&nbsp;&nbsp;&nbsp;&nbsp;writer-&gt;Update(); <br>&nbsp;&nbsp;&nbsp;&nbsp;} <br>&nbsp;&nbsp;catch( itk::ExceptionObject &amp; err ) <br>&nbsp;&nbsp;&nbsp;&nbsp;{ <br>&nbsp;&nbsp;&nbsp;&nbsp;std::cerr &lt;&lt; &quot;ExceptionObject caught !&quot; &lt;&lt; std::endl; 
<br>&nbsp;&nbsp;&nbsp;&nbsp;std::cerr &lt;&lt; err &lt;&lt; std::endl; <br>&nbsp;&nbsp;&nbsp;&nbsp;return EXIT_FAILURE;<br>&nbsp;&nbsp;&nbsp;&nbsp;} <br><br>&nbsp;&nbsp;return EXIT_SUCCESS;<br>}<br><br><br><br><br>On 4/9/07, Roger Bramon Feixas &lt;<a href="mailto:rogerbramon@gmail.com">rogerbramon@gmail.com
</a>&gt; wrote:<br>&gt; Hi Luis,<br>&gt; <br>&gt; Problem solved. Now, I would like share with us the most important<br>&gt; parts of&nbsp;&nbsp;my algorithm, if somebody has a similar problem:<br>&gt; <br>&gt; Befor the loop:<br>&gt; ----------------------
<br>&gt; <br>&gt; ExtractImageType::Pointer extractFilter = ExtractImageType::New();<br>&gt; extractFilter-&gt;SetInput( myItkImageType3D );<br>&gt; <br>&gt; TileFilterType::Pointer tileFilter = TileFilterType::New();<br>
&gt; <br>&gt; TileFilterType::LayoutArrayType layout;<br>&gt; layout[0] = 1;<br>&gt; layout[1] = 1;<br>&gt; layout[2] = 0;<br>&gt; <br>&gt; tileFilter-&gt;SetLayout( layout );<br>&gt; <br>&gt; std::vector&lt; ItkImageType2D::Pointer &gt; extracts;
<br>&gt; <br>&gt; Into the loop:<br>&gt; ------------------<br>&gt; <br>&gt; extractFilter-&gt;SetExtractionRegion( region );<br>&gt; extractFilter-&gt;Update();<br>&gt; extracts.push_back( extractFilter-&gt;GetOutput() );
<br>&gt; extracts.back()-&gt;DisconnectPipeline();<br>&gt; tileFilter-&gt;PushBackInput( extracts.back() );<br>&gt; <br>&gt; After the loop:<br>&gt; -------------------<br>&gt; tileFilter-&gt;Update();<br>&gt; <br>&gt; <br>
&gt; <br>&gt; Thanks for all,<br>&gt; <br>&gt; Roger<br>&gt; <br>&gt; <br>&gt; El 08/04/2007, a las 0:33, Luis Ibanez escribió:<br>&gt; <br>&gt; &gt;<br>&gt; &gt; Hi Roger,<br>&gt; &gt;<br>&gt; &gt; You will need to run the ExtractImageFilter first in a loop,
<br>&gt; &gt; and at each iteration extract a different slice.<br>&gt; &gt;<br>&gt; &gt; You should put the output of the ExtractImageFilter into a<br>&gt; &gt; std::vector of SmartPointers, and after pushing it in the<br>
&gt; &gt; vector you *MUST* call DisconnectPipeline() on that image.<br>&gt; &gt;<br>&gt; &gt; Otherwise, all your &quot;slice&quot; images are using the *same SmartPointer*.<br>&gt; &gt; That is, the ExtractFilter output is reusing the same instance of the
<br>&gt; &gt; image object every time.<br>&gt; &gt;<br>&gt; &gt; I&#39;m guessing that what you see as output of the TileImageFilter<br>&gt; &gt; is that all the tiles contain a replication of the &quot;Last&quot; slice<br>
&gt; &gt; that you extracted with the ExtractImageFilter.<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt; Adding the call to DisconnectPipeline() will force the Extract<br>&gt; &gt; ImageFilter to create a new instance of the image object for
<br>&gt; &gt; storing its output at every iteration.<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;Regards,<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Luis<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt; ---------------------------------
<br>&gt; &gt; Roger Bramon Feixas wrote:<br>&gt; &gt;&gt; Hi,<br>&gt; &gt;&gt; I need to re-order the slices of a 3D volume. I tried to extract<br>&gt; &gt;&gt; 2D&nbsp;&nbsp;slices using a &quot;itkExtractImageFilter&quot; and create a new volume
<br>&gt; &gt;&gt; using&nbsp;&nbsp;&quot;itkTileImageFilter&quot; but it doesn&#39;t work. The extraction<br>&gt; &gt;&gt; works good&nbsp;&nbsp;because I write the output in an image and it&#39;s<br>&gt; &gt;&gt; correct. The problem&nbsp;&nbsp;is in &quot;itkTileImageFilter&quot;. I receive data
<br>&gt; &gt;&gt; empty error when I want to&nbsp;&nbsp;use tileImageFilter output. That is my<br>&gt; &gt;&gt; algorism:<br>&gt; &gt;&gt; before the loop:<br>&gt; &gt;&gt;&nbsp;&nbsp;- I instantiate the TileImageFilter<br>&gt; &gt;&gt;&nbsp;&nbsp;- I set the layout in 1,1,0
<br>&gt; &gt;&gt; into the loop over the images:<br>&gt; &gt;&gt;&nbsp;&nbsp;- I allocated a different ExtractImageFilter for each image<br>&gt; &gt;&gt;&nbsp;&nbsp;- I fed the TileImageFilter with the output of each different<br>&gt; &gt;&gt; ExtractImageFilter: tileFilter-&gt;PushBackInput( extractFilter-
<br>&gt; &gt;&gt; &gt;GetOutput() ). I also tried to do that using: tileFilter-<br>&gt; &gt;&gt; &gt;SetInput ( i, extractFilter-&gt;GetOutput() )<br>&gt; &gt;&gt; after the loop:<br>&gt; &gt;&gt;&nbsp;&nbsp;TileImageFilter-&gt;Update();
<br>&gt; &gt;&gt; After the loop, the layout is : 1,1,X where X is the number of<br>&gt; &gt;&gt; slices&nbsp;&nbsp;that I pushed. Also, I read in a insight-user mail that<br>&gt; &gt;&gt; they solved a&nbsp;&nbsp;similar problem saving all of ExtractimageFilter
<br>&gt; &gt;&gt; objects in a vector&nbsp;&nbsp;but in my way it doesn&#39;t work.<br>&gt; &gt;&gt; I hope anybody know anything about my problem.<br>&gt; &gt;&gt; Thanks,<br>&gt; &gt;&gt; Roger<br>&gt; &gt;&gt; _______________________________________________
<br>&gt; &gt;&gt; Insight-users mailing list<br>&gt; &gt;&gt; <a href="mailto:Insight-users@itk.org">Insight-users@itk.org</a><br>&gt; &gt;&gt; <a href="http://www.itk.org/mailman/listinfo/insight-users">http://www.itk.org/mailman/listinfo/insight-users
</a><br>&gt; <br>&gt; _______________________________________________<br>&gt; Insight-users mailing list<br>&gt; <a href="mailto:Insight-users@itk.org">Insight-users@itk.org</a><br>&gt; <a href="http://www.itk.org/mailman/listinfo/insight-users">
http://www.itk.org/mailman/listinfo/insight-users</a><br>&gt; <br><br>