ITK  4.0.0
Insight Segmentation and Registration Toolkit
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
itk::ImageFileWriter< TInputImage > Class Template Reference

Writes image data to a single file. More...

#include <itkImageFileWriter.h>

Inheritance diagram for itk::ImageFileWriter< TInputImage >:
Collaboration diagram for itk::ImageFileWriter< TInputImage >:

List of all members.

Public Types

typedef SmartPointer< const SelfConstPointer
typedef InputImageType::PixelType InputImagePixelType
typedef InputImageType::Pointer InputImagePointer
typedef InputImageType::RegionType InputImageRegionType
typedef TInputImage InputImageType
typedef SmartPointer< SelfPointer
typedef ImageFileWriter Self
typedef ProcessObject Superclass

Public Member Functions

virtual ::itk::LightObject::Pointer CreateAnother (void) const
virtual ImageIOBaseGetImageIO ()
const InputImageTypeGetInput (void)
const InputImageTypeGetInput (unsigned int idx)
const ImageIORegionGetIORegion (void) const
virtual const char * GetNameOfClass () const
void SetInput (const InputImageType *input)
void SetIORegion (const ImageIORegion &region)
virtual void Update ()
virtual void UpdateLargestPossibleRegion ()
virtual void Write (void)
virtual void SetFileName (const char *_arg)
virtual const char * GetFileName () const
void SetImageIO (ImageIOBase *io)
virtual void SetNumberOfStreamDivisions (unsigned int _arg)
virtual const unsigned int & GetNumberOfStreamDivisions ()
virtual void SetUseCompression (bool _arg)
virtual const bool & GetUseCompression ()
virtual void UseCompressionOn ()
virtual void UseCompressionOff ()

Static Public Member Functions

static Pointer New ()

Protected Member Functions

void GenerateData (void)

Private Member Functions

 ImageFileWriter (const Self &)
void operator= (const Self &)

Private Attributes

bool m_FactorySpecifiedImageIO
std::string m_FileName
ImageIOBase::Pointer m_ImageIO
unsigned int m_NumberOfStreamDivisions
ImageIORegion m_PasteIORegion
bool m_UseCompression
bool m_UseInputMetaDataDictionary
bool m_UserSpecifiedImageIO
bool m_UserSpecifiedIORegion
virtual void SetUseInputMetaDataDictionary (bool _arg)
virtual const bool & GetUseInputMetaDataDictionary ()
virtual void UseInputMetaDataDictionaryOn ()
virtual void UseInputMetaDataDictionaryOff ()
 ImageFileWriter ()
 ~ImageFileWriter ()
void PrintSelf (std::ostream &os, Indent indent) const

Detailed Description

template<class TInputImage>
class itk::ImageFileWriter< TInputImage >

Writes image data to a single file.

ImageFileWriter writes its input data to a single output file. ImageFileWriter interfaces with an ImageIO class to write out the data. If you wish to write data into a series of files (e.g., a slice per file) use ImageSeriesWriter.

A pluggable factory pattern is used that allows different kinds of writers to be registered (even at run time) without having to modify the code in this class. You can either manually instantiate the ImageIO object and associate it with the ImageFileWriter, or let the class figure it out from the extension. Normally just setting the filename with a suitable suffix (".png", ".jpg", etc) and setting the input to the writer is enough to get the writer to work properly.

See also:
ImageSeriesReader
ImageIOBase
Wiki Examples:
Examples:

Examples/Filtering/DiffusionTensor3DReconstructionImageFilter.cxx, ImageLinearIteratorWithIndex.cxx, ImageRegionIterator.cxx, ImageRegionIteratorWithIndex.cxx, and itkVectorImageTest.cxx.

Definition at line 81 of file itkImageFileWriter.h.


Member Typedef Documentation

template<class TInputImage >
typedef SmartPointer< const Self > itk::ImageFileWriter< TInputImage >::ConstPointer

Reimplemented from itk::ProcessObject.

