[Insight-users] Problem when using seriesreader together with series writer

Luis Ibanez luis.ibanez at kitware.com
Thu Apr 16 13:03:29 EDT 2009


Hi Wen,

The message:

 >
 > error C2440: 'initializing' : cannot convert from 
'itk::Image<TPixel,VImageDimension> *' to 'itk::SmartPointer<TObjectType>'
 >


Is a compilation error.


The error indicates that you are not using a consistent
declaration of image types.


Could you please post to the list the *exact* content of
the line of code where you are seeing this error ?



     Thanks



        Luis




----------------
Wen Shi wrote:
> Hi Guys,
> 
> I was using VED(vesselness enhancement filter) and using imageseriesreader and serieswriter(Since VED only deals with 3D image data)
> 
> The problem occured when the writer try to read the output of the rescalefilter.
> I got errors like this:
> 
> error C2440: 'initializing' : cannot convert from 'itk::Image<TPixel,VImageDimension> *' to 'itk::SmartPointer<TObjectType>'
> 
> The rescalefilter code along with the responsive codes are as follows:
> 
> 
> typedef itk::Image<unsigned char, 3>              OutputImageType;
> const unsigned int Dimension = 3;
> typedef double     OutputVesselnessPixelType;
>  typedef itk::Image<unsigned char, 3>              OutputImageType;
>  typedef itk::Image< OutputVesselnessPixelType, Dimension> VesselnessOutputImageType;
> 
> typedef itk::RescaleIntensityImageFilter< VesselnessOutputImageType,
>                                             OutputImageType>
>                                             RescaleFilterType;
> 
>   RescaleFilterType::Pointer rescale = RescaleFilterType::New();
>   rescale->SetInput( MultiScaleVesselnessFilter->GetOutput() );
>   rescale->SetOutputMinimum(   0 );
>   rescale->SetOutputMaximum( 255 );
> 
>   try
>     {
>      rescale->Update();
>     }
>   catch( itk::ExceptionObject & err )
>     {
>     std::cerr << "Exception caught: " << err << std::endl;
>     return EXIT_FAILURE;
>     }
>   
> 
> 
> 
>   typedef itk::ImageSeriesWriter< OutputImageType, OutputImageType  >      ImageWriterType;
>   ImageWriterType::Pointer writer = ImageWriterType::New();
> 
> 
>   typedef itk::NumericSeriesFileNames    NameGeneratorType;
>   NameGeneratorType::Pointer nameGenerator1 = NameGeneratorType::New();
>  
>   std::string format = "output";
>   format += "%03d.";
>   format += "png";   // filename extension
>   nameGenerator1->SetSeriesFormat( format.c_str() );
>   InputImageType::ConstPointer inputImage = rescale->GetOutput();// The error is pointing here!!!!!!!!!!!!!!!!!!!!!!! I guess here is buggy??
>   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() );
> 
> Thanks a lot
> Wen Shi
> _____________________________________
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
> 
> Please keep messages on-topic and check the ITK FAQ at: http://www.itk.org/Wiki/ITK_FAQ
> 
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
> 


More information about the Insight-users mailing list