OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ossimMpiMasterOverviewSequencer Class Reference

#include <ossimMpiMasterOverviewSequencer.h>

Inheritance diagram for ossimMpiMasterOverviewSequencer:
ossimOverviewSequencer ossimReferenced ossimErrorStatusInterface

Public Member Functions

 ossimMpiMasterOverviewSequencer ()
 default constructor More...
 
virtual void initialize ()
 This must be called. More...
 
virtual void setToStartOfSequence ()
 Will set the internal pointers to the upperleft tile number. More...
 
virtual ossimRefPtr< ossimImageDatagetNextTile ()
 Will allow you to get the next tile in the sequence. More...
 
- Public Member Functions inherited from ossimOverviewSequencer
 ossimOverviewSequencer ()
 default constructor More...
 
ossim_uint32 getNumberOfTiles () const
 
ossim_uint32 getNumberOfTilesHorizontal () const
 
ossim_uint32 getNumberOfTilesVertical () const
 
virtual void getOutputImageRectangle (ossimIrect &rect) const
 Gets the zero-based image rectangle for the output reduced resolution data set (rrds). More...
 
void setImageHandler (ossimImageHandler *input)
 Sets the input source or connection. More...
 
void setBitMaskObjects (ossimBitMaskWriter *mask_writer, ossimMaskFilter *mask_filter)
 Enabled the generation of an alpha (bit) mask such that any full or partial null pixels will be masked out. More...
 
void setSourceLevel (ossim_uint32 level)
 Sets the input source resolution to decimate from. More...
 
ossimHistogramMode getHistogramMode () const
 Gets the histogram accumulation mode. More...
 
void setHistogramMode (ossimHistogramMode mode)
 Sets the histogram accumulation mode. More...
 
void writeHistogram ()
 Write histogram method. More...
 
void writeHistogram (const ossimFilename &file)
 Write histogram method that takes a file name. More...
 
virtual void slaveProcessTiles ()
 This implementation does nothing. More...
 
virtual bool isMaster () const
 
ossimIpt getTileSize () const
 
void setTileSize (const ossimIpt &pt)
 updated the tile size. More...
 
void setResampleType (ossimFilterResampler::ossimFilterResamplerType resampleType)
 Sets the resampling type. More...
 
void setScanForMinMax (bool flag)
 Turn on/off scan for min max flag. More...
 
bool getScanForMinMax () const
 
void setScanForMinMaxNull (bool flag)
 Turn on/off scan for min, max, null flag. More...
 
bool getScanForMinMaxNull () const
 
bool writeOmdFile (const std::string &file)
 Writes an ossim metadata(omd) file with min, max, null values. More...
 
- Public Member Functions inherited from ossimReferenced
 ossimReferenced ()
 
 ossimReferenced (const ossimReferenced &)
 
ossimReferencedoperator= (const ossimReferenced &)
 
void ref () const
 increment the reference count by one, indicating that this object has another pointer which is referencing it. More...
 
void unref () const
 decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 
void unref_nodelete () const
 decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 
int referenceCount () const
 
- Public Member Functions inherited from ossimErrorStatusInterface
 ossimErrorStatusInterface ()
 
virtual ~ossimErrorStatusInterface ()
 
virtual ossimErrorCode getErrorStatus () const
 
virtual ossimString getErrorStatusString () const
 
virtual void setErrorStatus (ossimErrorCode error_status) const
 
virtual void setErrorStatus () const
 
virtual void clearErrorStatus () const
 
bool hasError () const
 
virtual std::ostream & print (std::ostream &out) const
 Outputs theErrorStatus as an ossimErrorCode and an ossimString. More...
 

Protected Member Functions

virtual ~ossimMpiMasterOverviewSequencer ()
 virtual destructor More...
 
- Protected Member Functions inherited from ossimOverviewSequencer
virtual ~ossimOverviewSequencer ()
 virtual destructor More...
 
void getInputTileRectangle (ossimIrect &inputRect) const
 Gets the image rectangle for the input tile for theCurrentTileNumber. More...
 
void getOutputTileRectangle (ossimIrect &outputRect) const
 Gets the image rectangle for the output tile for theCurrentTileNumber. More...
 
void updateTileDimensions ()
 Updates theNumberOfTilesHorizontal and theNumberOfTilesVertical. More...
 
void resampleTile (const ossimImageData *inputTile)
 Resamples a patch of data. More...
 
template<class T >
void resampleTile (const ossimImageData *inputTile, T dummy)
 
void clearMinMaxNullArrays ()
 Clears out the arrays from a scan for min, max, nulls. More...
 
- Protected Member Functions inherited from ossimReferenced
virtual ~ossimReferenced ()
 

