[Insight-users] Question about ItkAndImageFilter

Bill Lorensen bill.lorensen at gmail.com
Mon Mar 12 13:41:09 EST 2007


XueQuan,

The AndImageFilter (and other logical filters) require types that are of
integral type. From the comments in itkAndImageFilter.h:
 *
 * Since the logical AND operation is only defined in C++ for integer
 * types, the images passed to this filter must comply with the requirement
 * of using integer pixel type.

Unfortunately, the error message is a bit cryptic. If you turn
ITK_USE_CONCEPT_CHECKING ON (it is an advanced cmake option), you will see a
better error message.

So, you should cast your input to an integral type before doing the and.

Bill



On 3/12/07, qxue at jouy.inra.fr <qxue at jouy.inra.fr> wrote:
>
> Hello, everyone:
>
>   I am using the "ItkAndImageFilter" in VC6.0 in Windows XP by CMake2.4.
> When I
> add the ITKAndImageFilter to my program, there are errors as following:
>
> C:\DOCUME~1\qxue\MESDOC~1\ITK\INSIGH~1.0\Code\BASICF~1\itkAndImageFilter.h(64)
> :
> error C2296: '&' : illegal, left operand has type 'const float'
>
>
> C:\DOCUME~1\qxue\MESDOC~1\ITK\INSIGH~1.0\Code\BASICF~1\itkAndImageFilter.h(63)
> : while compiling class-template member function 'float __thiscall
> itk::Functor::AND<float,float,float>::operator ()(const float &,const
> float &)'
> C:\DOCUME~1\qxue\MESDOC~1\ITK\INSIGH~1.0\Code\BASICF~1\itkAndImageFilter.h(64)
> :
> error C2297: '&' : illegal, right operand has type 'const float'
>
>
> C:\DOCUME~1\qxue\MESDOC~1\ITK\INSIGH~1.0\Code\BASICF~1\itkAndImageFilter.h(63)
> : while compiling class-template member function 'float __thiscall
> itk::Functor::AND<float,float,float>::operator ()(const float &,const
> float &)'
> CellularSegmentationApplication.cxx
> C:\DOCUME~1\qxue\MESDOC~1\ITK\INSIGH~1.0\Code\BASICF~1\itkAndImageFilter.h(64)
> :
> error C2296: '&' : illegal, left operand has type 'const float'
>
>
> C:\DOCUME~1\qxue\MESDOC~1\ITK\INSIGH~1.0\Code\BASICF~1\itkAndImageFilter.h(63)
> : while compiling class-template member function 'float __thiscall
> itk::Functor::AND<float,float,float>::operator ()(const float &,const
> float &)'
> C:\DOCUME~1\qxue\MESDOC~1\ITK\INSIGH~1.0\Code\BASICF~1\itkAndImageFilter.h(64)
> :
> error C2297: '&' : illegal, right operand has type 'const float'
>
>
> C:\DOCUME~1\qxue\MESDOC~1\ITK\INSIGH~1.0\Code\BASICF~1\itkAndImageFilter.h(63)
> : while compiling class-template member function 'float __thiscall
> itk::Functor::AND<float,float,float>::operator ()(const float &,const
> float &)'
>
>      I have used other filters from ITK and there are fine.
>
>      Who can give me a help to resolve it?
>
>      Best regards,
> XueQuan
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20070312/12c3ea42/attachment.htm


More information about the Insight-users mailing list