OTB  7.4.0
Orfeo Toolbox
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
otb::StreamingImageVirtualWriter< TInputImage > Class Template Reference

#include <otbStreamingImageVirtualWriter.h>

+ Inheritance diagram for otb::StreamingImageVirtualWriter< TInputImage >:
+ Collaboration diagram for otb::StreamingImageVirtualWriter< TInputImage >:

Public Types

typedef itk::SmartPointer< const SelfConstPointer
 
typedef InputImageType::PixelType InputImagePixelType
 
typedef InputImageType::Pointer InputImagePointer
 
typedef InputImageType::RegionType InputImageRegionType
 
typedef TInputImage InputImageType
 
typedef itk::SmartPointer< SelfPointer
 
typedef StreamingImageVirtualWriter Self
 
typedef StreamingManagerType::Pointer StreamingManagerPointerType
 
typedef StreamingManager< InputImageTypeStreamingManagerType
 
typedef itk::ImageToImageFilter< TInputImage, TInputImage > Superclass
 

Public Member Functions

virtual ::itk::LightObject::Pointer CreateAnother (void) const
 
const bool & GetAbortGenerateData () const override
 
virtual const char * GetNameOfClass () const
 
StreamingManagerTypeGetStreamingManager (void)
 
void SetAutomaticAdaptativeStreaming (unsigned int availableRAM=0, double bias=1.0)
 
void SetAutomaticStrippedStreaming (unsigned int availableRAM=0, double bias=1.0)
 
void SetAutomaticTiledStreaming (unsigned int availableRAM=0, double bias=1.0)
 
void SetNumberOfDivisionsStrippedStreaming (unsigned int nbDivisions)
 
void SetNumberOfDivisionsTiledStreaming (unsigned int nbDivisions)
 
void SetNumberOfLinesStrippedStreaming (unsigned int nbLinesPerStrip)
 
void SetStreamingManager (StreamingManagerType *streamingManager)
 
void SetTileDimensionTiledStreaming (unsigned int tileDimension)
 
void Update () override
 

Static Public Member Functions

static Pointer New ()
 

Static Public Attributes

static const unsigned int InputImageDimension = InputImageType::ImageDimension
 

Protected Member Functions

void GenerateInputRequestedRegion (void) override
 
void PrintSelf (std::ostream &os, itk::Indent indent) const override
 
 StreamingImageVirtualWriter ()
 
 ~StreamingImageVirtualWriter () override
 

Private Member Functions

void ObserveSourceFilterProgress (itk::Object *object, const itk::EventObject &event)
 
void operator= (const StreamingImageVirtualWriter &)=delete
 
 StreamingImageVirtualWriter (const StreamingImageVirtualWriter &)=delete
 
void UpdateFilterProgress ()
 

Private Attributes

unsigned int m_CurrentDivision
 
float m_DivisionProgress
 
bool m_IsObserving
 
itk::SimpleFastMutexLock m_Lock
 
unsigned int m_NumberOfDivisions
 
unsigned long m_ObserverID
 
StreamingManagerPointerType m_StreamingManager
 
void SetAbortGenerateData (const bool val) override
 
void GenerateData (void) override
 

Detailed Description

template<class TInputImage>
class otb::StreamingImageVirtualWriter< TInputImage >

This class acts like a StreamingImageFileWriter, but without actually writing data to the disk.

This allows streaming the whole image through persistent filters such as PersitentStatisticsImageFilter in order to get the global statistics of an image.

This filter is not intended to be used with classic ImageToImageFilter, though it will not generate any error.

The computation of divisions can be done following different strategies by setting the StreamingManager attributes with SetStreamingManager. A set of behaviors are available with the following methods :

It is used in the PersistentFilterStreamingDecorator helper class to propose an easy way to stream an image through a persistent filter.

See also
PersistentImageFilter
PersistentStatisticsImageFilter
PersistentImageStreamingDecorator.

Definition at line 60 of file otbStreamingImageVirtualWriter.h.

Member Typedef Documentation

◆ ConstPointer

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

Definition at line 67 of file otbStreamingImageVirtualWriter.h.

◆ InputImagePixelType

template<class TInputImage >
typedef InputImageType::PixelType otb::StreamingImageVirtualWriter< TInputImage >::InputImagePixelType

Definition at line 79 of file otbStreamingImageVirtualWriter.h.

◆ InputImagePointer

template<class TInputImage >
typedef InputImageType::Pointer otb::StreamingImageVirtualWriter< TInputImage >::InputImagePointer

Definition at line 77 of file otbStreamingImageVirtualWriter.h.

◆ InputImageRegionType

