OTB  6.7.0
Orfeo Toolbox
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
otb::ImageIOBase Class Referenceabstract

#include <otbImageIOBase.h>

+ Inheritance diagram for otb::ImageIOBase:
+ Collaboration diagram for otb::ImageIOBase:

Classes

class  UnknownType
 

Public Types

typedef std::vector< std::string > ArrayOfExtensionsType
 
typedef vcl_size_t BufferSizeType
 
enum  ByteOrder {
  BigEndian,
  LittleEndian,
  OrderNotApplicable
}
 
enum  FileType {
  ASCII,
  Binary,
  TypeNotApplicable
}
 
typedef long IndexValueType
 
enum  IOComponentType {
  UNKNOWNCOMPONENTTYPE,
  UCHAR,
  CHAR,
  USHORT,
  SHORT,
  UINT,
  INT,
  ULONG,
  LONG,
  FLOAT,
  DOUBLE,
  CSHORT,
  CINT,
  CFLOAT,
  CDOUBLE
}
 
enum  IOPixelType {
  UNKNOWNPIXELTYPE,
  SCALAR,
  RGB,
  RGBA,
  OFFSET,
  VECTOR,
  POINT,
  COVARIANTVECTOR,
  SYMMETRICSECONDRANKTENSOR,
  DIFFUSIONTENSOR3D,
  COMPLEX,
  FIXEDARRAY,
  MATRIX
}
 
typedef itk::SmartPointer< SelfPointer
 
typedef ImageIOBase Self
 
typedef std::streamoff SizeType
 
typedef unsigned long SizeValueType
 
typedef itk::LightProcessObject Superclass
 
- Public Types inherited from itk::LightProcessObject
typedef SmartPointer< const SelfConstPointer
 
typedef SmartPointer< SelfPointer
 
typedef LightProcessObject Self
 
typedef Object Superclass
 
- Public Types inherited from itk::Object
typedef SmartPointer< const SelfConstPointer
 
typedef SmartPointer< SelfPointer
 
typedef Object Self
 
typedef LightObject Superclass
 
- Public Types inherited from itk::LightObject
typedef SmartPointer< const SelfConstPointer
 
typedef SmartPointer< SelfPointer
 
typedef LightObject Self
 

Public Member Functions

virtual bool CanReadFile (const char *)=0
 
virtual bool CanStreamRead ()
 
virtual bool CanStreamWrite ()
 
virtual bool CanWriteFile (const char *)=0
 
void DoMapBuffer (void *buffer, vcl_size_t numberOfPixels, std::vector< unsigned int > &bandList)
 
virtual itk::ImageIORegion GenerateStreamableReadRegionFromRequestedRegion (const itk::ImageIORegion &requested) const
 
virtual unsigned int GetActualNumberOfSplitsForWriting (unsigned int numberOfRequestedSplits, const itk::ImageIORegion &pasteRegion, const itk::ImageIORegion &largestPossibleRegion)
 
virtual const std::vector
< std::string > & 
GetAttachedFileNames () const
 
virtual unsigned int GetComponentSize () const
 
virtual std::vector< double > GetDefaultDirection (unsigned int i) const
 
SizeType GetImageSizeInBytes () const
 
SizeType GetImageSizeInComponents () const
 
SizeType GetImageSizeInPixels () const
 
virtual const char * GetNameOfClass () const
 
virtual unsigned int GetOverviewsCount ()=0
 
virtual std::vector< std::string > GetOverviewsInfo ()=0
 
virtual SizeType GetPixelStride () const
 
virtual itk::ImageIORegion GetSplitRegionForWriting (unsigned int ithPiece, unsigned int numberOfActualSplits, const itk::ImageIORegion &pasteRegion, const itk::ImageIORegion &largestPossibleRegion)
 
const ArrayOfExtensionsTypeGetSupportedReadExtensions () const
 
const ArrayOfExtensionsTypeGetSupportedWriteExtensions () const
 
virtual void Read (void *buffer)=0
 
virtual void ReadImageInformation ()=0
 
virtual void SetOutputImagePixelType (bool isComplexInternalPixelType, bool isVectorImage)=0
 
virtual bool SetPixelTypeInfo (const std::type_info &ptype)
 
virtual bool SupportsDimension (unsigned long dim)
 
virtual void Write (const void *buffer)=0
 
virtual void WriteImageInformation ()=0
 
virtual void SetFileName (const char *_arg)
 
virtual const char * GetFileName () const
 
void SetNumberOfDimensions (unsigned int)
 
virtual unsigned int GetNumberOfDimensions () const
 
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 SetDirection (unsigned int i, std::vector< double > &direction)
 
virtual void SetDirection (unsigned int i, vnl_vector< double > &direction)
 
virtual std::vector< double > GetDirection (unsigned int i) const
 
