Tomato
itk::ImageFileReaderKW< TOutputImage, ConvertPixelTraits > Class Template Reference

Data source that reads image data from a single file. More...

#include <itkImageFileReaderKW.h>

Inheritance diagram for itk::ImageFileReaderKW< TOutputImage, ConvertPixelTraits >:
Collaboration diagram for itk::ImageFileReaderKW< TOutputImage, ConvertPixelTraits >:

Public Types

typedef ImageFileReaderKW Self
 
typedef ImageSource< TOutputImage > Superclass
 
typedef SmartPointer< SelfPointer
 
typedef TOutputImage::SizeType SizeType
 
typedef TOutputImage::IndexType IndexType
 
typedef TOutputImage::RegionType ImageRegionType
 
typedef TOutputImage::InternalPixelType OutputImagePixelType
 

Public Member Functions

 itkNewMacro (Self)
 
 itkTypeMacro (ImageFileReaderKW, ImageSource)
 
 itkSetGetDecoratedInputMacro (FileName, std::string)
 
void SetImageIO (ImageIOBase *imageIO)
 
 itkGetModifiableObjectMacro (ImageIO, ImageIOBase)
 
 itkSetMacro (UseStreaming, bool)
 
 itkGetConstReferenceMacro (UseStreaming, bool)
 
 itkBooleanMacro (UseStreaming)
 

Protected Member Functions

void PrintSelf (std::ostream &os, Indent indent) const ITK_OVERRIDE
 
void DoConvertBuffer (void *buffer, size_t numberOfPixels)
 
void TestFileExistanceAndReadability ()
 
virtual void GenerateOutputInformation (void) ITK_OVERRIDE
 
virtual void EnlargeOutputRequestedRegion (DataObject *output) ITK_OVERRIDE
 
virtual void GenerateData () ITK_OVERRIDE
 

Protected Attributes

ImageIOBase::Pointer m_ImageIO
 
bool m_UserSpecifiedImageIO
 
bool m_UseStreaming
 

Detailed Description

template<typename TOutputImage, typename ConvertPixelTraits = DefaultConvertPixelTraits< typename TOutputImage::IOPixelType >>
class itk::ImageFileReaderKW< TOutputImage, ConvertPixelTraits >

Data source that reads image data from a single file.

This source object is a general filter to read data from a variety of file formats. It works with a ImageIOBase subclass to actually do the reading of the data. Object factory machinery can be used to automatically create the ImageIOBase, or the ImageIOBase can be manually created and set. Note that this class reads data from a single file; if you wish to read data from a series of files use ImageSeriesReader.

TOutputImage is the type expected by the external users of the filter. If data stored in the file is stored in a different format then specified by TOutputImage, than this filter converts data between the file type and the external expected type. The ConvertTraits template argument is used to do the conversion.

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. Normally just setting the FileName with the appropriate suffix is enough to get the reader to instantiate the correct ImageIO and read the file properly. However, some files (like raw binary format) have no accepted suffix, so you will have to manually create the ImageIO instance of the write type.

See also
ImageSeriesReader
ImageIOBase

{IO/ReadVectorImage,Read an image file with an unknown number of components} {IO/ReadUnknownImageType,Read an image file without knowing its type before hand} {IO/ImageFileReaderKW,Read an image}

Member Typedef Documentation

template<typename TOutputImage , typename ConvertPixelTraits = DefaultConvertPixelTraits< typename TOutputImage::IOPixelType >>
typedef TOutputImage::RegionType itk::ImageFileReaderKW< TOutputImage, ConvertPixelTraits >::ImageRegionType

The region of the output image.

template<typename TOutputImage , typename ConvertPixelTraits = DefaultConvertPixelTraits< typename TOutputImage::IOPixelType >>
typedef TOutputImage::IndexType itk::ImageFileReaderKW< TOutputImage, ConvertPixelTraits >::IndexType

The size of the output image.

template<typename TOutputImage , typename ConvertPixelTraits = DefaultConvertPixelTraits< typename TOutputImage::IOPixelType >>
typedef TOutputImage::InternalPixelType itk::ImageFileReaderKW< TOutputImage, ConvertPixelTraits >::OutputImagePixelType