Definition at line 88 of file itkImageFileWriter.h.

template<class TInputImage >
typedef InputImageType::PixelType itk::ImageFileWriter< TInputImage >::InputImagePixelType

Definition at line 100 of file itkImageFileWriter.h.

template<class TInputImage >
typedef InputImageType::Pointer itk::ImageFileWriter< TInputImage >::InputImagePointer

Definition at line 98 of file itkImageFileWriter.h.

template<class TInputImage >
typedef InputImageType::RegionType itk::ImageFileWriter< TInputImage >::InputImageRegionType

Definition at line 99 of file itkImageFileWriter.h.

template<class TInputImage >
typedef TInputImage itk::ImageFileWriter< TInputImage >::InputImageType

Some convenient typedefs.

Definition at line 94 of file itkImageFileWriter.h.

template<class TInputImage >
typedef SmartPointer< Self > itk::ImageFileWriter< TInputImage >::Pointer

Reimplemented from itk::ProcessObject.

Definition at line 87 of file itkImageFileWriter.h.

template<class TInputImage >
typedef ImageFileWriter itk::ImageFileWriter< TInputImage >::Self

Standard class typedefs.

Reimplemented from itk::ProcessObject.

Definition at line 85 of file itkImageFileWriter.h.

template<class TInputImage >
typedef ProcessObject itk::ImageFileWriter< TInputImage >::Superclass

Reimplemented from itk::ProcessObject.

Definition at line 86 of file itkImageFileWriter.h.


Constructor & Destructor Documentation

template<class TInputImage >
itk::ImageFileWriter< TInputImage >::ImageFileWriter ( ) [protected]

By default the MetaDataDictionary is taken from the input image and passed to the ImageIO. In some cases, however, a user may prefer to introduce her/his own MetaDataDictionary. This is often the case of the ImageSeriesWriter. This flag defined whether the MetaDataDictionary to use will be the one from the input image or the one already set in the ImageIO object.

template<class TInputImage >
itk::ImageFileWriter< TInputImage >::~ImageFileWriter ( ) [protected]

By default the MetaDataDictionary is taken from the input image and passed to the ImageIO. In some cases, however, a user may prefer to introduce her/his own MetaDataDictionary. This is often the case of the ImageSeriesWriter. This flag defined whether the MetaDataDictionary to use will be the one from the input image or the one already set in the ImageIO object.

template<class TInputImage >
itk::ImageFileWriter< TInputImage >::ImageFileWriter ( const Self ) [private]

Member Function Documentation

template<class TInputImage >
virtual::itk::LightObject::Pointer itk::ImageFileWriter< TInputImage >::CreateAnother ( void  ) const [virtual]

Create an object from an instance, potentially deferring to a factory. This method allows you to create an instance of an object that is exactly the same type as the referring object. This is useful in cases where an object has been cast back to a base class.

Reimplemented from itk::Object.

template<class TInputImage >
void itk::ImageFileWriter< TInputImage >::GenerateData ( void  ) [protected, virtual]

Does the real work.

Reimplemented from itk::ProcessObject.

template<class TInputImage >
virtual const char* itk::ImageFileWriter< TInputImage >::GetFileName ( ) const [virtual]

Specify the name of the output file to write.

template<class TInputImage >
virtual ImageIOBase* itk::ImageFileWriter< TInputImage >::GetImageIO ( ) [virtual]
template<class TInputImage >
const InputImageType* itk::ImageFileWriter< TInputImage >::GetInput ( void  )
template<class TInputImage >
const InputImageType* itk::ImageFileWriter< TInputImage >::GetInput ( unsigned int  idx)
template<class TInputImage >
const ImageIORegion& itk::ImageFileWriter< TInputImage >::GetIORegion ( void  ) const [inline]

Definition at line 151 of file itkImageFileWriter.h.

template<class TInputImage >
virtual const char* itk::ImageFileWriter< TInputImage >::GetNameOfClass ( ) const [virtual]

