Raw image files

From I Do Imaging
Jump to: navigation, search

Reading raw image data

Some image formats may be stored with varying data formats. Certain image formats allow the image (voxel) data to be read directly, without parsing the image header, or it may be possible to read the voxel data from the file after the header. This is often called raw or flat file access. This provides the very lowest-level access to the images, and gives you complete control on how the image data are read. Normally this is not necessary, but when dealing with an unknown image format, or image data that does not have a header, this can be a very useful feature.

It's also sometimes possible to work out from the file size, the slice count and dimensions of each slice. The size of a file containing only voxel data is the number of slices in the file (possibly 1), multiplied by the number of voxels in that slice (X * Y), multiplied by the number of bytes per voxel (commonly 2).

If the image data is stored in a square matrix, the size of the file can give you a clue as to the image dimensions and the length of the header. A common image size (bytes per slice) is:

256 x 256 x 2 bytes/pixel = 131,072 bytes