virtual void SetIORegion (itk::ImageIORegion _arg)
 
virtual const itk::ImageIORegionGetIORegion () const
 
virtual void SetPixelType (const IOPixelType _arg)
 
virtual IOPixelType GetPixelType () const
 
virtual void SetComponentType (const IOComponentType _arg)
 
virtual IOComponentType GetComponentType () const
 
virtual const std::type_info & GetComponentTypeInfo () const
 
virtual void SetNumberOfComponents (unsigned int _arg)
 
virtual const unsigned int & GetNumberOfComponents () const
 
virtual void SetUseCompression (bool _arg)
 
virtual bool GetUseCompression () const
 
virtual void UseCompressionOn ()
 
virtual void UseCompressionOff ()
 
virtual void SetUseStreamedReading (bool _arg)
 
virtual bool GetUseStreamedReading () const
 
virtual void UseStreamedReadingOn ()
 
virtual void UseStreamedReadingOff ()
 
virtual void SetUseStreamedWriting (bool _arg)
 
virtual bool GetUseStreamedWriting () const
 
virtual void UseStreamedWritingOn ()
 
virtual void UseStreamedWritingOff ()
 
virtual void SetFileType (const FileType _arg)
 
virtual FileType GetFileType () const
 
void SetFileTypeToASCII ()
 
void SetFileTypeToBinary ()
 
virtual void SetByteOrder (const ByteOrder _arg)
 
virtual ByteOrder GetByteOrder () const
 
void SetByteOrderToBigEndian ()
 
void SetByteOrderToLittleEndian ()
 
- Public Member Functions inherited from itk::LightProcessObject
virtual void AbortGenerateDataOff ()
 
virtual void AbortGenerateDataOn ()
 
virtual ::itk::LightObject::Pointer CreateAnother () const
 
virtual const bool & GetAbortGenerateData () const
 
virtual const float & GetProgress () const
 
virtual void SetAbortGenerateData (bool _arg)
 
virtual void SetProgress (float _arg)
 
virtual void UpdateOutputData ()
 
void UpdateProgress (float amount)
 
- Public Member Functions inherited from itk::Object
unsigned long AddObserver (const EventObject &event, Command *)
 
unsigned long AddObserver (const EventObject &event, Command *) const
 
virtual void DebugOff () const
 
virtual void DebugOn () const
 
CommandGetCommand (unsigned long tag)
 
bool GetDebug () const
 
const MetaDataDictionaryGetMetaDataDictionary () const
 
MetaDataDictionaryGetMetaDataDictionary ()
 
virtual ModifiedTimeType GetMTime () const
 
virtual const std::string & GetObjectName () const
 
virtual const TimeStampGetTimeStamp () const
 
bool HasObserver (const EventObject &event) const
 
void InvokeEvent (const EventObject &)
 
void InvokeEvent (const EventObject &) const
 
virtual void Modified () const
 
virtual void Register () const override
 
void RemoveAllObservers ()
 
void RemoveObserver (unsigned long tag)
 
void SetDebug (bool debugFlag) const
 
void SetMetaDataDictionary (const MetaDataDictionary &rhs)
 
virtual void SetObjectName (std::string _arg)
 
virtual void SetReferenceCount (int) override
 
virtual void UnRegister () const noexceptoverride
 
- Public Member Functions inherited from itk::LightObject
virtual void Delete ()
 
virtual int GetReferenceCount () const
 
 itkCloneMacro (Self)
 
void Print (std::ostream &os, Indent indent=0) const
 

Static Public Member Functions

static std::string GetByteOrderAsString (ByteOrder)
 
static std::string GetComponentTypeAsString (IOComponentType)
 
static std::string GetFileTypeAsString (FileType)
 
static std::string GetPixelTypeAsString (IOPixelType)
 
- Static Public Member Functions inherited from itk::LightProcessObject
static Pointer New ()
 
- Static Public Member Functions inherited from itk::Object
static bool GetGlobalWarningDisplay ()
 
static void GlobalWarningDisplayOff ()
 
static void GlobalWarningDisplayOn ()
 
static Pointer New ()
 
static void SetGlobalWarningDisplay (bool flag)
 
- Static Public Member Functions inherited from itk::LightObject
static void BreakOnError ()
 
static Pointer New ()
 

Protected Member Functions

void AddSupportedReadExtension (const char *extension)
 
void AddSupportedWriteExtension (const char *extension)
 
void ComputeStrides ()
 
virtual unsigned int GetActualNumberOfSplitsForWritingCanStreamWrite (unsigned int numberOfRequestedSplits, const itk::ImageIORegion &pasteRegion) const
 
SizeType GetComponentStride () const
 
virtual unsigned int GetPixelSize () const
 
SizeType GetRowStride () const
 
SizeType GetSliceStride () const
 
