[Insight-users] error c2440

Bradley Lowekamp blowekamp at mail.nih.gov
Tue May 28 13:53:21 EDT 2013


Hello,

The error message you posted is only part the the complete message. Please include, the prior error messages which describe the context of this error. It will tell you that class which has template parameters which don't work with that filter.

Brad

On May 27, 2013, at 9:14 AM, rsy at in2p3.fr wrote:

> 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
> 
> 
> _____________________________________
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
> 
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.php
> 
> 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