Run-time type information (and related methods).

Reimplemented from itk::ProcessObject.

template<class TInputImage >
virtual const unsigned int& itk::ImageFileWriter< TInputImage >::GetNumberOfStreamDivisions ( ) [virtual]

Set/Get the number of pieces to divide the input. The upstream pipeline will try to be executed this many times.

template<class TInputImage >
virtual const bool& itk::ImageFileWriter< TInputImage >::GetUseCompression ( ) [virtual]

Set the compression On or Off

template<class TInputImage >
virtual const bool& itk::ImageFileWriter< TInputImage >::GetUseInputMetaDataDictionary ( ) [virtual]

By default the MetaDataDictionary is taken from the input image and passed to the ImageIO. In some cases, however, a user may prefer to introduce her/his own MetaDataDictionary. This is often the case of the ImageSeriesWriter. This flag defined whether the MetaDataDictionary to use will be the one from the input image or the one already set in the ImageIO object.

template<class TInputImage >
static Pointer itk::ImageFileWriter< TInputImage >::New ( ) [static]

Method for creation through the object factory.

Reimplemented from itk::Object.

template<class TInputImage >
void itk::ImageFileWriter< TInputImage >::operator= ( const Self ) [private]

Time when GenerateOutputInformation was last called.

Reimplemented from itk::ProcessObject.

template<class TInputImage >
void itk::ImageFileWriter< TInputImage >::PrintSelf ( std::ostream &  os,
Indent  indent 
) const [protected, virtual]

By default the MetaDataDictionary is taken from the input image and passed to the ImageIO. In some cases, however, a user may prefer to introduce her/his own MetaDataDictionary. This is often the case of the ImageSeriesWriter. This flag defined whether the MetaDataDictionary to use will be the one from the input image or the one already set in the ImageIO object.

Reimplemented from itk::ProcessObject.

template<class TInputImage >
virtual void itk::ImageFileWriter< TInputImage >::SetFileName ( const char *  _arg) [virtual]

Specify the name of the output file to write.

template<class TInputImage >
void itk::ImageFileWriter< TInputImage >::SetImageIO ( ImageIOBase io) [inline]

