#include <itkImageIOBase.h>
Inheritance diagram for itk::ImageIOBase:
Public Types | |
typedef ImageIOBase | Self |
typedef LightProcessObject | Superclass |
typedef SmartPointer< Self > | Pointer |
enum | IODataType { UNKNOWN, UCHAR, CHAR, USHORT, SHORT, UINT, INT, ULONG, LONG, FLOAT, DOUBLE, RGB, RGBA, OFFSET, VECTOR, POINT, COVARIANTVECTOR } |
enum | FileType { ASCII, Binary, TypeNotApplicable } |
enum | ByteOrder { BigEndian, LittleEndian, OrderNotApplicable } |
Public Member Functions | |
virtual const char * | GetClassName () const |
virtual bool | SetPixelType (const std::type_info &ptype) |
std::string | ReturnTypeAsString (IODataType) const |
virtual unsigned int | GetPixelStride () const |
unsigned int | GetImageSizeInPixels () const |
unsigned int | GetImageSizeInBytes () const |
unsigned int | GetImageSizeInComponents () const |
virtual bool | CanReadFile (const char *)=0 |
virtual bool | CanStreamRead () |
virtual void | ReadImageInformation ()=0 |
virtual void | Read (void *buffer)=0 |
virtual bool | CanWriteFile (const char *)=0 |
virtual bool | CanStreamWrite () |
virtual void | WriteImageInformation ()=0 |
virtual void | Write (const void *buffer)=0 |
virtual bool | SupportsDimension (unsigned long dim) |
virtual void | SetFileName (const char *_arg) |
virtual const char * | GetFileName () const |
void | SetNumberOfDimensions (unsigned int) |
virtual unsigned int | GetNumberOfDimensions () |
virtual void | SetDimensions (unsigned int i, unsigned int dim) |
virtual unsigned int | GetDimensions (unsigned int i) const |
virtual void | SetOrigin (unsigned int i, double origin) |
virtual double | GetOrigin (unsigned int i) const |
virtual void | SetSpacing (unsigned int i, double spacing) |
virtual double | GetSpacing (unsigned int i) const |
virtual void | SetIORegion (ImageIORegion _arg) |
virtual ImageIORegion | GetIORegion () |
virtual const std::type_info & | GetPixelType () const |
virtual void | SetPixelType (const IODataType ctype) |
virtual void | SetComponentType (IODataType _arg) |
virtual IODataType | GetComponentType () |
virtual void | SetNumberOfComponents (unsigned int _arg) |
virtual unsigned int | GetNumberOfComponents () |
virtual void | SetFileType (FileType _arg) |
virtual FileType | GetFileType () const |
void | SetFileTypeToASCII () |
void | SetFileTypeToBinary () |
virtual void | SetByteOrder (ByteOrder _arg) |
virtual ByteOrder | GetByteOrder () const |
void | SetByteOrderToBigEndian () |
void | SetByteOrderToLittleEndian () |
Protected Member Functions | |
ImageIOBase () | |
~ImageIOBase () | |
void | PrintSelf (std::ostream &os, Indent indent) const |
virtual void | Reset (const bool freeDynamic=true) |
void | Resize (const unsigned int numDimensions, const unsigned int *dimensions) |
void | ComputeStrides () |
virtual unsigned int | GetPixelSize () const |
virtual unsigned int | GetComponentSize () const |
unsigned int | GetComponentStride () const |
unsigned int | GetRowStride () const |
unsigned int | GetSliceStride () const |
void | WriteBufferAsASCII (std::ostream &os, const void *buffer, IODataType ctype, unsigned int numComp) |
void | ReadBufferAsASCII (std::istream &os, void *buffer, IODataType ctype, unsigned int numComp) |
bool | ReadBufferAsBinary (std::istream &os, void *buffer, unsigned int numComp) |
const std::type_info & | ConvertToTypeInfo (IODataType) const |
unsigned int | GetSizeOfType (IODataType) const |
Protected Attributes | |
IODataType | m_PixelType |
IODataType | m_ComponentType |
ByteOrder | m_ByteOrder |
FileType | m_FileType |
bool | m_Initialized |
std::string | m_FileName |
unsigned int | m_NumberOfComponents |
unsigned int | m_NumberOfDimensions |
ImageIORegion | m_IORegion |
std::vector< unsigned int > | m_Dimensions |
std::vector< double > | m_Spacing |
std::vector< double > | m_Origin |
std::vector< unsigned int > | m_Strides |
ImageIOBase is a class that reads and/or writes image data of a particular format (such as PNG or raw binary). The ImageIOBase encapsulates both the reading and writing of data. The ImageIOBase is used by the ImageFileReader class (to read data) and the ImageFileWriter (to write data) into a single file. The ImageSeriesReader and ImageSeriesWriter classes are used to read and write data (in conjunction with ImageIOBase) when the data is represented by a series of files. Normally the user does not directly manipulate this class other than to instantiate it, set the FileName, and assign it to a ImageFileReader/ImageFileWriter or ImageSeriesReader/ImageSeriesWriter.
A Pluggable factory pattern is used this allows different kinds of readers to be registered (even at run time) without having to modify the code in this class.
Definition at line 55 of file itkImageIOBase.h.
|
Reimplemented from itk::LightProcessObject.
Reimplemented in itk::AnalyzeImageIO, itk::Brains2MaskImageIO, itk::DicomImageIO, itk::DICOMImageIO2, itk::GE4ImageIO, itk::GE5ImageIO, itk::GEAdwImageIO, itk::GiplImageIO, itk::IPLCommonImageIO, itk::MetaImageIO, itk::PNGImageIO, itk::RawImageIO< TPixel, VImageDimension >, itk::SiemensVisionImageIO, itk::StimulateImageIO, and itk::VTKImageIO. Definition at line 61 of file itkImageIOBase.h. Referenced by itk::ImageSeriesReader< TOutputImage >::ImageSeriesReader(), itk::ImageSeriesWriter< TInputImage >::Update(), and itk::ImageFileWriter< TInputImage >::Update(). |
|
Standard class typedefs. Reimplemented from itk::LightProcessObject.
Reimplemented in itk::AnalyzeImageIO, itk::Brains2MaskImageIO, itk::DicomImageIO, itk::DICOMImageIO2, itk::GE4ImageIO, itk::GE5ImageIO, itk::GEAdwImageIO, itk::GiplImageIO, itk::IPLCommonImageIO, itk::MetaImageIO, itk::PNGImageIO, itk::RawImageIO< TPixel, VImageDimension >, itk::SiemensVisionImageIO, itk::StimulateImageIO, and itk::VTKImageIO. Definition at line 59 of file itkImageIOBase.h. |
|
Reimplemented from itk::LightProcessObject.
Reimplemented in itk::AnalyzeImageIO, itk::Brains2MaskImageIO, itk::DicomImageIO, itk::DICOMImageIO2, itk::GE4ImageIO, itk::GE5ImageIO, itk::GEAdwImageIO, itk::GiplImageIO, itk::IPLCommonImageIO, itk::MetaImageIO, itk::PNGImageIO, itk::RawImageIO< TPixel, VImageDimension >, itk::SiemensVisionImageIO, itk::StimulateImageIO, and itk::VTKImageIO. Definition at line 60 of file itkImageIOBase.h. |
|
Enums used to specify byte order; whether Big Endian or Little Endian. Some subclasses use this, some ignore it. Definition at line 155 of file itkImageIOBase.h. |
|
Enums used to specify write style: whether binary or ASCII. Some subclasses use this, some ignore it. Definition at line 151 of file itkImageIOBase.h. |
|
Enums used to manipulate the pixel and component type. (Typically a pixel is assumed to be made up of one or more components.)
|
|
|
|
|
|
Determine the file type. Returns true if this ImageIO can read the file specified. Implemented in itk::AnalyzeImageIO, itk::Brains2MaskImageIO, itk::DicomImageIO, itk::DICOMImageIO2, itk::GE4ImageIO, itk::GE5ImageIO, itk::GEAdwImageIO, itk::GiplImageIO, itk::IPLCommonImageIO, itk::MetaImageIO, itk::PNGImageIO, itk::RawImageIO< TPixel, VImageDimension >, itk::SiemensVisionImageIO, itk::StimulateImageIO, and itk::VTKImageIO.
|
|
Determine if the ImageIO can stream reading from this file. Default is false. Definition at line 208 of file itkImageIOBase.h. |
|
Determine if the ImageIO can stream writing to this file. Default is false. Definition at line 226 of file itkImageIOBase.h. |
|
Determine the file type. Returns true if this ImageIO can read the file specified. Implemented in itk::AnalyzeImageIO, itk::Brains2MaskImageIO, itk::DicomImageIO, itk::DICOMImageIO2, itk::GiplImageIO, itk::IPLCommonImageIO, itk::MetaImageIO, itk::PNGImageIO, itk::RawImageIO< TPixel, VImageDimension >, itk::StimulateImageIO, and itk::VTKImageIO.
|
|
Calculates the different strides (distance from one thing to the next). Upon return, strides[0] = bytes to get to the next component of a pixel, strides[1] = bytes to get to the next pixel in x direction, strides[2] = bytes to get to the next row in y direction, strides[3] = bytes to get to the next slice in z direction, etc. |
|
Utility methods for working with IODataType. |
|
These methods indicate the byte ordering of the file you are trying to read in. These methods will then either swap or not swap the bytes depending on the byte ordering of the machine it is being run on. For example, reading in a BigEndian file on a BigEndian machine will result in no swapping. Trying to read the same file on a LittleEndian machine will result in swapping. Note: most UNIX machines are BigEndian while PC's and VAX's are LittleEndian. So if the file you are reading in was generated on a VAX or PC, SetByteOrderToLittleEndian() otherwise SetByteOrderToBigEndian(). Some ImageIOBase subclasses ignore these methods. |
|
Run-time type information (and related methods). Reimplemented from itk::LightProcessObject.
Reimplemented in itk::AnalyzeImageIO, itk::Brains2MaskImageIO, itk::DicomImageIO, itk::DICOMImageIO2, itk::GE4ImageIO, itk::GE5ImageIO, itk::GEAdwImageIO, itk::GiplImageIO, itk::IPLCommonImageIO, itk::MetaImageIO, itk::PNGImageIO, itk::RawImageIO< TPixel, VImageDimension >, itk::SiemensVisionImageIO, itk::StimulateImageIO, and itk::VTKImageIO.
|
|
Compute the size (in bytes) of the components of a pixel. For example, and RGB pixel of unsigned char would have a component size of 1 byte. This method can be invoked only after the component type is set. Reimplemented in itk::AnalyzeImageIO, itk::Brains2MaskImageIO, itk::DicomImageIO, itk::GiplImageIO, itk::IPLCommonImageIO, itk::PNGImageIO, and itk::RawImageIO< TPixel, VImageDimension >.
|
|
Convenient method for accessing number of bytes to get to the next pixel component. Returns m_Strides[0]. |
|
Set/Get the component type of the image. The readering and writing process typically only supports the native types, with special case support like RGBPixel. |
|
Set/Get the image dimensions in the x, y, z, etc. directions. GetDimensions() is typically used after reading the data; the SetDimensions() is used prior to writing the data. Definition at line 91 of file itkImageIOBase.h. |
|
Set/Get the name of the file to be read. |
|
These methods control whether the file is written binary or ASCII. Many file formats (i.e., subclasses) ignore this flag. |
|
Return the number of bytes in the image. |
|
Return the number of pixels times the number of components in the image. |
|
Return the number of pixels in the image. |
|
Specify the region of the image data to either read or write. The IORegion specifies the part of the image to read or write. Regions are defined with an index and a size vector. These vectors define the start (lower-left corner) and length of the region within the image. Make sure that the IORegion lies within the image. |
|
Set/Get the number of components per pixel in the image. This may be set by the reading process. |
|
Set/Get the number of independent variables (dimensions) in the image being read or written. Note this is not necessarily what is written, rather the IORegion controls that. |
|
Set/Get the image origin on a axis-by-axis basis. The SetOrigin() method is required when writing the image. Definition at line 98 of file itkImageIOBase.h. |
|
Compute the size (in bytes) of the pixel. For example, and RGB pixel of unsigned char would have size 3 bytes. |
|
Convenient method for accessing the number of bytes to get to the next pixel. Returns m_Strides[1]; |
|
Set/Get the type of the pixel. The pixel type and component type may be different. By default, they are assumed to be the same. The pixel type may be determined by the reader (from the file) or from the writer (the writer's input type). Reimplemented in itk::AnalyzeImageIO, itk::Brains2MaskImageIO, itk::DicomImageIO, itk::GiplImageIO, itk::IPLCommonImageIO, itk::PNGImageIO, and itk::RawImageIO< TPixel, VImageDimension >.
|
|
Convenient method for accessing the number of bytes to get to the next row. Returns m_Strides[2]. |
|
Utility methods for working with IODataType. |
|
Convenient method for accessing the number of bytes to get to the next slice. Returns m_Strides[3]. |
|
Set/Get the image spacing on an axis-by-axis basis. The SetSpacing() method is required when writing the image. Definition at line 105 of file itkImageIOBase.h. |
|
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 itk::LightProcessObject.
Reimplemented in itk::AnalyzeImageIO, itk::Brains2MaskImageIO, itk::DicomImageIO, itk::DICOMImageIO2, itk::GiplImageIO, itk::IPLCommonImageIO, itk::MetaImageIO, itk::PNGImageIO, itk::RawImageIO< TPixel, VImageDimension >, itk::StimulateImageIO, and itk::VTKImageIO.
|
|
Reads the data from disk into the memory buffer provided. Implemented in itk::AnalyzeImageIO, itk::Brains2MaskImageIO, itk::DicomImageIO, itk::DICOMImageIO2, itk::GiplImageIO, itk::IPLCommonImageIO, itk::MetaImageIO, itk::PNGImageIO, itk::RawImageIO< TPixel, VImageDimension >, itk::StimulateImageIO, and itk::VTKImageIO.
|
|
Convenient method to read a buffer as ASCII text. |
|
Convenient method to read a buffer as binary. Return true on success. |
|
Read the spacing and dimentions of the image. Assumes SetFileName has been called with a valid file name. Implemented in itk::AnalyzeImageIO, itk::Brains2MaskImageIO, itk::DicomImageIO, itk::DICOMImageIO2, itk::GiplImageIO, itk::IPLCommonImageIO, itk::MetaImageIO, itk::PNGImageIO, itk::RawImageIO< TPixel, VImageDimension >, itk::StimulateImageIO, and itk::VTKImageIO.
|
|
Return the object to an initialized state, ready to be used |
|
Resize the ImageIOBase object to new dimensions. |
|
Convenience method returns the IODataType as a string. This can be used for writing output files. |
|
These methods indicate the byte ordering of the file you are trying to read in. These methods will then either swap or not swap the bytes depending on the byte ordering of the machine it is being run on. For example, reading in a BigEndian file on a BigEndian machine will result in no swapping. Trying to read the same file on a LittleEndian machine will result in swapping. Note: most UNIX machines are BigEndian while PC's and VAX's are LittleEndian. So if the file you are reading in was generated on a VAX or PC, SetByteOrderToLittleEndian() otherwise SetByteOrderToBigEndian(). Some ImageIOBase subclasses ignore these methods. |
|
These methods indicate the byte ordering of the file you are trying to read in. These methods will then either swap or not swap the bytes depending on the byte ordering of the machine it is being run on. For example, reading in a BigEndian file on a BigEndian machine will result in no swapping. Trying to read the same file on a LittleEndian machine will result in swapping. Note: most UNIX machines are BigEndian while PC's and VAX's are LittleEndian. So if the file you are reading in was generated on a VAX or PC, SetByteOrderToLittleEndian() otherwise SetByteOrderToBigEndian(). Some ImageIOBase subclasses ignore these methods. Definition at line 180 of file itkImageIOBase.h. |
|
These methods indicate the byte ordering of the file you are trying to read in. These methods will then either swap or not swap the bytes depending on the byte ordering of the machine it is being run on. For example, reading in a BigEndian file on a BigEndian machine will result in no swapping. Trying to read the same file on a LittleEndian machine will result in swapping. Note: most UNIX machines are BigEndian while PC's and VAX's are LittleEndian. So if the file you are reading in was generated on a VAX or PC, SetByteOrderToLittleEndian() otherwise SetByteOrderToBigEndian(). Some ImageIOBase subclasses ignore these methods. Definition at line 182 of file itkImageIOBase.h. |
|
Set/Get the component type of the image. The readering and writing process typically only supports the native types, with special case support like RGBPixel. |
|
Set/Get the image dimensions in the x, y, z, etc. directions. GetDimensions() is typically used after reading the data; the SetDimensions() is used prior to writing the data. |
|
Set/Get the name of the file to be read. |
|
These methods control whether the file is written binary or ASCII. Many file formats (i.e., subclasses) ignore this flag. |
|
These methods control whether the file is written binary or ASCII. Many file formats (i.e., subclasses) ignore this flag. Definition at line 161 of file itkImageIOBase.h. |
|
These methods control whether the file is written binary or ASCII. Many file formats (i.e., subclasses) ignore this flag. Definition at line 163 of file itkImageIOBase.h. |
|
Specify the region of the image data to either read or write. The IORegion specifies the part of the image to read or write. Regions are defined with an index and a size vector. These vectors define the start (lower-left corner) and length of the region within the image. Make sure that the IORegion lies within the image. |
|
Set/Get the number of components per pixel in the image. This may be set by the reading process. |
|
Set/Get the number of independent variables (dimensions) in the image being read or written. Note this is not necessarily what is written, rather the IORegion controls that. |
|
Set/Get the image origin on a axis-by-axis basis. The SetOrigin() method is required when writing the image. |
|
This special, convenience version of SetPixelType() also sets the number of components and the component type. The function returns false if the pixel type is unsupported. Reimplemented in itk::RawImageIO< TPixel, VImageDimension >.
|
|
Set/Get the type of the pixel. The pixel type and component type may be different. By default, they are assumed to be the same. The pixel type may be determined by the reader (from the file) or from the writer (the writer's input type). Reimplemented in itk::RawImageIO< TPixel, VImageDimension >.
|
|
Set/Get the image spacing on an axis-by-axis basis. The SetSpacing() method is required when writing the image. |
|
The different types of ImageIO's can support data of varying dimensionality. For example, some file formats are strictly 2D while others can support 2D, 3D, or even n-D. This method returns true/false as to whether the ImageIO can support the dimension indicated. Reimplemented in itk::MetaImageIO, and itk::RawImageIO< TPixel, VImageDimension >. Definition at line 244 of file itkImageIOBase.h. |
|
Writes the data to disk from the memory buffer provided. Make sure that the IORegions has been set properly. The buffer is cast to a pointer to the beginning of the image data. Implemented in itk::AnalyzeImageIO, itk::Brains2MaskImageIO, itk::DicomImageIO, itk::DICOMImageIO2, itk::GiplImageIO, itk::IPLCommonImageIO, itk::MetaImageIO, itk::PNGImageIO, itk::RawImageIO< TPixel, VImageDimension >, itk::StimulateImageIO, and itk::VTKImageIO.
|
|
Convenient method to write a buffer as ASCII text. |
|
Writes the spacing and dimentions of the image. Assumes SetFileName has been called with a valid file name. Implemented in itk::AnalyzeImageIO, itk::Brains2MaskImageIO, itk::DicomImageIO, itk::DICOMImageIO2, itk::GiplImageIO, itk::IPLCommonImageIO, itk::MetaImageIO, itk::PNGImageIO, itk::RawImageIO< TPixel, VImageDimension >, itk::StimulateImageIO, and itk::VTKImageIO.
|
|
Big or Little Endian, and the type of the file. (May be ignored.) Definition at line 265 of file itkImageIOBase.h. |
|
Used internally to keep track of the type of the component. It is set when ComputeStrides() is invoked. Definition at line 262 of file itkImageIOBase.h. |
|
The array which stores the number of pixels in the x, y, z directions. Definition at line 286 of file itkImageIOBase.h. |
|
Filename to read Definition at line 272 of file itkImageIOBase.h. |
|
Definition at line 266 of file itkImageIOBase.h. |
|
Does the ImageIOBase object have enough info to be of use? Definition at line 269 of file itkImageIOBase.h. |
|
The region to read or write. The region contains information about the data within the region to read or write. Definition at line 283 of file itkImageIOBase.h. |
|
Stores the number of components per pixel. This will be 1 for grayscale images, 3 for RGBPixel images, and 4 for RGBPixelA images. Definition at line 276 of file itkImageIOBase.h. |
|
The number of independent dimensions in the image. Definition at line 279 of file itkImageIOBase.h. |
|
The array which stores the origin of the image. Definition at line 293 of file itkImageIOBase.h. |
|
Used internally to keep track of the type of the pixel. Definition at line 258 of file itkImageIOBase.h. |
|
The array which stores the spacing of pixels in the x, y, z directions. Definition at line 290 of file itkImageIOBase.h. |
|
Stores the number of bytes it takes to get to the next 'thing' e.g. component, pixel, row, slice, etc. Definition at line 297 of file itkImageIOBase.h. |