virtual itk::ImageIORegion GetSplitRegionForWritingCanStreamWrite (unsigned int ithPiece, unsigned int numberOfActualSplits, const itk::ImageIORegion &pasteRegion) const
 
 ImageIOBase ()
 
void PrintSelf (std::ostream &os, itk::Indent indent) const override
 
void ReadBufferAsASCII (std::istream &os, void *buffer, IOComponentType ctype, SizeType numberOfBytesToBeRead)
 
bool ReadBufferAsBinary (std::istream &os, void *buffer, SizeType numberOfBytesToBeRead)
 
virtual void Reset (const bool freeDynamic=true)
 
void Resize (const unsigned int numDimensions, const unsigned int *dimensions)
 
void WriteBufferAsASCII (std::ostream &os, const void *buffer, IOComponentType ctype, SizeType numberOfBytesToWrite)
 
 ~ImageIOBase () override
 
- Protected Member Functions inherited from itk::LightProcessObject
virtual void GenerateData ()
 
 LightProcessObject ()
 
 ~LightProcessObject ()
 
- Protected Member Functions inherited from itk::Object
 Object ()
 
bool PrintObservers (std::ostream &os, Indent indent) const
 
virtual void SetTimeStamp (const TimeStamp &time)
 
virtual ~Object ()
 
- Protected Member Functions inherited from itk::LightObject
virtual LightObject::Pointer InternalClone () const
 
 LightObject ()
 
virtual void PrintHeader (std::ostream &os, Indent indent) const
 
virtual void PrintTrailer (std::ostream &os, Indent indent) const
 
virtual ~LightObject ()
 

Protected Attributes

std::vector< std::string > m_AttachedFileNames
 
ByteOrder m_ByteOrder
 
IOComponentType m_ComponentType
 
std::vector< SizeValueTypem_Dimensions
 
std::vector< std::vector
< double > > 
m_Direction
 
std::string m_FileName
 
FileType m_FileType
 
bool m_Initialized
 
itk::ImageIORegion m_IORegion
 
unsigned int m_NumberOfComponents
 
unsigned int m_NumberOfDimensions
 
std::vector< double > m_Origin
 
IOPixelType m_PixelType
 
std::vector< double > m_Spacing
 
std::vector< SizeTypem_Strides
 
bool m_UseCompression
 
bool m_UseStreamedReading
 
bool m_UseStreamedWriting
 
- Protected Attributes inherited from itk::LightObject
AtomicInt< int > m_ReferenceCount
 

Private Member Functions

 ImageIOBase (const Self &)=delete
 
void operator= (const Self &)=delete
 

Private Attributes

ArrayOfExtensionsType m_SupportedReadExtensions
 
ArrayOfExtensionsType m_SupportedWriteExtensions
 

Detailed Description

Abstract superclass defines image IO interface.

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.

See Also
ImageFileWriter
ImageFileReader
ImageSeriesWriter
ImageSeriesReader

Definition at line 68 of file otbImageIOBase.h.

Member Typedef Documentation

typedef std::vector< std::string > otb::ImageIOBase::ArrayOfExtensionsType

Type for the list of strings to be used for extensions.

Definition at line 426 of file otbImageIOBase.h.

Type for representing size of bytes, and or positions along a memory buffer

Definition at line 283 of file otbImageIOBase.h.

Types for managing image size and image index components.

Definition at line 81 of file otbImageIOBase.h.

Definition at line 74 of file otbImageIOBase.h.

Standard class typedefs.

Definition at line 72 of file otbImageIOBase.h.

typedef std::streamoff otb::ImageIOBase::SizeType

Type for representing size of bytes, and or positions along a file

Definition at line 280 of file otbImageIOBase.h.

typedef unsigned long otb::ImageIOBase::SizeValueType

Definition at line 86 of file otbImageIOBase.h.

Definition at line 73 of file otbImageIOBase.h.

Member Enumeration Documentation

Enums used to specify byte order; whether Big Endian or Little Endian. Some subclasses use this, some ignore it.

Enumerator
BigEndian 
LittleEndian 
OrderNotApplicable 

Definition at line 232 of file otbImageIOBase.h.

Enums used to specify write style: whether binary or ASCII. Some subclasses use this, some ignore it.

Enumerator
ASCII 
Binary 
TypeNotApplicable 

Definition at line 228 of file otbImageIOBase.h.

Enums used to manipulate the component type. The component type refers to the actual storage class associated with either a SCALAR pixel type or elements of a compound pixel.

Enumerator
UNKNOWNCOMPONENTTYPE 
UCHAR 
CHAR 
USHORT 
SHORT 
UINT 
INT 
ULONG 
LONG 
FLOAT 
DOUBLE 
CSHORT 
CINT 
CFLOAT 
CDOUBLE 

Definition at line 107 of file otbImageIOBase.h.