Set/Get the ImageIO helper class. Usually this is created via the object factory mechanism that determines whether a particular ImageIO can write a certain file. This method provides a way to get the ImageIO instance that is created, or one can be manually set where the IO factory mechanism may not work (for example, raw image files or image files with non-standard filename suffix's. If the user specifies the ImageIO, we assume she makes the correct choice and will allow a file to be created regardless of the file extension. If the factory has set the ImageIO, the extension must be supported by the specified ImageIO.

Definition at line 125 of file itkImageFileWriter.h.

template<class TInputImage >
void itk::ImageFileWriter< TInputImage >::SetInput ( const InputImageType input)
template<class TInputImage >
void itk::ImageFileWriter< TInputImage >::SetIORegion ( const ImageIORegion region)

Specify the region to write. If left NULL, then the whole image is written.

template<class TInputImage >
virtual void itk::ImageFileWriter< TInputImage >::SetNumberOfStreamDivisions ( unsigned int  _arg) [virtual]

Set/Get the number of pieces to divide the input. The upstream pipeline will try to be executed this many times.

template<class TInputImage >
virtual void itk::ImageFileWriter< TInputImage >::SetUseCompression ( bool  _arg) [virtual]

Set the compression On or Off

template<class TInputImage >
virtual void itk::ImageFileWriter< TInputImage >::SetUseInputMetaDataDictionary ( bool  _arg) [virtual]

By default the MetaDataDictionary is taken from the input image and passed to the ImageIO. In some cases, however, a user may prefer to introduce her/his own MetaDataDictionary. This is often the case of the ImageSeriesWriter. This flag defined whether the MetaDataDictionary to use will be the one from the input image or the one already set in the ImageIO object.

template<class TInputImage >
virtual void itk::ImageFileWriter< TInputImage >::Update ( void  ) [inline, virtual]

Aliased to the Write() method to be consistent with the rest of the pipeline.

Reimplemented from itk::ProcessObject.

Definition at line 164 of file itkImageFileWriter.h.

template<class TInputImage >
virtual void itk::ImageFileWriter< TInputImage >::UpdateLargestPossibleRegion ( ) [inline, virtual]

Writes the entire image to file.

Updates the pipeline, streaming it the NumberOfStreamDivisions times. Existing PasteIORegion is reset.

Reimplemented from itk::ProcessObject.

Definition at line 174 of file itkImageFileWriter.h.

template<class TInputImage >
virtual void itk::ImageFileWriter< TInputImage >::UseCompressionOff ( ) [virtual]

Set the compression On or Off

template<class TInputImage >
virtual void itk::ImageFileWriter< TInputImage >::UseCompressionOn ( ) [virtual]

Set the compression On or Off

template<class TInputImage >
virtual void itk::ImageFileWriter< TInputImage >::UseInputMetaDataDictionaryOff ( ) [virtual]

By default the MetaDataDictionary is taken from the input image and passed to the ImageIO. In some cases, however, a user may prefer to introduce her/his own MetaDataDictionary. This is often the case of the ImageSeriesWriter. This flag defined whether the MetaDataDictionary to use will be the one from the input image or the one already set in the ImageIO object.

template<class TInputImage >
virtual void itk::ImageFileWriter< TInputImage >::UseInputMetaDataDictionaryOn ( ) [virtual]

By default the MetaDataDictionary is taken from the input image and passed to the ImageIO. In some cases, however, a user may prefer to introduce her/his own MetaDataDictionary. This is often the case of the ImageSeriesWriter. This flag defined whether the MetaDataDictionary to use will be the one from the input image or the one already set in the ImageIO object.

template<class TInputImage >
virtual void itk::ImageFileWriter< TInputImage >::Write ( void  ) [virtual]

A special version of the Update() method for writers. It invokes start and end events and handles releasing data. It eventually calls GenerateData() which does the actual writing. Note: the write method will write data specified by the IORegion. If not set, then then the whole image is written. Note that the region will be cropped to fit the input image's LargestPossibleRegion.


Member Data Documentation

template<class TInputImage >
bool itk::ImageFileWriter< TInputImage >::m_FactorySpecifiedImageIO [private]

Definition at line 219 of file itkImageFileWriter.h.

template<class TInputImage >
std::string itk::ImageFileWriter< TInputImage >::m_FileName [private]

Definition at line 209 of file itkImageFileWriter.h.

template<class TInputImage >
ImageIOBase::Pointer itk::ImageFileWriter< TInputImage >::m_ImageIO [private]

Definition at line 211 of file itkImageFileWriter.h.

template<class TInputImage >
unsigned int itk::ImageFileWriter< TInputImage >::m_NumberOfStreamDivisions [private]

Definition at line 216 of file itkImageFileWriter.h.

template<class TInputImage >
ImageIORegion itk::ImageFileWriter< TInputImage >::m_PasteIORegion [private]

Definition at line 215 of file itkImageFileWriter.h.

template<class TInputImage >
bool itk::ImageFileWriter< TInputImage >::m_UseCompression [private]

Definition at line 221 of file itkImageFileWriter.h.

template<class TInputImage >
bool itk::ImageFileWriter< TInputImage >::m_UseInputMetaDataDictionary [private]

Definition at line 222 of file itkImageFileWriter.h.

template<class TInputImage >
bool itk::ImageFileWriter< TInputImage >::m_UserSpecifiedImageIO [private]

Definition at line 212 of file itkImageFileWriter.h.

template<class TInputImage >
bool itk::ImageFileWriter< TInputImage >::m_UserSpecifiedIORegion [private]

Definition at line 217 of file itkImageFileWriter.h.


The documentation for this class was generated from the following file: