[Insight-users] Create image types in run time

Luis Ibanez luis.ibanez at kitware.com
Mon Feb 23 08:39:37 EST 2009


Hi David,

Yes, the typical way of doing this is to write an Image class
that internally contains instantiation of all the image types
that you want to manage.

Then, you use Switch statements in order to pick the appropriate
type at run time.

For an example on how to do this,
please look at the Insight Journal paper:

     http://www.insight-journal.org/browse/publication/146

The paper includes the source code that manage multiple image types.


You will find the same source code in the InsightApplications
checkout, under the directory:

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


Note that, this code is mostly intended to interface with VTK,
but it will still illustrate how to manage a set of different
image types at run time.


    Regards,


       Luis


-----------------
David Pastor wrote:
> Hello,
>  
> I'm trying to write a program to create images automatically from an own 
> description and i need to pass the dimension of the image as a parameter 
> of the application so the template will be instantiated in run time 
> which is not feasible.
>  
> Is there anyway to work with a variable dimension? it seems that i need 
> to rewrite the whole code for each dimension. The problem will be fixed 
> if there is a generic itk::Image pointer for any dimension...
>  
> cheers
> david
> 
> 
> ------------------------------------------------------------------------
> 
> _____________________________________
> 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