Enums used to manipulate the pixel type. The pixel type provides context for automatic data conversions (for instance, RGB to SCALAR, VECTOR to SCALAR).

Enumerator
UNKNOWNPIXELTYPE 
SCALAR 
RGB 
RGBA 
OFFSET 
VECTOR 
POINT 
COVARIANTVECTOR 
SYMMETRICSECONDRANKTENSOR 
DIFFUSIONTENSOR3D 
COMPLEX 
FIXEDARRAY 
MATRIX 

Definition at line 99 of file otbImageIOBase.h.

Constructor & Destructor Documentation

otb::ImageIOBase::ImageIOBase ( )
protected
otb::ImageIOBase::~ImageIOBase ( )
overrideprotected
otb::ImageIOBase::ImageIOBase ( const Self )
privatedelete

Member Function Documentation

void otb::ImageIOBase::AddSupportedReadExtension ( const char *  extension)
protected

Insert an extension to the list of supported extensions for reading.

void otb::ImageIOBase::AddSupportedWriteExtension ( const char *  extension)
protected

Insert an extension to the list of supported extensions for writing.

virtual bool otb::ImageIOBase::CanReadFile ( const char *  )
pure virtual

Determine the file type. Returns true if this ImageIO can read the file specified.

Implemented in otb::GDALImageIO, otb::BSQImageIO, otb::LUMImageIO, otb::RADImageIO, otb::ONERAImageIO, and otb::MSTARImageIO.

virtual bool otb::ImageIOBase::CanStreamRead ( )
inlinevirtual

Determine if the ImageIO can stream reading from this file. Default is false.

Reimplemented in otb::GDALImageIO, otb::BSQImageIO, otb::LUMImageIO, otb::RADImageIO, otb::ONERAImageIO, and otb::MSTARImageIO.

Definition at line 331 of file otbImageIOBase.h.

virtual bool otb::ImageIOBase::CanStreamWrite ( void  )
inlinevirtual

Determine if the ImageIO can stream writing to this file. Default is false.

There are two types of non exclusive streaming: pasting subregions, and iterative If true then

Reimplemented in otb::GDALImageIO, otb::BSQImageIO, otb::LUMImageIO, otb::RADImageIO, otb::ONERAImageIO, and otb::MSTARImageIO.

Definition at line 355 of file otbImageIOBase.h.

virtual bool otb::ImageIOBase::CanWriteFile ( const char *  )
pure virtual

Determine the file type. Returns true if this ImageIO can read the file specified.

Implemented in otb::GDALImageIO, otb::BSQImageIO, otb::LUMImageIO, otb::RADImageIO, otb::ONERAImageIO, and otb::MSTARImageIO.

void otb::ImageIOBase::ComputeStrides ( )
protected

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.

void otb::ImageIOBase::DoMapBuffer ( void *  buffer,
vcl_size_t  numberOfPixels,
std::vector< unsigned int > &  bandList 
)

Remap band order in an input buffer using band mapping bandList This operation is done in-place. The buffer size should enough to contain extracted bands before and after mapping. bandList mapping between origin components and output components (before any conversion)

virtual itk::ImageIORegion otb::ImageIOBase::GenerateStreamableReadRegionFromRequestedRegion ( const itk::ImageIORegion requested) const
virtual

Method for supporting streaming. Given a requested region, determine what could be the region that we can read from the file. This is called the streamable region, which will be equal or smaller than the LargestPossibleRegion (unless it was dimensionaly clipped) and greater or equal to the RequestedRegion

the resulting IORegion may be a greater dimensions the the requested IORegion, if the the derived class is unable to read the requested region. For example if the file has a size of [ 10, 10, 10] but the requested region is [10, 10] the return may be 3 dimensions.

virtual unsigned int otb::ImageIOBase::GetActualNumberOfSplitsForWriting ( unsigned int  numberOfRequestedSplits,
const itk::ImageIORegion pasteRegion,
const itk::ImageIORegion largestPossibleRegion 
)
virtual

Before this method is called all the configuration will be done, that is Streaming/PasteRegion/Compression/Filename etc If pasting is being used the number of requested splits is for that region not the largest. The derived ImageIO class should verify that the file is capable of being written with this configuration. If pasted is enabled and is not support or does not work with the file, then an excepetion should be thrown.

The default implementation depends on CanStreamWrite. If false then 1 is returned (unless pasting is indicated), so that the whole file will be updated in one region. If true then its assumed that any arbitrary region can be written to any file. So the users request will be respected. If a derived class has more restictive conditions then they should be checked

virtual unsigned int otb::ImageIOBase::GetActualNumberOfSplitsForWritingCanStreamWrite ( unsigned int  numberOfRequestedSplits,
const itk::ImageIORegion pasteRegion 
) const
protectedvirtual

an implementation of ImageRegionSplitter:GetNumberOfSplits

