[Insight-users] A problem with JoinSeriesImageFilter

shiwei swingsw89 at 163.com
Sat Oct 12 12:05:47 EDT 2013


Hi,All~
       Here I got a problem with the itk::JoinSeriesImageFilter,I read four different 2d images and want to join them to  one 3D Image by using JoinSeriesImageFilter.However, in the Test example,I finally got one 3D Image which has four same slices(not four different one),and it shows that the same slice are the last 2D image which read in to the memory. Now I'm confused about this ,and can anyone help me with that? The code is below, Thank you very much for that!


#include "itkImage.h"

#include "itkImageFileReader.h"

#include "itkImageFileWriter.h"

#include "itkJoinSeriesImageFilter.h"

typedef itk::Image< unsigned char,  2 >   InputImageType;

typedef itk::Image< unsigned char,  3 >   ImageType3D;

typedef itk::Image< unsigned char,  2 >   ImageType2D;

typedef itk::ImageFileReader< InputImageType > ReaderType;

typedef itk::ImageFileWriter< ImageType3D > WriterType;

typedef itk::JoinSeriesImageFilter<ImageType2D, ImageType3D> JoinSeriesImageFilterType;

int main()

{

 ReaderType::Pointer reader = ReaderType::New();

 JoinSeriesImageFilterType::Pointer joinFilter = JoinSeriesImageFilterType::New();

 int slice;

char* Src="D:\\ITK_test\\joinseriestest\\bin\\liimage1";

char* Ipo="_cor.tif";

char* Ipr="GFP_";

char* filename = new char[100];

char* writenname=new char[100];

for(slice=2600;slice<=2605;++slice)

{

    

filename[0] = '\0';

sprintf_s(filename,100,"%s\\%s%05d%s",Src,Ipr,slice,Ipo);

reader->SetFileName(filename);

reader->Update();

joinFilter->SetInput(slice-2600,reader->GetOutput());

}

joinFilter->Update();

  WriterType::Pointer writer = WriterType::New();

  writer->SetFileName( "D:\\ITK_test\\joinseriestest\\bin\\26001.tif" );

 writer->SetInput(joinFilter->GetOutput());

writer->Update();

return 0;

}

 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20131013/5c01acd8/attachment.htm>


More information about the Insight-users mailing list