Protected Attributes

int m_rank
 
int m_numberOfProcessors
 
- Protected Attributes inherited from ossimOverviewSequencer
ossimRefPtr< ossimImageHandlerm_imageHandler
 
ossimRefPtr< ossimBitMaskWriterm_maskWriter
 
ossimRefPtr< ossimMaskFilterm_maskFilter
 
ossimRefPtr< ossimImageDatam_tile
 
ossimIrect m_areaOfInterest
 
ossimIpt m_tileSize
 
ossim_uint32 m_numberOfTilesHorizontal
 
ossim_uint32 m_numberOfTilesVertical
 
ossim_uint32 m_currentTileNumber
 
ossim_uint32 m_sourceResLevel
 This is the resolution level to build overviews from. More...
 
bool m_dirtyFlag
 Dirty flag - if true, this object is not initialized. More...
 
ossim_int32 m_decimationFactor
 TODO make this handle any decimation. More...
 
ossimFilterResampler::ossimFilterResamplerType m_resampleType
 Currently only handles NEAREST_NEIGHBOR and BOX (default = BOX) More...
 
ossimRefPtr< ossimMultiBandHistogramm_histogram
 
ossimHistogramMode m_histoMode
 
ossim_uint32 m_histoTileIndex
 Used to determine which tiles to accumulate a histogram from. More...
 
bool m_scanForMinMax
 Control flags for min, max, null scanning. More...
 
bool m_scanForMinMaxNull
 
std::vector< ossim_float64m_minValues
 Arrays o hold the min value for each band for scan min/max methods. More...
 
std::vector< ossim_float64m_maxValues
 
std::vector< ossim_float64m_nulValues
 
- Protected Attributes inherited from ossimErrorStatusInterface
ossimErrorCode theErrorStatus
 

Detailed Description

Definition at line 24 of file ossimMpiMasterOverviewSequencer.h.

Constructor & Destructor Documentation

◆ ossimMpiMasterOverviewSequencer()

ossimMpiMasterOverviewSequencer::ossimMpiMasterOverviewSequencer ( )

default constructor

Definition at line 21 of file ossimMpiMasterOverviewSequencer.cpp.

References ossimOverviewSequencer::m_currentTileNumber, m_numberOfProcessors, and m_rank.

22  :
24  m_rank(0),
26 {
27 #if OSSIM_HAS_MPI
28  MPI_Comm_rank(MPI_COMM_WORLD, &m_rank);
29  MPI_Comm_size(MPI_COMM_WORLD, &m_numberOfProcessors);
30 #endif
31 
32  //---
33  // Since this is the master sequencer it should always be rank 0; else,
34  // we have a coding error. Since we have the getNextTile implemented to
35  // recieve from the slave processes we always start the tile count at 0.
36  //---
38 }
ossimOverviewSequencer()
default constructor

◆ ~ossimMpiMasterOverviewSequencer()

ossimMpiMasterOverviewSequencer::~ossimMpiMasterOverviewSequencer ( )
protectedvirtual

virtual destructor

Definition at line 40 of file ossimMpiMasterOverviewSequencer.cpp.

41 {
42 }

Member Function Documentation

◆ getNextTile()

ossimRefPtr< ossimImageData > ossimMpiMasterOverviewSequencer::getNextTile ( )
virtual

Will allow you to get the next tile in the sequence.

Note the last tile returned will be an invalid ossimRefPtr<ossimImageData>. Callers should be able to do:

ossimRefPtr<ossimImageData> id = sequencer->getNextTile(); while (id.valid()) { doSomething; id = sequencer->getNextTile(); }

Reimplemented from ossimOverviewSequencer.

Definition at line 54 of file ossimMpiMasterOverviewSequencer.cpp.

References ossim::byteOrder(), ossimImageData::getBuf(), ossimOverviewSequencer::getNextTile(), ossimOverviewSequencer::getNumberOfTiles(), ossimImageSource::getOutputScalarType(), ossimOverviewSequencer::getOutputTileRectangle(), ossimRectilinearDataObject::getScalarType(), ossimImageData::getSize(), ossimImageData::getSizeInBytes(), ossimOverviewSequencer::m_currentTileNumber, ossimOverviewSequencer::m_dirtyFlag, ossimOverviewSequencer::m_imageHandler, m_numberOfProcessors, ossimOverviewSequencer::m_tile, OSSIM_BIG_ENDIAN, OSSIM_UINT8, ossimImageData::setImageRectangle(), ossimEndian::swap(), ossimRefPtr< T >::valid(), and ossimImageData::validate().

