[Insight-users] know an image pixel type at reading
jerome schmid
jerome.schmid@ircad.u-strasbg.fr
Wed May 19 08:32:33 EDT 2004
Hi everybody,
I have a question about image reading from file. Itk intensive use of
template has a lot of advantages but present a little problem, and before I
may say stupid things, I want to ask you if there is already a way to solve
my problem.
When reading an image from file we define a type of reader as a combination
of image pixel type and dimension:
typedef itk::Image< PixelType, dim > InImageType
A lot of type of image, like tiff for instance, define in their header the
pixel type, like for example unsigned short, unsigned char, etc.
So in order to create an appropriate reader, you must know before, that is
to say when you write your code as everything is templated and not dynamic,
the pixel type...! How it is possible if you know it dynamically when you
open the file?
I know the typelist mechanism which allows you to write a kind of switch on
image type which will instanciate the good reader, even if the compilation
can be long due to all the pixel type possible you have chosen to
support...But this tricky system works at condition that you can know
dynamically the pixel type you will use after.
So my question is, is there a way to read from an image, wihtout loading it,
the pixel type which is storen in an header in order to retrieve it ( like
an RTTI typeinfo for instance )? I don't want to write wrappers for all the
kind of images that exist, itk does it so well!
Thanks!
Jerome
More information about the Insight-users
mailing list