[Insight-users] About the second type parameter of itk::Image

Luis Ibanez luis.ibanez at kitware.com
Thu Feb 19 10:45:10 EST 2009


Hi 李健,

Yes,
only constants can be used as numeric arguments of templated classes.

This is not an ITK issue, but a standard C++ templates feature.

If you want to convert images from an existing application into ITK
images, you may want to look at the Tutorials:

http://www.itk.org/ITK/help/tutorials.html

in particular to:

http://www.itk.org/CourseWare/Training/GettingStarted-V.pdf


---

A typical way of solving this issue is to create a non-templated
image class that internally can store either 2D or 3D images, and
select them based through "switch" or "if" statements.

For an illustration on how this can be done, please look at the
Insight Journal paper:
http://www.insight-journal.org/browse/publication/146

and the code in

InsightApplications/Auxiliary/vtk
                        vtkKWImage.cxx
                        vtkKWImage.h
                        vtkKWImageIO.cxx
                        vtkKWImageIO.h



   Regards,


      Luis


--------------
李健 wrote:
> Dear all:
>  
> It seems that only constants or constant variables can be passed to the 
> second type parameter(the image dimension) of itk::Image when itk::Image 
> object is created. Am I right? So if I want to import an image from the 
> output of a class which is not a itk class to itk classes, and 
> the information of the image dimension is stored in a nonconstant 
> variable, how can I pass the dimension imformation when I was creating 
> the itk::Image object?
>  
> Thanks a lot. 
> 
> ------------------------------------------------------------------------
> 各位明星之间什么关系?Live 人气榜为您悄然揭示。 现在就看看! 
> <http://cnweb.search.live.com/xrank/?Form=MEVHAA >
> 
> 
> ------------------------------------------------------------------------
> 
> _____________________________________
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.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-users


More information about the Insight-users mailing list