[Insight-users] unknown imagetype

David Doria daviddoria at gmail.com
Mon Jul 4 19:45:31 EDT 2011


On Mon, Jul 4, 2011 at 1:20 PM, barbababa <tonimuusimaki at gmail.com> wrote:
>
> Hi all!
>
> I have a function
>
>        ulong dim;
>        std::string datam;
>        getimagetype(src_img_in, datam, dim);
>
> ,which returns datam = "float" if the source image is float type.
>
> How could i implement this to here:
>
>        typedef itk::Image&lt;datam,dim&gt; ImageType;
>
> without giving a  list of errors????
>
> Thanks
>

There is no way to do this. Template parameters are a compile time
thing, where 'datam' in your example is not known until runtime. The
only way to do it is to manually instantiate every possible image type
you would expect to see inside of a conditional statement:
http://www.itk.org/Wiki/ITK/Examples/IO/ReadUnknownImageType

David


More information about the Insight-users mailing list