[Insight-users] Re: TileImageFilter

Luis Ibanez luis.ibanez at kitware.com
Mon Oct 24 15:25:46 EDT 2005


Hi Suresh,

What values did you passed to the Layout argument ?

That is,
what values did you put in the command line for

         argv[1]
         argv[2]
         argv[3]


Please let us know.


BTW, The test for the TileImageFilter is working
fine in the Dashboard. So, it seems that the problem
may be with the way you are invoking this filter.


   Regards,


      Luis


----------------
Suresh G N wrote:
> Hey Luis,
> 
> I am using TileImageFilter to append a bunch of slices. I am not able to 
> append the Images. Below I am giving an idea of my implementation
> 
> 1) Read a 3D volume
> for(n=0; n->user specified no of slices)
> {
>      2) Extract user specified slice (from first slice)
>      3) Extract ROI
>      4) Apply Discrete GaussianFilter
>      5) Do some processing (Some 2D processing)
>      6) Paste ROI back to the slice (slice got from step 2)
>      7) TileImageFilter
>      8) Write it to Harddisk
> }
> 
> problem is I am getting the volume, but TileImageFilter taking all the 
> volume slices as the last slice. till paste image filter the output is 
> correct. I wrote a separate TileImageFilter program, it is working fine.
> 
> Thank in advance
> Suresh
> 
> Tile Image Filter Code:
> 
> #include "itkTileImageFilter.h"
> #include "itkImageFileReader.h"
> #include "itkImageFileWriter.h"
> 
> int main(int argc, char *argv[] )
> {
> 
>   typedef unsigned short PixelType;
>   enum { InputImageDimension = 2 };
>   enum { OutputImageDimension = 3 };
> 
>   typedef itk::Image<PixelType,InputImageDimension> InputImageType;
>   typedef itk::Image<PixelType,OutputImageDimension> OutputImageType;
> 
>   typedef itk::ImageFileReader< InputImageType > ImageReaderType ;
>   typedef itk::TileImageFilter<InputImageType,OutputImageType> TilerType;
>   typedef itk::ImageFileWriter<OutputImageType> WriterType;
> 
>   if (argc < 6)
>     {
>     std::cerr << "Usage: " << std::endl;
>     std::cerr << argv[0] << "  iSize jSize kSize input1 input2 ... 
> inputn output" << std::endl;
>     return 1;
>     }
> 
>   itk::FixedArray<unsigned int,3> layout;
>   layout[0] = atoi(argv[1]);
>   layout[1] = atoi(argv[2]);
>   layout[2] = atoi(argv[3]);
> 
>   // Tile the input images
>   TilerType::Pointer tiler = TilerType::New();
>   int f = 0;
>   for (int i=4; i < argc - 1; i++)
>   {
>     ImageReaderType::Pointer reader = ImageReaderType::New();
>     reader->SetFileName (argv[i]);
>     reader->Update();
>     tiler->SetInput(f++,reader->GetOutput());
>   }
>   tiler->SetLayout(layout);
>   tiler->Update();
> 
>   WriterType::Pointer writer = WriterType::New();
> 
>   writer->SetFileName(  argv[argc-1] );
> 
>   try
>     {
>     writer->SetInput(tiler->GetOutput());
>     writer->Update();
>     }
>   catch( itk::ExceptionObject & excp )
>     {
>     std::cerr << "Error while writing the series with SeriesFileNames 
> generator" << std::endl;
>     std::cerr << excp << std::endl;
>     return EXIT_FAILURE;
> 
>     }
>   std::cout << "Test passed." << std::endl;
>   return EXIT_SUCCESS;
> 
> }
> 



More information about the Insight-users mailing list