[Insight-developers] Templates and preprocessor macros

Williams, Norman K norman-k-williams at uiowa.edu
Mon Jul 11 13:28:50 EDT 2011


The only way to solve this is with template metaprogramming.  This makes
for some extra work getting the syntax right, but you can write the code
so that it only uses a filter on 3D.


On the other hand, as one of the people who worked on OrientImageFilter
back in the day, I don't think anyone should be using OrientImageFilter
and it should be deprecated, because it destroys information. It only does
the right thing if all of the direction cosines are aligned with one of
the world coordinate axes.



On 7/11/11 11:10 AM, "Benoit Scherrer" <benoitscherrer at gmail.com> wrote:

> Hi,
>
>Is there a way to use the C++ preprocessor macros that test the value of
>a template parameter?
>For example i want to do a generic image filter ( using itk::Image<type,
>VImageDimension> ) that
>will use itk::OrientImageFilter only for VImageDimension==3
>
>However, it seems that the preprocessor tool does not 'expand' the
>templates and
>just don't know when VImageDimension==3 or not.
>
>Is there any trick to do that, or is it a lost cause ?
>
>Thanks a lot!
>
>Benoit
>_______________________________________________
>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://kitware.com/products/protraining.html
>
>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-developers



________________________________
Notice: This UI Health Care e-mail (including attachments) is covered by the Electronic Communications Privacy Act, 18 U.S.C. 2510-2521, is confidential and may be legally privileged.  If you are not the intended recipient, you are hereby notified that any retention, dissemination, distribution, or copying of this communication is strictly prohibited.  Please reply to the sender that you have received the message in error, then delete it.  Thank you.
________________________________


More information about the Insight-developers mailing list