[Insight-users] problems with imageserieswriter when using VED

Wen Shi wsa18 at sfu.ca
Sun Apr 12 19:50:43 EDT 2009


Hi Guys,

As I heard from Luis that VED just deal with 3D images, I tried again using imageseriesreader to read in 5 slices image data and imageserieswriter to write the output slices.
But I got these errors when using series writer:

error C2015: too many characters in constant
error C2664: 'itk::ImageSeriesWriter<TInputImage,TOutputImage>::SetInput' : cannot convert parameter 1 from 'itk::Image<TPixel,VImageDimension> *' to 'const itk::Image<TPixel,VImageDimension> *'1>       

(The responsive code is: 
  typedef itk::ImageSeriesWriter< InputImageType, OutputImageType  >      ImageWriterType;
  ImageWriterType::Pointer writer = ImageWriterType::New();


  typedef itk::NumericSeriesFileNames    NameGeneratorType;
  NameGeneratorType::Pointer nameGenerator1 = NameGeneratorType::New();
 
  std::string format = 'output'; //  The errorC2015 occured here!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  format += "%03d.";
  format += 'bmp';   // filename extension
  nameGenerator1->SetSeriesFormat( format.c_str() );

  //writer->SetFileName( "vessel(enhanced).png"  );
  writer->SetInput ( rescale->GetOutput() );

  InputImageType::ConstPointer inputImage = rescale->GetOutput();
  InputImageType::RegionType   region     = inputImage->GetLargestPossibleRegion();
  InputImageType::IndexType    start      = region.GetIndex(); 
  InputImageType::SizeType     size       = region.GetSize(); 
 
  const unsigned int firstSlice = start[2];
  const unsigned int lastSlice  = start[2] + size[2] - 1;

  nameGenerator1->SetStartIndex( firstSlice );
  nameGenerator1->SetEndIndex( lastSlice );
  nameGenerator1->SetIncrementIndex( 1 );

  writer->SetFileNames( nameGenerator1->GetFileNames() );// The errorC2664 occured here. !!!!!!!!!!!!

I think maybe I misused the imageserieswriter.

Could someone help me with this?
Which parameter I should assign to the std::string format?

Thanks a lot

Wen Shi


 







More information about the Insight-users mailing list