55 {
56  if ( m_dirtyFlag )
57  {
58  //---
59  // If this happens we have a coding error. Someone started sequencing
60  // without initializing us properly.
61  //---
63  }
64 
65 #if OSSIM_HAS_MPI
66 
67  //---
68  // Using mpi. The slaves will send us tiles to be returned by this method.
69  // They will alway be sent in big endian (network byte order) so we must
70  // swap back if the scalar type is not 8 bit and the system byte order is
71  // little endian. We will use the endian pointer itself as a flag to swap.
72  //---
73  ossimEndian* endian = 0;
74  if (m_imageHandler.valid())
75  {
77  {
79  {
80  endian = new ossimEndian();
81  }
82  }
83  }
84 
85  int errorValue;
86 
87  // Buffer to receive the data from slaves.
88  void* buf = m_tile->getBuf();
89 
90  // Total number of tiles to process...
91  ossim_uint32 numberOfTiles = getNumberOfTiles();
92 
93  if(m_currentTileNumber >= numberOfTiles)
94  {
96  }
97 
98  errorValue = MPI_Recv(buf,
100  MPI_UNSIGNED_CHAR,
102  0,
103  MPI_COMM_WORLD,
104  MPI_STATUS_IGNORE);
105 
106  // Data always sent in big endian order.
107  if ( endian )
108  {
109  endian->swap(m_tile->getScalarType(), buf, m_tile->getSize());
110  }
111 
112  // Get the output rectangle.
113  ossimIrect outputRect;
114  getOutputTileRectangle(outputRect);
115 
116  // Capture the output rectangle.
117  m_tile->setImageRectangle(outputRect);
118 
119  // Set the tile status.
120  m_tile->validate();
121 
122  // Increment the tile index.
124 
125  // cleanup...
126  if ( endian )
127  {
128  delete endian;
129  endian = 0;
130  }
131 
132  return m_tile;
133 
134 #else
135 
136  // Not compiled with mpi.
138 
139 #endif /* End of #if OSSIM_HAS_MPI */
140 
141 }
virtual void setImageRectangle(const ossimIrect &rect)
bool valid() const
Definition: ossimRefPtr.h:75
ossimRefPtr< ossimImageData > m_tile
ossimRefPtr< ossimImageHandler > m_imageHandler
OSSIM_DLL ossimByteOrder byteOrder()
Definition: ossimCommon.cpp:54
ossim_uint32 getNumberOfTiles() const
bool m_dirtyFlag
Dirty flag - if true, this object is not initialized.
virtual ossim_uint32 getSizeInBytes() const
Returns the total number of bytes for all bands.
virtual ossimDataObjectStatus validate() const
unsigned int ossim_uint32
virtual ossimRefPtr< ossimImageData > getNextTile()
Will allow you to get the next tile in the sequence.
virtual ossimScalarType getScalarType() const
virtual ossimScalarType getOutputScalarType() const
This will be used to query the output pixel type of the tile source.
virtual ossim_uint32 getSize() const
Returns the total number of pixels in a tile for all bands.
virtual const void * getBuf() const
8 bit unsigned integer
void swap(ossim_sint8 &)
Definition: ossimEndian.h:26
void getOutputTileRectangle(ossimIrect &outputRect) const
Gets the image rectangle for the output tile for theCurrentTileNumber.

◆ initialize()

void ossimMpiMasterOverviewSequencer::initialize ( )
virtual

This must be called.

We can only initialize this object completely if we know all connections are valid. Some other object drives this and so the connection's initialize will be called after. The job of this connection is to set up the sequence. It will default to the bounding rect. The area of interest can be set to some other rectagle (use setAreaOfInterest).

Reimplemented from ossimOverviewSequencer.

Definition at line 44 of file ossimMpiMasterOverviewSequencer.cpp.

References ossimOverviewSequencer::initialize().

45 {
47 }
virtual void initialize()
This must be called.

◆ setToStartOfSequence()

void ossimMpiMasterOverviewSequencer::setToStartOfSequence ( )
virtual

Will set the internal pointers to the upperleft tile number.

To go to the next tile in the sequence just call getNextTile.

Reimplemented from ossimOverviewSequencer.

Definition at line 49 of file ossimMpiMasterOverviewSequencer.cpp.

References ossimOverviewSequencer::m_currentTileNumber.

50 {
52 }

Member Data Documentation

◆ m_numberOfProcessors

int ossimMpiMasterOverviewSequencer::m_numberOfProcessors
protected

◆ m_rank

int ossimMpiMasterOverviewSequencer::m_rank
protected

Definition at line 68 of file ossimMpiMasterOverviewSequencer.h.

Referenced by ossimMpiMasterOverviewSequencer().


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