#include <vtkMetaImageWriter.h>
One of the formats for which a reader is already available in the toolkit is the MetaImage file format. This is a fairly simple yet powerful format consisting of a text header and a binary data section. The following instructions describe how you can write a MetaImage header for the data that you download from the BrainWeb page.
The minimal structure of the MetaImage header is the following:
NDims = 3 DimSize = 181 217 181 ElementType = MET_UCHAR ElementSpacing = 1.0 1.0 1.0 ElementByteOrderMSB = False ElementDataFile = brainweb1.raw
NDims indicate that this is a 3D image. ITK can handle images of arbitrary dimension. DimSize indicates the size of the volume in pixels along each direction. ElementType indicate the primitive type used for pixels. In this case is "unsigned char", implying that the data is digitized in 8 bits / pixel. ElementSpacing indicates the physical separation between the center of one pixel and the center of the next pixel along each direction in space. The units used are millimeters. ElementByteOrderMSB indicates is the data is encoded in little or big endian order. You might want to play with this value when moving data between different computer platforms. ElementDataFile is the name of the file containing the raw binary data of the image. This file must be in the same directory as the header.
MetaImage headers are expected to have extension: ".mha" or ".mhd"
Once you write this header text file, it should be possible to read the image into your ITK based application using the itk::FileIOToImageFilter class.
Definition at line 73 of file vtkMetaImageWriter.h.
Public Types | |
typedef vtkImageWriter | Superclass |
Public Member Functions | |
virtual const char * | GetClassName () |
virtual int | IsA (const char *type) |
void | PrintSelf (ostream &os, vtkIndent indent) |
virtual void | SetCompression (bool compress) |
virtual bool | GetCompression (void) |
virtual void | Write () |
virtual void | SetFileName (const char *fname) |
virtual char * | GetFileName () |
virtual void | SetRAWFileName (const char *fname) |
virtual char * | GetRAWFileName () |
Static Public Member Functions | |
static int | IsTypeOf (const char *type) |
static vtkMetaImageWriter * | SafeDownCast (vtkObject *o) |
static vtkMetaImageWriter * | New () |
Protected Member Functions | |
vtkMetaImageWriter () | |
~vtkMetaImageWriter () | |
virtual void | SetMHDFileName (const char *) |
Protected Attributes | |
char * | MHDFileName |
bool | Compress |
vtkMetaImageWriter::vtkMetaImageWriter | ( | ) | [protected] |
vtkMetaImageWriter::~vtkMetaImageWriter | ( | ) | [protected] |
virtual const char* vtkMetaImageWriter::GetClassName | ( | ) | [virtual] |
Reimplemented from vtkImageWriter.
static int vtkMetaImageWriter::IsTypeOf | ( | const char * | name | ) | [static] |
Return 1 if this class type is the same type of (or a subclass of) the named class. Returns 0 otherwise. This method works in combination with vtkTypeRevisionMacro found in vtkSetGet.h.
Reimplemented from vtkImageWriter.
virtual int vtkMetaImageWriter::IsA | ( | const char * | name | ) | [virtual] |
Return 1 if this class is the same type of (or a subclass of) the named class. Returns 0 otherwise. This method works in combination with vtkTypeRevisionMacro found in vtkSetGet.h.
Reimplemented from vtkImageWriter.
static vtkMetaImageWriter* vtkMetaImageWriter::SafeDownCast | ( | vtkObject * | o | ) | [static] |
Reimplemented from vtkImageWriter.
void vtkMetaImageWriter::PrintSelf | ( | ostream & | os, | |
vtkIndent | indent | |||
) | [virtual] |
Methods invoked by print to print information about the object including superclasses. Typically not called by the user (use Print() instead) but used in the hierarchical print process to combine the output of several classes.
Reimplemented from vtkImageWriter.
static vtkMetaImageWriter* vtkMetaImageWriter::New | ( | ) | [static] |
Construct object with FlipNormals turned off and Normals set to true.
Reimplemented from vtkImageWriter.
virtual void vtkMetaImageWriter::SetFileName | ( | const char * | fname | ) | [virtual] |
Specify file name of meta file
Reimplemented from vtkImageWriter.
virtual char* vtkMetaImageWriter::GetFileName | ( | ) | [inline, virtual] |
Specify file name of meta file
Reimplemented from vtkImageWriter.
Definition at line 85 of file vtkMetaImageWriter.h.
virtual void vtkMetaImageWriter::SetRAWFileName | ( | const char * | fname | ) | [virtual] |
Specify the file name of the raw image data.
virtual char* vtkMetaImageWriter::GetRAWFileName | ( | ) | [virtual] |
Specify the file name of the raw image data.
virtual void vtkMetaImageWriter::SetCompression | ( | bool | compress | ) | [inline, virtual] |
Definition at line 94 of file vtkMetaImageWriter.h.
virtual bool vtkMetaImageWriter::GetCompression | ( | void | ) | [inline, virtual] |
Definition at line 98 of file vtkMetaImageWriter.h.
virtual void vtkMetaImageWriter::Write | ( | ) | [virtual] |
The main interface which triggers the writer to start.
Reimplemented from vtkImageWriter.
virtual void vtkMetaImageWriter::SetMHDFileName | ( | const char * | ) | [protected, virtual] |
char* vtkMetaImageWriter::MHDFileName [protected] |
Definition at line 111 of file vtkMetaImageWriter.h.
bool vtkMetaImageWriter::Compress [protected] |
Definition at line 113 of file vtkMetaImageWriter.h.