The pixel type of the output image.

template<typename TOutputImage , typename ConvertPixelTraits = DefaultConvertPixelTraits< typename TOutputImage::IOPixelType >>
typedef ImageFileReaderKW itk::ImageFileReaderKW< TOutputImage, ConvertPixelTraits >::Self

Standard class typedefs.

template<typename TOutputImage , typename ConvertPixelTraits = DefaultConvertPixelTraits< typename TOutputImage::IOPixelType >>
typedef TOutputImage::SizeType itk::ImageFileReaderKW< TOutputImage, ConvertPixelTraits >::SizeType

The size of the output image.

Member Function Documentation

template<typename TOutputImage , typename ConvertPixelTraits >
void itk::ImageFileReaderKW< TOutputImage, ConvertPixelTraits >::DoConvertBuffer ( void *  buffer,
size_t  numberOfPixels 
)
protected

Convert a block of pixels from one type to another.

template<typename TOutputImage , typename ConvertPixelTraits >
void itk::ImageFileReaderKW< TOutputImage, ConvertPixelTraits >::EnlargeOutputRequestedRegion ( DataObject *  output)
protectedvirtual

Give the reader a chance to indicate that it will produce more output than it was requested to produce. ImageFileReaderKW cannot currently read a portion of an image (since the ImageIO objects cannot read a portion of an image), so the ImageFileReaderKW must enlarge the RequestedRegion to the size of the image on disk.

template<typename TOutputImage , typename ConvertPixelTraits >
void itk::ImageFileReaderKW< TOutputImage, ConvertPixelTraits >::GenerateData ( )
protectedvirtual

Does the real work.

template<typename TOutputImage , typename ConvertPixelTraits >
void itk::ImageFileReaderKW< TOutputImage, ConvertPixelTraits >::GenerateOutputInformation ( void  )
protectedvirtual

Prepare the allocation of the output image during the first back propagation of the pipeline.

template<typename TOutputImage , typename ConvertPixelTraits = DefaultConvertPixelTraits< typename TOutputImage::IOPixelType >>
itk::ImageFileReaderKW< TOutputImage, ConvertPixelTraits >::itkNewMacro ( Self  )

Method for creation through the object factory.

template<typename TOutputImage , typename ConvertPixelTraits = DefaultConvertPixelTraits< typename TOutputImage::IOPixelType >>
itk::ImageFileReaderKW< TOutputImage, ConvertPixelTraits >::itkSetGetDecoratedInputMacro ( FileName  ,
std::string   
)

Specify the file to read. This is forwarded to the IO instance.

template<typename TOutputImage , typename ConvertPixelTraits = DefaultConvertPixelTraits< typename TOutputImage::IOPixelType >>
itk::ImageFileReaderKW< TOutputImage, ConvertPixelTraits >::itkSetMacro ( UseStreaming  ,
bool   
)

Set the stream On or Off

template<typename TOutputImage , typename ConvertPixelTraits = DefaultConvertPixelTraits< typename TOutputImage::IOPixelType >>
itk::ImageFileReaderKW< TOutputImage, ConvertPixelTraits >::itkTypeMacro ( ImageFileReaderKW< TOutputImage, ConvertPixelTraits >  ,
ImageSource   
)

Run-time type information (and related methods).

template<typename TOutputImage , typename ConvertPixelTraits >
void itk::ImageFileReaderKW< TOutputImage, ConvertPixelTraits >::SetImageIO ( ImageIOBase *  imageIO)

Set/Get the ImageIO helper class. Often this is created via the object factory mechanism that determines whether a particular ImageIO can read a certain file. This method provides a way to get the ImageIO instance that is created. Or you can directly specify the ImageIO to use to read a particular file in case the factory mechanism will not work properly (e.g., unknown or unusual extension).

template<typename TOutputImage , typename ConvertPixelTraits >
void itk::ImageFileReaderKW< TOutputImage, ConvertPixelTraits >::TestFileExistanceAndReadability ( )
protected

Test whether the given filename exist and it is readable, this is intended to be called before attempting to use ImageIO classes for actually reading the file. If the file doesn't exist or it is not readable, and exception with an approriate message will be thrown.


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