[Insight-users] Re-sort a 3D Volume

Roger Bramon Feixas rogerbramon at gmail.com
Mon Apr 9 09:49:51 EDT 2007


Hi Luis,

Problem solved. Now, I would like share with us the most important  
parts of  my algorithm, if somebody has a similar problem:

Befor the loop:
----------------------

ExtractImageType::Pointer extractFilter = ExtractImageType::New();
extractFilter->SetInput( myItkImageType3D );

TileFilterType::Pointer tileFilter = TileFilterType::New();

TileFilterType::LayoutArrayType layout;
layout[0] = 1;
layout[1] = 1;
layout[2] = 0;

tileFilter->SetLayout( layout );

std::vector< ItkImageType2D::Pointer > extracts;

Into the loop:
------------------

extractFilter->SetExtractionRegion( region );
extractFilter->Update();
extracts.push_back( extractFilter->GetOutput() );
extracts.back()->DisconnectPipeline();
tileFilter->PushBackInput( extracts.back() );

After the loop:
-------------------
tileFilter->Update();



Thanks for all,

Roger


El 08/04/2007, a las 0:33, Luis Ibanez escribió:

>
> Hi Roger,
>
> You will need to run the ExtractImageFilter first in a loop,
> and at each iteration extract a different slice.
>
> You should put the output of the ExtractImageFilter into a
> std::vector of SmartPointers, and after pushing it in the
> vector you *MUST* call DisconnectPipeline() on that image.
>
> Otherwise, all your "slice" images are using the *same SmartPointer*.
> That is, the ExtractFilter output is reusing the same instance of the
> image object every time.
>
> I'm guessing that what you see as output of the TileImageFilter
> is that all the tiles contain a replication of the "Last" slice
> that you extracted with the ExtractImageFilter.
>
>
> Adding the call to DisconnectPipeline() will force the Extract
> ImageFilter to create a new instance of the image object for
> storing its output at every iteration.
>
>
>    Regards,
>
>
>       Luis
>
>
> ---------------------------------
> Roger Bramon Feixas wrote:
>> Hi,
>> I need to re-order the slices of a 3D volume. I tried to extract  
>> 2D  slices using a "itkExtractImageFilter" and create a new volume  
>> using  "itkTileImageFilter" but it doesn't work. The extraction  
>> works good  because I write the output in an image and it's  
>> correct. The problem  is in "itkTileImageFilter". I receive data  
>> empty error when I want to  use tileImageFilter output. That is my  
>> algorism:
>> before the loop:
>>  - I instantiate the TileImageFilter
>>  - I set the layout in 1,1,0
>> into the loop over the images:
>>  - I allocated a different ExtractImageFilter for each image
>>  - I fed the TileImageFilter with the output of each different   
>> ExtractImageFilter: tileFilter->PushBackInput( extractFilter-   
>> >GetOutput() ). I also tried to do that using: tileFilter- 
>> >SetInput ( i, extractFilter->GetOutput() )
>> after the loop:
>>  TileImageFilter->Update();
>> After the loop, the layout is : 1,1,X where X is the number of  
>> slices  that I pushed. Also, I read in a insight-user mail that  
>> they solved a  similar problem saving all of ExtractimageFilter  
>> objects in a vector  but in my way it doesn't work.
>> I hope anybody know anything about my problem.
>> Thanks,
>> Roger
>> _______________________________________________
>> 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