virtual const std::vector<std::string>& otb::ImageIOBase::GetAttachedFileNames ( ) const
virtual

Returns a const ref to the list of attached files

virtual ByteOrder otb::ImageIOBase::GetByteOrder ( ) const
virtual

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.

static std::string otb::ImageIOBase::GetByteOrderAsString ( ByteOrder  )
static

Convenience method returns the ByteOrder as a string. This can be used for writing output files.

virtual unsigned int otb::ImageIOBase::GetComponentSize ( ) const
virtual

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.

SizeType otb::ImageIOBase::GetComponentStride ( ) const
protected

Convenient method for accessing number of bytes to get to the next pixel component. Returns m_Strides[0].

virtual IOComponentType otb::ImageIOBase::GetComponentType ( ) const
virtual

Set/Get the component type of the image. This is always a native type.

static std::string otb::ImageIOBase::GetComponentTypeAsString ( IOComponentType  )
static

Convenience method returns the IOComponentType as a string. This can be used for writing output files.

Referenced by otb::ImageFileReader< TOutputImage, ConvertPixelTraits >::DoConvertBuffer().

virtual const std::type_info& otb::ImageIOBase::GetComponentTypeInfo ( ) const
virtual

Set/Get the component type of the image. This is always a native type.

virtual std::vector<double> otb::ImageIOBase::GetDefaultDirection ( unsigned int  i) const
virtual

Return the directions to be assigned by default to recipient images whose dimension is smaller than the image dimension in file.

virtual unsigned int otb::ImageIOBase::GetDimensions ( unsigned int  i) const
inlinevirtual

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 121 of file otbImageIOBase.h.

virtual std::vector<double> otb::ImageIOBase::GetDirection ( unsigned int  i) const
inlinevirtual

Set/Get the image direction on an axis-by-axis basis. The SetDirection() method is required when writing the image.

Definition at line 147 of file otbImageIOBase.h.

virtual const char* otb::ImageIOBase::GetFileName ( ) const
virtual

Set/Get the name of the file to be read.

virtual FileType otb::ImageIOBase::GetFileType ( ) const
virtual

These methods control whether the file is written binary or ASCII. Many file formats (i.e., subclasses) ignore this flag.

static std::string otb::ImageIOBase::GetFileTypeAsString ( FileType  )
static

Convenience method returns the FileType as a string. This can be used for writing output files.

SizeType otb::ImageIOBase::GetImageSizeInBytes ( ) const

Return the number of bytes in the image.

SizeType otb::ImageIOBase::GetImageSizeInComponents ( ) const

Return the number of pixels times the number of components in the image.

SizeType otb::ImageIOBase::GetImageSizeInPixels ( ) const

Return the number of pixels in the image.

virtual const itk::ImageIORegion& otb::ImageIOBase::GetIORegion ( ) const
virtual

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.

virtual const char* otb::ImageIOBase::GetNameOfClass ( ) const
virtual

Run-time type information (and related methods).

Reimplemented from itk::LightProcessObject.

Reimplemented in otb::GDALImageIO, otb::BSQImageIO, otb::LUMImageIO, otb::RADImageIO, otb::ONERAImageIO, and otb::MSTARImageIO.

virtual const unsigned int& otb::ImageIOBase::GetNumberOfComponents ( ) const
virtual

Set/Get the number of components per pixel in the image. This may be set by the reading process. For SCALAR pixel types, NumberOfComponents will be 1. For other pixel types, NumberOfComponents will be greater than or equal to one.

virtual unsigned int otb::ImageIOBase::GetNumberOfDimensions ( ) const
virtual

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.

virtual double otb::ImageIOBase::GetOrigin ( unsigned int  i) const
inlinevirtual

Set/Get the image origin on a axis-by-axis basis. The SetOrigin() method is required when writing the image.

Definition at line 128 of file otbImageIOBase.h.

virtual unsigned int otb::ImageIOBase::GetOverviewsCount ( )
pure virtual

Get the number of overviews available into the file specified Returns: overview count, zero if none.

Implemented in otb::GDALImageIO, otb::BSQImageIO, otb::LUMImageIO, otb::RADImageIO, otb::ONERAImageIO, and otb::MSTARImageIO.

virtual std::vector<std::string> otb::ImageIOBase::GetOverviewsInfo ( )
pure virtual

Get information about overviews available into the file specified Returns: overview info, empty if none.

Implemented in otb::GDALImageIO, otb::BSQImageIO, otb::LUMImageIO, otb::RADImageIO, otb::ONERAImageIO, and otb::MSTARImageIO.

virtual unsigned int otb::ImageIOBase::GetPixelSize ( ) const
protectedvirtual

Compute the size (in bytes) of the pixel. For example, and RGB pixel of unsigned char would have size 3 bytes.

virtual SizeType otb::ImageIOBase::GetPixelStride ( ) const
virtual

