[Insight-users] ConnectedComponentImageFilter and RGBPixel

Gaëtan Lehmann gaetan.lehmann at jouy.inra.fr
Wed Jan 14 08:10:49 EST 2009


Le 14 janv. 09 à 11:17, Julien Michel a écrit :

> Gaëtan Lehmann a écrit :
>
>>> It might be related to the optimisations I made.
>> I've just checked - still  builds here.
>> Can you give the exact error message you get? Maybe your problem is  
>> related to the typo in the name? There's no "s" in the name!
>> Gaëtan
>
> Dear Gaëtan,
>
> The exact code is :
>
> typedef itk::RGBPixel<unsigned char>  InputPixelType;
> typedef unsigned short LabelPixelType;
> typedef itk::Image<InputPixelType,2> InputImageType;
> typedef itk::Image<LabelPixelType,2> LabelImageType;
> typedef  
> itk::ConnectedComponentImageFilter<InputImageType,LabelImageType>  
> ConnectedComponentFilterType;
>  ConnectedComponentFilterType::Pointer  connectedComponentFilter =  
> ConnectedComponentFilterType::New();
>
> And the exact compilation error is:
>
> /ORFEO/julien/ORFEO-TOOLBOX/otb-hg/OTB/Utilities/ITK/Code/ 
> BasicFilters/itkConnectedComponentImageFilter.txx: In member  
> function void itk::ConnectedComponentImageFilter<TInputImage,  
> TOutputImage, TMaskImage>::ThreadedGenerateData(const typename  
> TOutputImage::RegionType&, int) [with TInputImage =  
> itk::Image<itk::RGBPixel<unsigned char>, 2u>, TOutputImage =  
> itk::Image<short unsigned int, 2u>, TMaskImage =  
> itk::Image<itk::RGBPixel<unsigned char>, 2u>]:
> /ORFEO/julien/ORFEO-TOOLBOX/otb-hg/OTB/Testing/Code/BasicFilters/ 
> otbPolygonCompacityFunctor.cxx:113:   instantiated from here
> /ORFEO/julien/ORFEO-TOOLBOX/otb-hg/OTB/Utilities/ITK/Code/ 
> BasicFilters/itkConnectedComponentImageFilter.txx:170: error:  
> invalid conversion from short unsigned int to const unsigned char*
> /ORFEO/julien/ORFEO-TOOLBOX/otb-hg/OTB/Utilities/ITK/Code/ 
> BasicFilters/itkConnectedComponentImageFilter.txx:170: error:    
> initializing argument 1 of itk::FixedArray<TValueType,  
> VLength>::FixedArray(const TValueType*) [with TValueType = unsigned  
> char, unsigned int VLength = 3u]
> /ORFEO/julien/ORFEO-TOOLBOX/otb-hg/OTB/Testing/Code/BasicFilters/ 
> otbPolygonCompacityFunctor.cxx:113:   instantiated from here
> /ORFEO/julien/ORFEO-TOOLBOX/otb-hg/OTB/Utilities/ITK/Code/ 
> BasicFilters/itkConnectedComponentImageFilter.txx:180: error:  
> invalid conversion from short unsigned int to const unsigned char*
> /ORFEO/julien/ORFEO-TOOLBOX/otb-hg/OTB/Utilities/ITK/Code/ 
> BasicFilters/itkConnectedComponentImageFilter.txx:180: error:    
> initializing argument 1 of itk::FixedArray<TValueType,  
> VLength>::FixedArray(const TValueType*) [with TValueType = unsigned  
> char, unsigned int VLength = 3u]
>
> This was compiling with previous ITK versions (3.8.XX), since the  
> compilation error first occured when we upgraded to ITK 3.10.1.


Hi Julien,

My build works because of a commit I missed in ITK:

http://public.kitware.com/cgi-bin/viewcvs.cgi/Code/BasicFilters/itkConnectedComponentImageFilter.txx?root=Insight&r1=1.29&r2=1.30&sortby=date

That code builds, but I'm not sure about what it will do with a  
RGBPixel type as input. I'll fix the code in a cleaner way. In the  
mean time, you can fix itkConnectedComponentImageFilter.txx by replacing

   m_BackgroundValue

line 170 and line 180 by

   NumericTraits<InputPixelType>::Zero

I made the hypothesis that input pixel type can be compared to output  
pixel type, which is wrong obviously when the input is not a scalar.

Thanks for the report.

Gaëtan



-- 
Gaëtan Lehmann
Biologie du Développement et de la Reproduction
INRA de Jouy-en-Josas (France)
tel: +33 1 34 65 29 66    fax: 01 34 65 29 09
http://voxel.jouy.inra.fr  http://www.mandriva.org
http://www.itk.org  http://www.clavier-dvorak.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 186 bytes
Desc: Ceci est une signature ?lectronique PGP
URL: <http://www.itk.org/pipermail/insight-users/attachments/20090114/c577c8a3/attachment.pgp>


More information about the Insight-users mailing list