[Insight-users] error c2440

rsy at in2p3.fr rsy at in2p3.fr
Mon May 27 09:14:18 EDT 2013


Hi,

i have an issue :

error C2440: 'initialisation' : impossible de convertir de  
'itk::Concept::Detail::UniqueType_bool<__formal>' en  
'itk::Concept::Detail::UniqueType_bool<__formal>'

and it's write to check the instanciation of functions...


apparently the input and ouput image has not the same type ... but i  
don't see the problem.

I let my code (it's a melt with MeVisLab, i found a part in their  
forum to adapt it)

If you have any idea, you are welcome.

Thanks,

Ronan

--------------------------------------------------------------

template <typename T>
void comptage::calculateOutputSubImage(TSubImage<T>* outputSubImage,  
int outputIndex
                                      , TSubImage<T>* inputSubImage0
                                      )
{
   // Compute subimage of output image outputIndex from input subimages.


          const SubImageBox validOutBox = outputSubImage->getValidRegion();

         mlDebug(" outputIndex " << outputIndex <<  " inputSubImage0 "  
<< inputSubImage0->getExtent()[0] << " " <<  
inputSubImage0->getExtent()[1]);
         mlDebug(" inputImage0 " <<  
getInputImage(0)->getImageExtent()[0] << " " <<  
getInputImage(0)->getImageExtent()[1]);


         const unsigned int imageDimension = 2;
         typedef itk::Image<T, imageDimension> ImageType;


         ImageType::SizeType size;
         size[0] = inputSubImage0->getExtent()[0];  // size along X
         size[1] = inputSubImage0->getExtent()[1];  // size along Y
         ImageType::IndexType start;
         start[0] = start[1] = 0;
         ImageType::RegionType region;
         region.SetSize( size );
         region.SetIndex( start );

         double origin[imageDimension];
         origin[0] = inputSubImage0->getOrigin()[0];  // origin X
         origin[1] = inputSubImage0->getOrigin()[1];  // origin Y
         double spacing[imageDimension];
         spacing[0] = spacing[1] = 1;

         // Importation d'un tableau C standard en itk::Image
         typedef typename itk::ImportImageFilter < T, imageDimension >  
ImportFilterType;

         ImportFilterType::Pointer itkImageImporter = ImportFilterType::New();
         itkImageImporter->SetRegion( region );
         itkImageImporter->SetOrigin( origin );
         itkImageImporter->SetSpacing( spacing );
         itkImageImporter->SetImportPointer(inputSubImage0->getData(),  
inputSubImage0->getNumVoxels(), false);
         itkImageImporter->Update();


           typedef itk::ConnectedComponentImageFilter <ImageType,  
ImageType > ConnectedComponentImageFilterType;
    ConnectedComponentImageFilterType::Pointer  
connectedComponentImageFilter = ConnectedComponentImageFilterType::New  
();
   connectedComponentImageFilter->SetInput(itkImageImporter->GetOutput());
   connectedComponentImageFilter->Update();

   typedef itk::LabelImageToLabelMapFilter <ImageType>  
LabelImageToLabelMapFilterType;
    LabelImageToLabelMapFilterType::Pointer labelImageToLabelMapFilter  
= LabelImageToLabelMapFilterType::New ();
    
labelImageToLabelMapFilter->SetInput(connectedComponentImageFilter->GetOutput());
   labelImageToLabelMapFilter->Update();

   // The output of this filter is an itk::LabelMap, which contains  
itk::LabelObject's
   std::cout << "There are " <<  
labelImageToLabelMapFilter->GetOutput()->GetNumberOfLabelObjects() <<  
" objects." << std::endl;

}


----------------------------------------------------------------------------
This message was sent using the webmail platform from IN2P3 Computing Center




More information about the Insight-users mailing list