Dear all,<br>I am trying to test that I know how to use the tileFIlter. What I am doing is to extract 5 2D slices and then, withot any processing, recover the 3D image. The problem is that all slices are OK, except the first one which is equal to the las one. I cannot see the mistake, could yo help me?<br>
<br><br><br><br>typedef unsigned char InputPixelType;<br> typedef unsigned char MiddlePixelType;<br> typedef unsigned char OutputPixelType;<br><br> typedef itk::Image< InputPixelType, 3 > InputImageType;<br>
typedef itk::Image< MiddlePixelType, 2 > MiddleImageType;<br> typedef itk::Image< OutputPixelType, 3 > OutputImageType;<br><br> typedef itk::ImageFileReader< InputImageType > ReaderType;<br>
typedef itk::ImageFileWriter< OutputImageType > WriterType;<br><br> typedef itk::ExtractImageFilter< InputImageType, MiddleImageType > ExtractFilterType;<br> typedef itk::TileImageFilter<MiddleImageType, OutputImageType > TileFilterType;<br>
<br> const char * inputFilename = argv[1];<br> const char * outputFilename = argv[2];<br><br> ReaderType::Pointer reader = ReaderType::New();<br> WriterType::Pointer writer = WriterType::New();<br> reader->SetFileName( inputFilename );<br>
writer->SetFileName( outputFilename );<br><br> reader->Update();<br><br> InputImageType::RegionType inputRegion = reader->GetOutput()->GetLargestPossibleRegion();<br> ExtractFilterType::Pointer extractFilter = ExtractFilterType::New ();<br>
<br> InputImageType::SizeType size = inputRegion.GetSize();<br> size[2] = 0;<br><br> InputImageType::IndexType start = inputRegion.GetIndex();<br> InputImageType::RegionType desiredRegion;<br><br> TileFilterType::Pointer tileFilter = TileFilterType::New();<br>
<br> for (int sliceNumber=0; sliceNumber<5; sliceNumber++)<br> {<br> start[2] = sliceNumber;<br><br> desiredRegion.SetSize( size );<br> desiredRegion.SetIndex( start );<br><br> extractFilter->SetExtractionRegion( desiredRegion );<br>
extractFilter->SetInput( reader->GetOutput() );<br> extractFilter->Update();<br><br> TileFilterType::LayoutArrayType layout;<br> layout[0] = 1;<br> layout[1] = 1;<br> layout[2] = 0;<br>
tileFilter->SetLayout( layout );<br><br> // Set up pipeline<br> tileFilter->SetInput( extractFilter->GetOutput() );<br><br> // Vector of pointers to the many 2D extracted images<br>
std::vector< MiddleImageType::Pointer > extracts;<br> desiredRegion.SetIndex( start );<br><br> extracts.push_back( extractFilter->GetOutput() );<br><br> if (sliceNumber != 0)<br> {<br>
tileFilter->PushBackInput( extracts.back() );<br> }<br> extracts.back()->DisconnectPipeline();<br> }<br> tileFilter->Update();<br><br><br>Thanks a lot<br>Best regards<br>Bert<br><br>