[Insight-developers] 'sniffing' image files?

Kent Williams norman-k-williams at uiowa.edu
03 Feb 2004 12:14:17 -0600


The ImageIO classes do a great job of hiding the ugly details of reading
in the myriad flavors of image-on-disk, but a developer here at Iowa had
a question: Can you find out an image's native format before you read it
in?

So my answer to her is 'no' -- but I could certainly add a method to the
ImageFileReader class to expose the on-disk format -- number of
dimensions, pixel type, etc.  The question is ... is this a good idea?

The developer is working on a 'general' file reader using ITK to replace
the myriad home-brew readers in brains2. Given the way the current code
currently works, she'll have to do something like read every image into
a 10-dimensional double image in order to catch all possible image
types.

The ITK way of being is to just read the image into the format you
intend to work with, of course, but I can see other cases where it would
be useful to know the on-disk format...