VTK/MNI File Formats

From KitwarePublic
< VTK
Jump to navigationJump to search

The Montreal Neurological Institute (MNI) has a variety of medical image processing tools that might be useful to VTK consumers and developers. The purpose of this project is to to support the MNI file formats in VTK, so that people who use VTK can interoperate with MNI software and use the MNI datasets. Of particular interest is Brainweb, their database of MR head images.

MINC

The vtkMINCImageReader and vtkMINCImageWriter support version 1 of the MINC (Medical Image NetCDF) file format. The main features of MINC are:

  1. Multi-dimensional volumes can be stored in a single file
  2. The header is both highly standardized and extensible
  3. It supports image orientation (direction cosines)
  4. It stores real-valued data with physical units

The header information for MINC is stored in a class called vtkMINCImageAttributes, which makes it easy to read, write, extend, and verify the header information. Like the NetCDF format that it is based on, the header can contain arrays of arbitrary type that may be sized to the image dimensions.

MINC v2 uses the HDF5 file format, and is therefore not supported because VTK only includes the NetCDF libraries and not the HDF5 libraries. However, since NetCDF v4 can read HDF5 files, and since VTK 5.8 includes NetCDF v4, there is a possibility that MINC v2 could be supported in the future. But for now, only MINC v1 files can be read with the vtkMINCImageReader.

MNI Objects

The MNI .obj format is used for geometrical data. It is a simple text-based format without the same flexibility as MINC.

  1. Polygons and polylines are supported
  2. Polygon normals are supported (in fact, mandatory)
  3. Colors and surface properties are supported
  4. Colors may be per-point, per-cell, or per-object
  5. Binary files are supported (but are native endian, i.e. not portable)

The vtkMNIObjectWriter has methods called SetProperty() and SetMapper() so that it save an actor's colors and surface properties in the file. In other words, vtkMNIObjectWriter can be used as an exporter for a vtkActor.

VTK does not support all extensions that exist for the .obj format. It is not possible to use these datatypes:

  1. vertices
  2. bitmaps
  3. quads

MNI Transforms

The MNI .xfm format is for transform storage. It supports a useful subset of VTK's transforms:

  1. linear transforms (up to 12 degrees of freedom)
  2. grid transforms (cubic interpolation of deformation vectors)
  3. thin-plate spline transforms

For grid transforms, the grid itself is stored in a MINC file, and the .xfm file contains a relative or absolute path to that MINC file. One very useful feature of the MNI .xfm files is that they can contain multiple transforms per file, where the full transform is the concatenation of all the stored transforms. These concatenated transforms are handled in VTK by the vtkGeneralTransform class.

MNI Tags

The MNI .tag format is used for annotations. It contains a list of one or two point sets, as well as text for each point. Due to the age of this format (circa 1992) the label text must be ASCII in order to ensure compatibility with all software.

The vtkMNITagPointReader will output a vtkPointSet and store the text in an array called LabelText. The output can be fed into vtkPointSetToLabelHierarchy and used with VTK's label mappers. Alternatively, the user can grab the label text directly from the reader and use their own code to display the labels.

Classes

  • vtkMINCImageReader/Writer/Attributes
  • vtkMNIObjectReader/Writer
  • vtkMNITransformReader/Writer
  • vtkMNITagPointReader/Writer

Examples

Please see the following examples, which are part of VTK's nightly regression tests:

  • VTK/Hybrid/Testing/Tcl/TestMNIObjects.tcl
  • VTK/Hybrid/Testing/Tcl/TestMNITransforms.tcl
  • VTK/Hybrid/Testing/Tcl/TestMNITagPoints.tcl