template<class TInputImage >
typedef InputImageType::RegionType otb::StreamingImageVirtualWriter< TInputImage >::InputImageRegionType

Definition at line 78 of file otbStreamingImageVirtualWriter.h.

◆ InputImageType

template<class TInputImage >
typedef TInputImage otb::StreamingImageVirtualWriter< TInputImage >::InputImageType

Some typedefs for the input and output.

Definition at line 73 of file otbStreamingImageVirtualWriter.h.

◆ Pointer

template<class TInputImage >
typedef itk::SmartPointer<Self> otb::StreamingImageVirtualWriter< TInputImage >::Pointer

Definition at line 66 of file otbStreamingImageVirtualWriter.h.

◆ Self

template<class TInputImage >
typedef StreamingImageVirtualWriter otb::StreamingImageVirtualWriter< TInputImage >::Self

Standard class typedefs.

Definition at line 64 of file otbStreamingImageVirtualWriter.h.

◆ StreamingManagerPointerType

Definition at line 83 of file otbStreamingImageVirtualWriter.h.

◆ StreamingManagerType

template<class TInputImage >
typedef StreamingManager<InputImageType> otb::StreamingImageVirtualWriter< TInputImage >::StreamingManagerType

Streaming manager base class pointer

Definition at line 82 of file otbStreamingImageVirtualWriter.h.

◆ Superclass

template<class TInputImage >
typedef itk::ImageToImageFilter<TInputImage, TInputImage> otb::StreamingImageVirtualWriter< TInputImage >::Superclass

Definition at line 65 of file otbStreamingImageVirtualWriter.h.

Constructor & Destructor Documentation

◆ StreamingImageVirtualWriter() [1/2]

template<class TInputImage >
otb::StreamingImageVirtualWriter< TInputImage >::StreamingImageVirtualWriter ( )
protected

◆ ~StreamingImageVirtualWriter()

template<class TInputImage >
otb::StreamingImageVirtualWriter< TInputImage >::~StreamingImageVirtualWriter ( )
overrideprotected

Definition at line 50 of file otbStreamingImageVirtualWriter.hxx.

◆ StreamingImageVirtualWriter() [2/2]

template<class TInputImage >
otb::StreamingImageVirtualWriter< TInputImage >::StreamingImageVirtualWriter ( const StreamingImageVirtualWriter< TInputImage > &  )
privatedelete

Member Function Documentation

◆ CreateAnother()

template<class TInputImage >
virtual::itk::LightObject::Pointer otb::StreamingImageVirtualWriter< TInputImage >::CreateAnother ( void  ) const

◆ GenerateData()

template<class TInputImage >
void otb::StreamingImageVirtualWriter< TInputImage >::GenerateData ( void  )
overrideprotected

Prepare all the outputs. This may deallocate previous bulk data.

Tell all Observers that the filter is starting

Grab the input

Determine of number of pieces to divide the input. This will be the minimum of what the user specified via SetNumberOfDivisionsStrippedStreaming() and what the Splitter thinks is a reasonable value.

Register to the ProgressEvent of the source filter

Loop over the number of pieces, execute the upstream pipeline on each piece, and copy the results into the output image.

