[Insight-users] problems with imageserieswriter when using VED

John Drescher drescherjm at gmail.com
Sun Apr 12 20:25:19 EDT 2009


On Sun, Apr 12, 2009 at 7:50 PM, Wen Shi <wsa18 at sfu.ca> wrote:
> 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!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!


In C or C++ single quotes surround a single character, not a string.
Use double quotes

" instead.


>  format += "%03d.";
>  format += 'bmp';   // filename extension
>  nameGenerator1->SetSeriesFormat( format.c_str() );
>
>  //writer->SetFileName( "vessel(enhanced).png"  );
>  writer->SetInput ( rescale->GetOutput() );
>
Looks like the error is here and not where  you said. The error talks
about SetInput(). I am not sure of the reason for the error because
you did not post what rescale was.

>
>  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
>

John


More information about the Insight-users mailing list