[ITK Community] [Insight-users] compilation error when using itkMultiLabelSTAPLEImageFilter in ITK 4.5

Bill Lorensen bill.lorensen at gmail.com
Wed Feb 5 11:48:04 EST 2014


If you look in
Modules/Core/Common/include/itkConceptCheking.h at line 749 you will
see the error is coming from the Concept: /** Concept requiring T to
be an unsigned integer. */

This teels you that this filter wants the image to have an unsigned pixel type.

If you change:

typedef itk::Image< short, Dimension >    ShortImageType;
to

typedef itk::Image< unsigned short, Dimension >    ShortImageType;

the code should compile.



On Wed, Feb 5, 2014 at 11:25 AM, francois rousseau <rousseau at unistra.fr> wrote:
> Hi everyone,
>
> I've tried to use the itkMultiLabelSTAPLEImageFilter and it appears that,
> even without trying to "run" it, something went wrong for the complier
> (clang or gcc). I'm using ITK4.5
>
> Here is a sample of the code :
>
>  //ITK declaration
>
>   const   unsigned int        Dimension = 3;
>
>   typedef itk::Image< short, Dimension >    ShortImageType;
>
>
>   typedef itk::MultiLabelSTAPLEImageFilter< ShortImageType >
> STAPLEFilterType;
>
>   typedef STAPLEFilterType::Pointer STAPLEFilterPointer;
>
>
>   typedef ShortImageType::Pointer ShortImagePointer;
>
>
>   STAPLEFilterPointer filter = STAPLEFilterType::New();
>
>
> and the compiler message :
>
>
> In file included from
> /Users/rousseau/Code/src/InsightToolkit-4.5.0/Modules/IO/ImageBase/include/itkImageFileReader.h:22:
> In file included from
> /Users/rousseau/Code/src/InsightToolkit-4.5.0/Modules/IO/ImageBase/include/itkImageIOBase.h:26:
> In file included from
> /Users/rousseau/Code/src/InsightToolkit-4.5.0/Modules/Core/Common/include/itkImageIORegion.h:24:
> In file included from
> /Users/rousseau/Code/src/InsightToolkit-4.5.0/Modules/Core/Common/include/itkImageRegion.h:34:
> In file included from
> /Users/rousseau/Code/src/InsightToolkit-4.5.0/Modules/Core/Common/include/itkContinuousIndex.h:22:
> In file included from
> /Users/rousseau/Code/src/InsightToolkit-4.5.0/Modules/Core/Common/include/itkIndex.h:23:
> In file included from
> /Users/rousseau/Code/src/InsightToolkit-4.5.0/Modules/Core/Common/include/itkMath.h:33:
> /Users/rousseau/Code/src/InsightToolkit-4.5.0/Modules/Core/Common/include/itkConceptChecking.h:749:17:
> error: no viable conversion from 'UniqueType_bool<true>' to
> 'UniqueType_bool<(Self::Unsigned)>'
>       UnsignedT a = TrueT();
>                 ^   ~~~~~~~
> /Users/rousseau/Code/src/InsightToolkit-4.5.0/Modules/Core/Common/include/itkConceptChecking.h:755:3:
> note: in instantiation of member function
> 'itk::Concept::IsUnsignedInteger<short>::Constraints::constraints' requested
> here
>   itkConceptConstraintsMacro();
>   ^
> /Users/rousseau/Code/src/InsightToolkit-4.5.0/Modules/Core/Common/include/itkConceptChecking.h:62:36:
> note: expanded from macro 'itkConceptConstraintsMacro'
>   typedef Enforcer< & Constraints::constraints > EnforcerInstantiation
>                                    ^
> /Users/rousseau/Code/src/InsightToolkit-4.5.0/Modules/Segmentation/LabelVoting/include/itkMultiLabelSTAPLEImageFilter.hxx:229:9:
> note: in instantiation of member function
> 'itk::MultiLabelSTAPLEImageFilter<itk::Image<short, 3>,
>       itk::Image<short, 3>,
> float>::InitializeConfusionMatrixArrayFromVoting' requested here
>   this->InitializeConfusionMatrixArrayFromVoting();
>         ^
> /Users/rousseau/Code/src/InsightToolkit-4.5.0/Modules/Segmentation/LabelVoting/include/itkMultiLabelSTAPLEImageFilter.h:128:15:
> note: in instantiation of member function
> 'itk::MultiLabelSTAPLEImageFilter<itk::Image<short, 3>,
>       itk::Image<short, 3>, float>::GenerateData' requested here
>   itkNewMacro(Self);
>               ^
> /Users/rousseau/Code/src/InsightToolkit-4.5.0/Modules/Core/Common/include/itkMacro.h:142:21:
> note: expanded from macro 'itkNewMacro'
>   itkSimpleNewMacro(x)                                         \
>                     ^
> /Users/rousseau/Code/src/InsightToolkit-4.5.0/Modules/Core/Common/include/itkMacro.h:152:22:
> note: expanded from macro 'itkSimpleNewMacro'
>       smartPtr = new x;                                        \
>                      ^
> /Users/rousseau/Code/src/fbrain/Utilities/btkSTAPLE.cxx:80:50: note: in
> instantiation of member function
> 'itk::MultiLabelSTAPLEImageFilter<itk::Image<short, 3>, itk::Image<short,
> 3>, float>::New' requested here
>   STAPLEFilterPointer filter = STAPLEFilterType::New();
>                                                  ^
> /Users/rousseau/Code/src/InsightToolkit-4.5.0/Modules/Core/Common/include/itkConceptChecking.h:112:8:
> note: candidate constructor (the implicit copy constructor) not viable: no
> known conversion from 'TrueT' (aka 'UniqueType_bool<true>')
>       to 'const itk::Concept::Detail::UniqueType_bool<false> &' for 1st
> argument
> struct UniqueType_bool {};
>        ^
> 1 error generated.
>
>
> Any idea ?
>
> thank you
> françois
>
>
>
>
>
>
> _____________________________________
> 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
>



-- 
Unpaid intern in BillsBasement at noware dot com
_____________________________________
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 Community mailing list