Convenient method for accessing the number of bytes to get to the next pixel. Returns m_Strides[1];

Please note that this methods depends the private methods ComputeStrides being called, otherwise this is the incorrect value.

virtual IOPixelType otb::ImageIOBase::GetPixelType ( ) const
virtual

Set/Get the type of the pixel. The PixelTypes provides context to the IO mechanisms for data conversions. PixelTypes can be SCALAR, RGB, RGBA, VECTOR, COVARIANTVECTOR, POINT, INDEX. If the PIXELTYPE is SCALAR, then the NumberOfComponents should be 1. Any other of PIXELTYPE will have more than one component.

static std::string otb::ImageIOBase::GetPixelTypeAsString ( IOPixelType  )
static

Convenience method returns the IOPixelType as a string. This can be used for writing output files.

SizeType otb::ImageIOBase::GetRowStride ( ) const
protected

Convenient method for accessing the number of bytes to get to the next row. Returns m_Strides[2].

SizeType otb::ImageIOBase::GetSliceStride ( ) const
protected

Convenient method for accessing the number of bytes to get to the next slice. Returns m_Strides[3].

virtual double otb::ImageIOBase::GetSpacing ( unsigned int  i) const
inlinevirtual

Set/Get the image spacing on an axis-by-axis basis. The SetSpacing() method is required when writing the image.

Definition at line 137 of file otbImageIOBase.h.

virtual itk::ImageIORegion otb::ImageIOBase::GetSplitRegionForWriting ( unsigned int  ithPiece,
unsigned int  numberOfActualSplits,
const itk::ImageIORegion pasteRegion,
const itk::ImageIORegion largestPossibleRegion 
)
virtual

returns the ith IORegion

numberOfActualSplits should be the value returned from GetActualNumberOfSplitsForWriting with the same parameters

Derieved classes should overload this method to return a compatible region

virtual itk::ImageIORegion otb::ImageIOBase::GetSplitRegionForWritingCanStreamWrite ( unsigned int  ithPiece,
unsigned int  numberOfActualSplits,
const itk::ImageIORegion pasteRegion 
) const
protectedvirtual

an implementation of ImageRegionSplitter:GetSplit

const ArrayOfExtensionsType& otb::ImageIOBase::GetSupportedReadExtensions ( ) const

This method returns an array with the list of filename extensions supported for reading by this ImageIO class. This is intended to facilitate GUI and application level integration.

const ArrayOfExtensionsType& otb::ImageIOBase::GetSupportedWriteExtensions ( ) const

This method returns an array with the list of filename extensions supported for writing by this ImageIO class. This is intended to facilitate GUI and application level integration.

virtual bool otb::ImageIOBase::GetUseCompression ( ) const
virtual

Set/Get a boolean to use the compression or not.

virtual bool otb::ImageIOBase::GetUseStreamedReading ( ) const
virtual

Set/Get a boolean to use streaming while reading or not.

virtual bool otb::ImageIOBase::GetUseStreamedWriting ( ) const
virtual

Set/Get a boolean to use streaming while writing or not.

void otb::ImageIOBase::operator= ( const Self )
privatedelete
void otb::ImageIOBase::PrintSelf ( std::ostream &  os,
itk::Indent  indent 
) const
overrideprotectedvirtual
virtual void otb::ImageIOBase::Read ( void *  buffer)
pure virtual

Reads the data from disk into the memory buffer provided.

Implemented in otb::GDALImageIO, otb::BSQImageIO, otb::LUMImageIO, otb::RADImageIO, otb::ONERAImageIO, and otb::MSTARImageIO.

void otb::ImageIOBase::ReadBufferAsASCII ( std::istream &  os,
void *  buffer,
IOComponentType  ctype,
SizeType  numberOfBytesToBeRead 
)
protected

Convenient method to read a buffer as ASCII text.

bool otb::ImageIOBase::ReadBufferAsBinary ( std::istream &  os,
void *  buffer,
SizeType  numberOfBytesToBeRead 
)
protected

Convenient method to read a buffer as binary. Return true on success.

virtual void otb::ImageIOBase::ReadImageInformation ( )
pure virtual

Read the spacing and dimensions of the image. Assumes SetFileName has been called with a valid file name.

Implemented in otb::GDALImageIO, otb::BSQImageIO, otb::LUMImageIO, otb::RADImageIO, otb::ONERAImageIO, and otb::MSTARImageIO.

virtual void otb::ImageIOBase::Reset ( const bool  freeDynamic = true)
protectedvirtual

Return the object to an initialized state, ready to be used

void otb::ImageIOBase::Resize ( const unsigned int  numDimensions,
const unsigned int *  dimensions 
)
protected

Resize the ImageIOBase object to new dimensions.

virtual void otb::ImageIOBase::SetByteOrder ( const ByteOrder  _arg)
virtual

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.

