ITK/File Formats

From KitwarePublic
Jump to navigationJump to search

ITK features a powerful plugin-based IO mechanism for reading and writing images, which is covered in detail in Chapter 7 (PDF page 219) of the ITK Software Guide.

File Formats and Pixel Types

The itk::Image<> class can be templated over virtually any pixel type, however not all file formats support all data types for reading and writing. In some cases, it may be necessary to add an itk::CastImageFilter<> to convert the output to a pixel format appropriate for the target file. It is important not to truncate the data by converting to a smaller type (ie. short -> char). In this case, the itk::RescaleIntensityImageFilter<> can be used before casting.

The following table lists the built-in file format support against each data type:

  • Analyze
char
unsigned char
short
unsigned short
int
unsigned int
float
double
RGB<unsigned char>
  • BMP (2D only)
unsigned char
RGB<unsigned char>
float
char
unsigned char
short
unsigned short
RGB<char>
RGB<short>
  • GDCM
unsigned char
char
unsigned short
short
unsigned int
int
double
  • GE
???
  • GIPL
binary
char
unsigned char
short
unsigned short
unsigned int
int
float
double
short
surface
polygon
  • IPL
???
  • JPEG (2D only)
unsigned char
  • MetaImage (mhd): raw, compressed
char
unsigned char
short
unsigned short
long
ulong
int
unsigned int
float
double
vector<>
  • Nrrd
char
unsigned char
short
unsigned short
int
unsigned int
float
double
  • PNG (2D)
unsigned char
unsigned short
RGB
RGBA
  • SiemensVision
???
  • Stimulate
char
short
int
float
double
  • TIFF (2D only)
unsigned char
unsigned short
RGB
  • VTK
float
double
unsigned char
char
unsigned short
short
unsigned int
int
unsigned long
long
RGB