[Insight-users] image io
Ziv Yaniv
zivy at isis.imac.georgetown.edu
Fri Aug 11 14:30:40 EDT 2006
Hi all,
After using the itk image IO for a while I have one question and one
wish-list request:
1. When reading image data is there a way to read data without
specifying the pixel type in advance?
typedef itk::Image<int,3> ImageType;
typedef itk::ImageReader<ImageType> ReaderType;
The ITK toolkit makes the assumption that I know the pixel type in
advance which is not always the case. This primarily happens when I read
DICOM images. The toolkit itself loads the data correctly into memory as
it knows what the pixel type is after reading the DICOM header. Once the
data is read it is cast to the pixel type that I had provided (e.g. int,
see above). As I'm not sure what the pixel type is I will usually use
the largest possible primitive (double), which is a waste of memory. Is
there an elegant way to query the file and then create a correct image
type and reader?
2. When writing 2D images (jpg/png/bmp) the writers check that the image
is 2D and that the pixel type is valid (e.g. unsigned int), what they
don't check is that the image is isotropic which is what these image
file formats assume. Please add this as an additional condition for
successful image writing (took me a while to understand why my extracted
slices were so distorted).
best
Ziv
P.S. From the itkJPEGImageIO.h (itk 2.8):
/** Determine the file type. Returns true if this ImageIO can read the
* file specified. */
virtual bool CanWriteFile(const char*);
Should be "... can write the ...", the joys of cut and paste.
More information about the Insight-users
mailing list