void otb::ImageIOBase::SetByteOrderToBigEndian ( )
inline

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 261 of file otbImageIOBase.h.

void otb::ImageIOBase::SetByteOrderToLittleEndian ( )
inline

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 265 of file otbImageIOBase.h.

virtual void otb::ImageIOBase::SetComponentType ( const IOComponentType  _arg)
virtual

Set/Get the component type of the image. This is always a native type.

virtual void otb::ImageIOBase::SetDimensions ( unsigned int  i,
unsigned int  dim 
)
virtual

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.

virtual void otb::ImageIOBase::SetDirection ( unsigned int  i,
std::vector< double > &  direction 
)
virtual

Set/Get the image direction on an axis-by-axis basis. The SetDirection() method is required when writing the image.

virtual void otb::ImageIOBase::SetDirection ( unsigned int  i,
vnl_vector< double > &  direction 
)
virtual

Set/Get the image direction on an axis-by-axis basis. The SetDirection() method is required when writing the image.

virtual void otb::ImageIOBase::SetFileName ( const char *  _arg)
virtual

Set/Get the name of the file to be read.

virtual void otb::ImageIOBase::SetFileType ( const FileType  _arg)
virtual

These methods control whether the file is written binary or ASCII. Many file formats (i.e., subclasses) ignore this flag.

void otb::ImageIOBase::SetFileTypeToASCII ( )
inline

These methods control whether the file is written binary or ASCII. Many file formats (i.e., subclasses) ignore this flag.

Definition at line 238 of file otbImageIOBase.h.

void otb::ImageIOBase::SetFileTypeToBinary ( )
inline

These methods control whether the file is written binary or ASCII. Many file formats (i.e., subclasses) ignore this flag.

Definition at line 242 of file otbImageIOBase.h.

virtual void otb::ImageIOBase::SetIORegion ( itk::ImageIORegion  _arg)
virtual

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.

virtual void otb::ImageIOBase::SetNumberOfComponents ( unsigned int  _arg)
virtual

Set/Get the number of components per pixel in the image. This may be set by the reading process. For SCALAR pixel types, NumberOfComponents will be 1. For other pixel types, NumberOfComponents will be greater than or equal to one.

void otb::ImageIOBase::SetNumberOfDimensions ( unsigned  int)

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.

virtual void otb::ImageIOBase::SetOrigin ( unsigned int  i,
double  origin 
)
virtual

Set/Get the image origin on a axis-by-axis basis. The SetOrigin() method is required when writing the image.

virtual void otb::ImageIOBase::SetOutputImagePixelType ( bool  isComplexInternalPixelType,
bool  isVectorImage 
)
pure virtual

Provide hist about the output container to deal with complex pixel type

Implemented in otb::GDALImageIO, otb::BSQImageIO, otb::LUMImageIO, otb::RADImageIO, otb::ONERAImageIO, and otb::MSTARImageIO.

virtual void otb::ImageIOBase::SetPixelType ( const IOPixelType  _arg)
virtual

Set/Get the type of the pixel. The PixelTypes provides context to the IO mechanisms for data conversions. PixelTypes can be SCALAR, RGB, RGBA, VECTOR, COVARIANTVECTOR, POINT, INDEX. If the PIXELTYPE is SCALAR, then the NumberOfComponents should be 1. Any other of PIXELTYPE will have more than one component.

virtual bool otb::ImageIOBase::SetPixelTypeInfo ( const std::type_info &  ptype)
virtual

SetPixelTypeInfo is used by writers to convert from an ITK strongly typed pixel to a ImageIO (weaker) typed pixel. This function sets these PixelType, ComponentType, and NumberOfComponents based on RTTI type_info structure passed in. The function returns false if the pixel type is not supported.

virtual void otb::ImageIOBase::SetSpacing ( unsigned int  i,
double  spacing 
)
virtual

Set/Get the image spacing on an axis-by-axis basis. The SetSpacing() method is required when writing the image.

virtual void otb::ImageIOBase::SetUseCompression ( bool  _arg)
virtual

Set/Get a boolean to use the compression or not.

virtual void otb::ImageIOBase::SetUseStreamedReading ( bool  _arg)
virtual

Set/Get a boolean to use streaming while reading or not.

virtual void otb::ImageIOBase::SetUseStreamedWriting ( bool  _arg)
virtual

Set/Get a boolean to use streaming while writing or not.

virtual bool otb::ImageIOBase::SupportsDimension ( unsigned long  dim)
inlinevirtual

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.

Definition at line 376 of file otbImageIOBase.h.

virtual void otb::ImageIOBase::UseCompressionOff ( )
virtual

Set/Get a boolean to use the compression or not.

virtual void otb::ImageIOBase::UseCompressionOn ( )
virtual