If we ended due to aborting, push the progress up to 1.0 (since it probably didn't end there)

Now we have to mark the data as up to data.

Release any inputs if marked for release

Definition at line 156 of file otbStreamingImageVirtualWriter.hxx.

References otb::StreamingImageVirtualWriter< TInputImage >::GetAbortGenerateData(), otb::Logger::Instance(), otb::StreamingImageVirtualWriter< TInputImage >::m_CurrentDivision, otb::StreamingImageVirtualWriter< TInputImage >::m_DivisionProgress, otb::StreamingImageVirtualWriter< TInputImage >::m_IsObserving, otb::StreamingImageVirtualWriter< TInputImage >::m_NumberOfDivisions, otb::StreamingImageVirtualWriter< TInputImage >::m_ObserverID, otb::StreamingImageVirtualWriter< TInputImage >::m_StreamingManager, otb::StreamingImageVirtualWriter< TInputImage >::ObserveSourceFilterProgress(), otbLogMacro, otb::StreamingImageVirtualWriter< TInputImage >::SetAbortGenerateData(), and otb::StreamingImageVirtualWriter< TInputImage >::UpdateFilterProgress().

Referenced by otb::StreamingImageVirtualWriter< TInputImage >::Update().

◆ GenerateInputRequestedRegion()

template<class TInputImage >
void otb::StreamingImageVirtualWriter< TInputImage >::GenerateInputRequestedRegion ( void  )
overrideprotected

Definition at line 140 of file otbStreamingImageVirtualWriter.hxx.

◆ GetAbortGenerateData()

template<class TInputImage >
const bool & otb::StreamingImageVirtualWriter< TInputImage >::GetAbortGenerateData ( ) const
override

◆ GetNameOfClass()

template<class TInputImage >
virtual const char* otb::StreamingImageVirtualWriter< TInputImage >::GetNameOfClass ( ) const
virtual

Run-time type information (and related methods).

◆ GetStreamingManager()

template<class TInputImage >
StreamingManagerType* otb::StreamingImageVirtualWriter< TInputImage >::GetStreamingManager ( void  )
inline

Return the StreamingManager object responsible for dividing the region to write

Definition at line 90 of file otbStreamingImageVirtualWriter.h.

◆ New()

template<class TInputImage >
static Pointer otb::StreamingImageVirtualWriter< TInputImage >::New ( )
static

Method for creation through the object factory.

◆ ObserveSourceFilterProgress()

template<class TInputImage >
void otb::StreamingImageVirtualWriter< TInputImage >::ObserveSourceFilterProgress ( itk::Object *  object,
const itk::EventObject &  event 
)
inlineprivate

◆ operator=()

template<class TInputImage >
void otb::StreamingImageVirtualWriter< TInputImage >::operator= ( const StreamingImageVirtualWriter< TInputImage > &  )
privatedelete

◆ PrintSelf()

template<class TInputImage >
void otb::StreamingImageVirtualWriter< TInputImage >::PrintSelf ( std::ostream &  os,
itk::Indent  indent 
) const
overrideprotected

Definition at line 55 of file otbStreamingImageVirtualWriter.hxx.

◆ SetAbortGenerateData()

template<class TInputImage >
void otb::StreamingImageVirtualWriter< TInputImage >::SetAbortGenerateData ( const bool  val)
override

Prepare all the outputs. This may deallocate previous bulk data.

Tell all Observers that the filter is starting

Grab the input

Determine of number of pieces to divide the input. This will be the minimum of what the user specified via SetNumberOfDivisionsStrippedStreaming() and what the Splitter thinks is a reasonable value.

Register to the ProgressEvent of the source filter

Loop over the number of pieces, execute the upstream pipeline on each piece, and copy the results into the output image.

If we ended due to aborting, push the progress up to 1.0 (since it probably didn't end there)

Now we have to mark the data as up to data.

Release any inputs if marked for release

Definition at line 288 of file otbStreamingImageVirtualWriter.hxx.

References otb::StreamingImageVirtualWriter< TInputImage >::m_Lock.

Referenced by otb::StreamingImageVirtualWriter< TInputImage >::GenerateData().

◆ SetAutomaticAdaptativeStreaming()

template<class TInputImage >
void otb::StreamingImageVirtualWriter< TInputImage >::SetAutomaticAdaptativeStreaming ( unsigned int  availableRAM = 0,
double  bias = 1.0 
)

Set the streaming mode to 'adaptative' and configure the number of MB available. The actual number of divisions is computed automatically by estimating the memory consumption of the pipeline. Tiles will try to match the input file tile scheme. Setting the availableRAM parameter to 0 means that the available RAM is set from the CMake configuration option

Definition at line 121 of file otbStreamingImageVirtualWriter.hxx.

References otb::StreamingImageVirtualWriter< TInputImage >::m_StreamingManager.

Referenced by otb::StreamingImageVirtualWriter< TInputImage >::StreamingImageVirtualWriter().

◆ SetAutomaticStrippedStreaming()

template<class TInputImage >
void otb::StreamingImageVirtualWriter< TInputImage >::SetAutomaticStrippedStreaming ( unsigned int  availableRAM = 0,
double  bias = 1.0 
)

Set the streaming mode to 'stripped' and configure the number of MB available. The actual number of divisions is computed automatically by estimating the memory consumption of the pipeline. Setting the availableRAM parameter to 0 means that the available RAM is set from the CMake configuration option

Definition at line 91 of file otbStreamingImageVirtualWriter.hxx.

References otb::StreamingImageVirtualWriter< TInputImage >::m_StreamingManager.

◆ SetAutomaticTiledStreaming()

template<class TInputImage >
void otb::StreamingImageVirtualWriter< TInputImage >::SetAutomaticTiledStreaming ( unsigned int  availableRAM = 0,
double  bias = 1.0 
)

Set the streaming mode to 'tiled' and configure the number of MB available. The actual number of divisions is computed automatically by estimating the memory consumption of the pipeline. Tiles will be square. Setting the availableRAM parameter to 0 means that the available RAM is set from the CMake configuration option

Definition at line 111 of file otbStreamingImageVirtualWriter.hxx.

References otb::StreamingImageVirtualWriter< TInputImage >::m_StreamingManager.

◆ SetNumberOfDivisionsStrippedStreaming()

template<class TInputImage >
void otb::StreamingImageVirtualWriter< TInputImage >::SetNumberOfDivisionsStrippedStreaming ( unsigned int  nbDivisions)

Set the streaming mode to 'stripped' and configure the number of strips which will be used to stream the image

Definition at line 61 of file otbStreamingImageVirtualWriter.hxx.

References otb::StreamingImageVirtualWriter< TInputImage >::m_StreamingManager.

◆ SetNumberOfDivisionsTiledStreaming()

template<class TInputImage >
void otb::StreamingImageVirtualWriter< TInputImage >::SetNumberOfDivisionsTiledStreaming ( unsigned int  nbDivisions)

Set the streaming mode to 'tiled' and configure the number of tiles which will be used to stream the image

Definition at line 71 of file otbStreamingImageVirtualWriter.hxx.

References otb::StreamingImageVirtualWriter< TInputImage >::m_StreamingManager.

◆ SetNumberOfLinesStrippedStreaming()

template<class TInputImage >
void otb::StreamingImageVirtualWriter< TInputImage >::SetNumberOfLinesStrippedStreaming ( unsigned int  nbLinesPerStrip)

Set the streaming mode to 'stripped' and configure the number of strips which will be used to stream the image

Definition at line 81 of file otbStreamingImageVirtualWriter.hxx.

References otb::StreamingImageVirtualWriter< TInputImage >::m_StreamingManager.

◆ SetStreamingManager()

template<class TInputImage >
void otb::StreamingImageVirtualWriter< TInputImage >::SetStreamingManager ( StreamingManagerType streamingManager)
inline

Set a user-specific implementation of StreamingManager used to divide the largest possible region in several divisions

Definition at line 97 of file otbStreamingImageVirtualWriter.h.

◆ SetTileDimensionTiledStreaming()

template<class TInputImage >
void otb::StreamingImageVirtualWriter< TInputImage >::SetTileDimensionTiledStreaming ( unsigned int  tileDimension)

Set the streaming mode to 'tiled' and configure the dimension of the tiles in pixels for each dimension (square tiles will be generated)

Definition at line 101 of file otbStreamingImageVirtualWriter.hxx.

References otb::StreamingImageVirtualWriter< TInputImage >::m_StreamingManager.

◆ Update()

template<class TInputImage >
void otb::StreamingImageVirtualWriter< TInputImage >::Update ( void  )
override

Override Update() from ProcessObject This filter does not produce an output

Definition at line 131 of file otbStreamingImageVirtualWriter.hxx.

References otb::StreamingImageVirtualWriter< TInputImage >::GenerateData().

◆ UpdateFilterProgress()

template<class TInputImage >
void otb::StreamingImageVirtualWriter< TInputImage >::UpdateFilterProgress ( )
inlineprivate

Member Data Documentation

◆ InputImageDimension

template<class TInputImage >
const unsigned int otb::StreamingImageVirtualWriter< TInputImage >::InputImageDimension = InputImageType::ImageDimension
static

Dimension of input image.

Definition at line 86 of file otbStreamingImageVirtualWriter.h.

◆ m_CurrentDivision

template<class TInputImage >
unsigned int otb::StreamingImageVirtualWriter< TInputImage >::m_CurrentDivision
private

◆ m_DivisionProgress

template<class TInputImage >
float otb::StreamingImageVirtualWriter< TInputImage >::m_DivisionProgress
private

◆ m_IsObserving

template<class TInputImage >
bool otb::StreamingImageVirtualWriter< TInputImage >::m_IsObserving
private

◆ m_Lock

template<class TInputImage >
itk::SimpleFastMutexLock otb::StreamingImageVirtualWriter< TInputImage >::m_Lock
private

Lock to ensure thread-safety (added for the AbortGenerateData flag)

Definition at line 196 of file otbStreamingImageVirtualWriter.h.

Referenced by otb::StreamingImageVirtualWriter< TInputImage >::GetAbortGenerateData(), and otb::StreamingImageVirtualWriter< TInputImage >::SetAbortGenerateData().

◆ m_NumberOfDivisions

template<class TInputImage >
unsigned int otb::StreamingImageVirtualWriter< TInputImage >::m_NumberOfDivisions
private

◆ m_ObserverID

template<class TInputImage >
unsigned long otb::StreamingImageVirtualWriter< TInputImage >::m_ObserverID
private

◆ m_StreamingManager

template<class TInputImage >
StreamingManagerPointerType otb::StreamingImageVirtualWriter< TInputImage >::m_StreamingManager
private

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