[Insight-users] template at runtime
Luis Ibanez
luis.ibanez at kitware.com
Tue, 06 Apr 2004 17:56:55 -0400
Hi Corinne,
Your intuition is correct,
However you have to go a little bit further
in order to make it work.
You should create a templated class that
contains the entire pipeline you want to use.
or at least the section of the pipeline whose
types are dependent on your ImageType selection.
Then, in the switch statement that you just posted
you instantiate this templated pipeline class,
instead of only instantiating the ImageType.
You will find examples on how to do this in the
VolView plugins code in
InsightApplications/VolviewPlugins
Look for example at the DanielssonDistance
image plugin.
Please let us know if you have further
questions.
Thanks
Luis
------------------------
Corinne Mattmann wrote:
> Hi,
>
> I would like to write an application for two different image types. This
> means that I get an image - in my case from vtk - and then I would like
> to define an itkImageType depending on this image
> (vtkImageData->GetScalarType()). I tried to use the switch command:
>
> switch(aimReader_Image1->GetOutput()->GetScalarType()){
> case VTK_CHAR:
> typedef itk::Image<char, Dimension> ImageType;
> break;
> case VTK_SHORT:
> typedef itk::Image<short, Dimension> ImageType;
> break;
> default:
> typedef itk::Image<short, Dimension> ImageType;
> break;
> }
>
> But this results in the following error:
>
> error C2371: 'ImageType' : redefinition; different basic types
>
>
> How can I solve this problem?
> Thanks,
> Corinne
>
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
>