Set/Get a boolean to use the compression or not.

virtual void otb::ImageIOBase::UseStreamedReadingOff ( )
virtual

Set/Get a boolean to use streaming while reading or not.

virtual void otb::ImageIOBase::UseStreamedReadingOn ( )
virtual

Set/Get a boolean to use streaming while reading or not.

virtual void otb::ImageIOBase::UseStreamedWritingOff ( )
virtual

Set/Get a boolean to use streaming while writing or not.

virtual void otb::ImageIOBase::UseStreamedWritingOn ( )
virtual

Set/Get a boolean to use streaming while writing or not.

virtual void otb::ImageIOBase::Write ( const void *  buffer)
pure virtual

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 otb::GDALImageIO, otb::BSQImageIO, otb::LUMImageIO, otb::RADImageIO, otb::ONERAImageIO, and otb::MSTARImageIO.

void otb::ImageIOBase::WriteBufferAsASCII ( std::ostream &  os,
const void *  buffer,
IOComponentType  ctype,
SizeType  numberOfBytesToWrite 
)
protected

Convenient method to write a buffer as ASCII text.

virtual void otb::ImageIOBase::WriteImageInformation ( )
pure virtual

Writes the spacing and dimensions of the image. Assumes SetFileName has been called with a valid file name.

Implemented in otb::GDALImageIO, otb::BSQImageIO, otb::LUMImageIO, otb::RADImageIO, otb::ONERAImageIO, and otb::MSTARImageIO.

Member Data Documentation

std::vector<std::string> otb::ImageIOBase::m_AttachedFileNames
protected

List of files part of the same dataset as the input filename

Definition at line 572 of file otbImageIOBase.h.

ByteOrder otb::ImageIOBase::m_ByteOrder
protected

Big or Little Endian, and the type of the file. (May be ignored.)

Definition at line 463 of file otbImageIOBase.h.

IOComponentType otb::ImageIOBase::m_ComponentType
protected

Used internally to keep track of the type of the component. It is set when ComputeStrides() is invoked.

Definition at line 460 of file otbImageIOBase.h.

std::vector< SizeValueType > otb::ImageIOBase::m_Dimensions
protected

The array which stores the number of pixels in the x, y, z directions.

Definition at line 493 of file otbImageIOBase.h.

std::vector<std::vector<double> > otb::ImageIOBase::m_Direction
protected

The arrays which store the direction cosines of the image.

Definition at line 503 of file otbImageIOBase.h.

std::string otb::ImageIOBase::m_FileName
protected

Filename to read

Definition at line 470 of file otbImageIOBase.h.

FileType otb::ImageIOBase::m_FileType
protected

Definition at line 464 of file otbImageIOBase.h.

bool otb::ImageIOBase::m_Initialized
protected

Does the ImageIOBase object have enough info to be of use?

Definition at line 467 of file otbImageIOBase.h.

itk::ImageIORegion otb::ImageIOBase::m_IORegion
protected

The region to read or write. The region contains information about the data within the region to read or write.

Definition at line 490 of file otbImageIOBase.h.

unsigned int otb::ImageIOBase::m_NumberOfComponents
protected

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 474 of file otbImageIOBase.h.

unsigned int otb::ImageIOBase::m_NumberOfDimensions
protected

The number of independent dimensions in the image.

Definition at line 477 of file otbImageIOBase.h.

std::vector<double> otb::ImageIOBase::m_Origin
protected

The array which stores the origin of the image.

Definition at line 500 of file otbImageIOBase.h.

IOPixelType otb::ImageIOBase::m_PixelType
protected

Used internally to keep track of the type of the pixel.

Definition at line 456 of file otbImageIOBase.h.

std::vector<double> otb::ImageIOBase::m_Spacing
protected

The array which stores the spacing of pixels in the x, y, z directions.

Definition at line 497 of file otbImageIOBase.h.

std::vector< SizeType > otb::ImageIOBase::m_Strides
protected

Stores the number of bytes it takes to get to the next 'thing' e.g. component, pixel, row, slice, etc.

Definition at line 507 of file otbImageIOBase.h.

ArrayOfExtensionsType otb::ImageIOBase::m_SupportedReadExtensions
private

Definition at line 578 of file otbImageIOBase.h.

ArrayOfExtensionsType otb::ImageIOBase::m_SupportedWriteExtensions
private

Definition at line 579 of file otbImageIOBase.h.

bool otb::ImageIOBase::m_UseCompression
protected

Should we compress the data?

Definition at line 480 of file otbImageIOBase.h.

bool otb::ImageIOBase::m_UseStreamedReading
protected

Should we use streaming for reading

Definition at line 483 of file otbImageIOBase.h.

bool otb::ImageIOBase::m_UseStreamedWriting
protected

Should we use streaming for writing

Definition at line 486 of file otbImageIOBase.h.


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