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

This is the image handler for providing mask pixels to an ossimMaskFilter object. More...

#include <ossimBitMaskTileSource.h>

Inheritance diagram for ossimBitMaskTileSource:
ossimImageHandler ossimImageSource ossimSource ossimConnectableObject ossimErrorStatusInterface ossimObject ossimListenerManager ossimPropertyInterface ossimReferenced

Public Member Functions

 ossimBitMaskTileSource ()
 
virtual ossimRefPtr< ossimImageDatagetTile (const ossimIrect &tile_rect, ossim_uint32 rLevel=0)
 Return a tile of masks. More...
 
virtual bool isValidRLevel (ossim_uint32 res_level) const
 Determines if the passed in reslution level is valid. More...
 
virtual ossim_uint32 getNumberOfLines (ossim_uint32 res_level=0) const
 Pure virtual, derived classes must implement. More...
 
virtual ossim_uint32 getNumberOfSamples (ossim_uint32 res_level=0) const
 Pure virtual, derived classes must implement. More...
 
virtual ossim_uint32 getNumberOfInputBands () const
 
virtual ossim_uint32 getNumberOfOutputBands () const
 Returns the number of bands in a tile returned from this TileSource. More...
 
virtual ossimScalarType getOutputScalarType () const
 This will be used to query the output pixel type of the tile source. More...
 
virtual ossim_uint32 getImageTileWidth () const
 Returns the tile width of the image or 0 if the image is not tiled. More...
 
virtual ossim_uint32 getImageTileHeight () const
 Returns the tile width of the image or 0 if the image is not tiled. More...
 
virtual bool isOpen () const
 Derived classes must implement this method to be concrete. More...
 
virtual bool open ()
 Pure virtual open. More...
 
virtual void close ()
 Deletes the overview and clears the valid image vertices. More...
 
virtual double getNullPixelValue (ossim_uint32) const
 Each band has a null pixel associated with it. More...
 
virtual double getMinPixelValue (ossim_uint32) const
 Retuns the min pixel value. More...
 
virtual double getMaxPixelValue (ossim_uint32) const
 Returns the max pixel of the band. More...
 
virtual ossimRefPtr< ossimImageGeometrygetImageGeometry ()
 There is no geometry associated with a mask file – it is pixel-for-pixel mapped to an image file. More...
 
virtual ossim_uint32 getNumberOfDecimationLevels () const
 Overrides base class implementation. More...
 
void setAssociatedImageHandler (ossimImageHandler *handler)
 For backward compatibility with older mask format ("Ming Mask"), provide for associating the mask with an image handler: More...
 
void setAssociatedMaskWriter (ossimBitMaskWriter *maskWriter)
 This class can be used during overview generation, in which case there will be a simultaneous mask writing. More...
 
- Public Member Functions inherited from ossimImageHandler
 ossimImageHandler ()
 Constructor (default): More...
 
virtual ~ossimImageHandler ()
 Destructor: Derived classes should implement. More...
 
virtual void initialize ()
 initialize Does nothing in this class. More...
 
virtual bool openOverview ()
 Searches for an overview. More...
 
virtual bool openOverview (const ossimFilename &overview_file)
 Calls closeOverview(), then attempts to open the overview_file. More...
 
virtual void closeOverview ()
 If theOverview is initialized it will be deleted and set to NULL. More...
 
virtual const ossimImageHandlergetOverview () const
 
virtual bool hasOverviews () const
 
virtual ossimFilename createDefaultOverviewFilename () const
 
virtual ossimFilename createDefaultGeometryFilename () const
 
virtual ossimFilename createDefaultMetadataFilename () const
 
virtual ossimFilename createDefaultHistogramFilename () const
 
virtual ossimFilename createDefaultValidVerticesFilename () const
 
virtual bool writeValidImageVertices (const std::vector< ossimIpt > &vertices, const ossimFilename &file=ossimFilename(""))
 Outputs vertices to file and updates the internal vertex array variable "theValidImageVertices". More...
 
virtual bool openValidVertices (const ossimFilename &vertices_file)
 Opens the valid image vertices file and sets theValidImageVerticesFile variable. More...
 
virtual bool openValidVertices ()
 Creates vertices file name based on image, then tries to open. More...
 
virtual bool open (const ossimFilename &imageFile, ossim_uint32 entryIndex)
 Opens the image file. More...
 
virtual bool open (const ossimFilename &imageFile)
 
virtual bool open (std::shared_ptr< ossim::ImageHandlerState > state)
 
virtual bool buildHistogram (int numberOfRLevels=0, ossimHistogramMode mode=OSSIM_HISTO_MODE_NORMAL)
 Build a histogram for image file. More...
 
virtual bool buildAllHistograms (int numberOfRLevels=0, ossimHistogramMode mode=OSSIM_HISTO_MODE_NORMAL)
 Build a histograms for all image entries. More...
 
virtual bool buildOverview (ossimImageHandlerOverviewCompressionType compressionType=OSSIM_OVERVIEW_COMPRESSION_NONE, ossim_uint32 quality=75, ossimFilterResampler::ossimFilterResamplerType resampleType=ossimFilterResampler::ossimFilterResampler_BOX, bool includeFullResFlag=false)
 Will build over file for theImageFile. More...
 
virtual bool buildAllOverviews (ossimImageHandlerOverviewCompressionType compressionType=OSSIM_OVERVIEW_COMPRESSION_NONE, ossim_uint32 quality=75, ossimFilterResampler::ossimFilterResamplerType resampleType=ossimFilterResampler::ossimFilterResampler_BOX, bool includeFullResFlag=false)
 Will build over file for all image entries. More...
 
virtual bool buildOverview (const ossimFilename &filename, ossimImageHandlerOverviewCompressionType compressionType=OSSIM_OVERVIEW_COMPRESSION_NONE, ossim_uint32 quality=75, ossimFilterResampler::ossimFilterResamplerType resampleType=ossimFilterResampler::ossimFilterResampler_BOX, bool includeFullResFlag=false)
 Will build an over file for filename. More...
 
ossimRefPtr< ossimMultiResLevelHistogramgetImageHistogram () const
 Fetches the current entry image's histogram. More...
 
virtual void setImageGeometry (ossimImageGeometry *geom)
 Sets the image geometry object. More...
 
virtual void saveImageGeometry () const
 Saves the image geometry to a file that will be made based on the image file name. More...
 
virtual void saveImageGeometry (const ossimFilename &geometry_file) const
 Saves the image geometry to a file that will be made based on the image file name. More...
 
virtual ossimIrect getImageRectangle (ossim_uint32 resLevel=0) const
 Returns zero-based bounding rectangle of the image. More...
 
virtual ossimIrect getBoundingRect (ossim_uint32 resLevel=0) const
 Returns zero-based bounding rectangle of the image. More...
 
virtual void getDecimationFactor (ossim_uint32 resLevel, ossimDpt &result) const
 
virtual void getDecimationFactors (vector< ossimDpt > &decimations) const
 This returns all decimation for all levels. More...
 
virtual ossim_uint32 getNumberOfReducedResSets () const
 This method is obsolete. More...
 
virtual void setFilename (const ossimFilename &filename)
 Sets the filename. More...
 
virtual const ossimFilenamegetFilename () const
 Returns the filename. More...
 
virtual bool saveState (ossimKeywordlist &kwl, const char *prefix=0) const
 Method to save the state of an object to a keyword list. More...
 
virtual bool loadState (const ossimKeywordlist &kwl, const char *prefix=0)
 Method to the load (recreate) the state of an object from a keyword list. More...
 
bool canConnectMyInputTo (ossim_int32 inputIndex, const ossimConnectableObject *object) const
 Connection rule. More...
 
virtual void getValidImageVertices (vector< ossimIpt > &validVertices, ossimVertexOrdering ordering=OSSIM_CLOCKWISE_ORDER, ossim_uint32 resLevel=0) const
 ordering specifies how the vertices should be arranged. More...
 
virtual bool isBandSelector () const
 Indicates whether or not the image handler can control output band selection via the setOutputBandList method. More...
 
virtual bool setOutputBandList (const std::vector< ossim_uint32 > &band_list)
 If the image handler "isBandSeletor()" then the band selection of the output chip can be controlled. More...
 
virtual bool setOutputToInputBandList ()
 If the image handler "isBandSeletor()" then the band selection of the output are set to input or identity. More...
 
virtual bool isIdentityBandList (const std::vector< ossim_uint32 > &bandList) const
 Convenience method to see if band list is identity. More...
 
virtual bool isImageTiled () const
 Indicates whether or not the image is tiled internally. More...
 
virtual bool hasMetaData () const
 
virtual ossimRefPtr< ossimNBandLutDataObjectgetLut () const
 
virtual bool hasLut () const
 
virtual void loadMetaData ()
 There is an external file with an omd extension. More...
 
virtual void setMinPixelValue (ossim_uint32 band, const ossim_float64 &pix)
 convenience method to set min pixel value. More...
 
virtual void setMaxPixelValue (ossim_uint32 band, const ossim_float64 &pix)
 convenience method to set max pixel value. More...
 
virtual void setNullPixelValue (ossim_uint32 band, const ossim_float64 &pix)
 convenience method to set null pixel value. More...
 
virtual ossim_uint32 getCurrentEntry () const
 
virtual ossim_uint32 getNumberOfEntries () const
 
virtual void getEntryName (ossim_uint32 entryIdx, std::string &name) const
 Get the name of entry as a string. More...
 
virtual void getEntryList (std::vector< ossim_uint32 > &entryList) const
 
virtual void getEntryNames (std::vector< ossimString > &entryNames) const
 
bool useEntryIndex () const
 Convenience method to determine if entry index should be used for support files, e.g. More...
 
ossimFilename getOverviewFile () const
 
virtual bool setCurrentEntry (ossim_uint32 entryIdx)
 
virtual void setProperty (ossimRefPtr< ossimProperty > property)
 
virtual ossimRefPtr< ossimPropertygetProperty (const ossimString &name) const
 
virtual void getPropertyNames (std::vector< ossimString > &propertyNames) const
 
ossimFilename getFilenameWithThisExtension (const ossimString &ext, bool set_e0_prefix=false) const
 Returns the image file with extension set using supplentary directory for dirname if set. More...
 
void getFilenameWithThisExt (const ossimString &ext, ossimFilename &f) const
 Returns the image file with extension set using supplentary directory for dirname if set. More...
 
ossim_uint32 getStartingResLevel () const
 
void setStartingResLevel (ossim_uint32 level)
 
bool getOpenOverviewFlag () const
 
void setOpenOverviewFlag (bool flag)
 Sets theOpenOverviewFlag. More...
 
virtual void setSupplementaryDirectory (const ossimFilename &dir)
 Sets the supplementary directory. More...
 
virtual const ossimFilenamegetSupplementaryDirectory () const
 Returns the supplementary directory. More...
 
const ossimStringgetImageID () const
 Fetches the image ID. More...
 
void setImageID (const ossimString &id)
 Sets the image ID in case it is externally generated. More...
 
ossimPixelType getPixelType () const
 Returns the raster pixel alignment type. More...
 
virtual bool getRgbBandList (std::vector< ossim_uint32 > &bandList) const
 Convenience method to get the zero based rgb output band list. More...
 
template<class T >
std::shared_ptr< T > getStateAs ()
 
template<class T >
std::shared_ptr< const T > getStateAs () const
 
std::shared_ptr< ossim::ImageHandlerState > getState ()
 
std::shared_ptr< const ossim::ImageHandlerState > getState () const
 
void setState (std::shared_ptr< ossim::ImageHandlerState > state)
 
- Public Member Functions inherited from ossimImageSource
 ossimImageSource (ossimObject *owner=0)
 
 ossimImageSource (ossimObject *owner, ossim_uint32 inputListSize, ossim_uint32 outputListSize, bool inputListIsFixedFlag=true, bool outputListIsFixedFlag=true)
 
virtual ~ossimImageSource ()
 
virtual ossimRefPtr< ossimImageDatagetTile (const ossimIpt &origin, ossim_uint32 resLevel=0)
 
virtual bool getTile (ossimImageData *result, ossim_uint32 resLevel=0)
 Method to get a tile. More...
 
virtual ossimObjectgetObject ()
 For RTTI support. More...
 
virtual const ossimObjectgetObject () const
 For RTTI support. More...
 
virtual void getDecimationFactors (std::vector< ossimDpt > &decimations) const
 Will return an array of all decimations for each resolution level. More...
 
virtual void getOutputBandList (std::vector< ossim_uint32 > &bandList) const
 Initializes bandList. More...
 
virtual ossim_uint32 getTileWidth () const
 Returns the default processing tile width. More...
 
virtual ossim_uint32 getTileHeight () const
 Returns the default processing tile height. More...
 
virtual void getBoundingRect (ossimIrect &rect, ossim_uint32 resLevel=0) const
 Gets the bounding rectangle of the source. More...
 
virtual void getValidImageVertices (std::vector< ossimIpt > &validVertices, ossimVertexOrdering ordering=OSSIM_CLOCKWISE_ORDER, ossim_uint32 resLevel=0) const
 ordering specifies how the vertices should be arranged. More...
 
virtual void setImageGeometry (const ossimImageGeometry *geom)
 Default implementation sets geometry of the first input to the geometry specified. More...
 
virtual bool isIndexedData () const
 
- Public Member Functions inherited from ossimSource
 ossimSource (ossimObject *owner=0)
 
 ossimSource (ossimObject *owner, ossim_uint32 inputListSize, ossim_uint32 outputListSize, bool inputListIsFixedFlag=true, bool outputListIsFixedFlag=true)
 
virtual ~ossimSource ()
 
virtual bool isSourceEnabled () const
 
virtual void enableSource ()
 
virtual void disableSource ()
 
virtual bool getEnableFlag () const
 
virtual void setEnableFlag (bool flag)
 
virtual bool isInitialized () const
 
virtual void setInitializedFlag (bool flag)
 
virtual std::ostream & print (std::ostream &out) const
 Outputs theErrorStatus as an ossimErrorCode and an ossimString. More...
 
- Public Member Functions inherited from ossimConnectableObject
 ossimConnectableObject (ossimObject *owner=0)
 Base constructor of this object. More...
 
 ossimConnectableObject (ossimObject *owner, ossim_int32 inputListSize, ossim_int32 outputListSize, bool inputListIsFixedFlag=true, bool outputListIsFixedFlag=true)
 
virtual ~ossimConnectableObject ()
 
void setId (const ossimId &id)
 All connectable objects will have id's. More...
 
const ossimIdgetId () const
 Will allow us to get this object's id. More...
 
const ossimObjectgetOwner () const
 Fetches the current owner, most likely a container but not limited to one. More...
 
virtual void changeOwner (ossimObject *owner)
 Permits changing the object's owner. More...
 
virtual void setDescription (const ossimString &description)
 
virtual ossimString getDescription () const
 
virtual bool isConnected (ossimConnectableObjectDirectionType direction=CONNECTABLE_DIRECTION_INPUT) const
 will check the direction specified to see if all slots are full. More...
 
 OSSIM_DEPRECATE_METHOD (virtual ossimConnectableObject *findConnectableObject(const ossimId &id))
 
 OSSIM_DEPRECATE_METHOD (virtual ossimConnectableObject *findObjectOfType(RTTItypeid typeId, ossimConnectableObjectDirectionType directionType, bool recurse=true))
 
 OSSIM_DEPRECATE_METHOD (virtual ossimConnectableObject *findObjectOfType(const ossimString &obj, ossimConnectableObjectDirectionType directionType, bool recurse=true))
 
 OSSIM_DEPRECATE_METHOD (virtual ossimConnectableObject *findInputObjectOfType(const ossimString &className))
 
virtual ossim_int32 findInputIndex (const ossimConnectableObject *object)
 Return a valid index of the input list if the passed in object is found else return -1. More...
 
virtual ossim_int32 findInputIndex (const ossimId &id)
 Return a valid index of the input list if the passed id is found else return -1. More...
 
virtual ossim_int32 findOutputIndex (const ossimConnectableObject *object)
 Return a valid index of the output list if the passed in object is found else return -1. More...
 
virtual ossim_int32 findOutputIndex (const ossimId &id)
 Return a valid index of the output list if the passed in object is found else return -1. More...
 
virtual ossim_int32 getMyInputIndexToConnectTo (ossimConnectableObject *object) const
 Should return the first available index to connect to. More...
 
virtual ossim_int32 getMyOutputIndexToConnectTo (ossimConnectableObject *object) const
 Should return the first available index to connect to. More...
 
virtual bool canConnectMyOutputTo (ossim_int32 myOutputIndex, const ossimConnectableObject *object) const
 default implementation is to allow anyone to connect to us. More...
 
virtual void disconnect (ossimConnectableObject *object=0)
 Will disconnect the object passed in. More...
 
virtual void disconnect (const ossimId &id)
 Will disconnect the object passed in. More...
 
virtual ossimRefPtr< ossimConnectableObjectdisconnectMyInput (ossim_int32 inputIndex, bool disconnectOutputFlag=true, bool createEventFlag=true)
 Will disconnect the object at the given input index and generate a connection event. More...
 
virtual void disconnectMyInput (ossimConnectableObject *input, bool disconnectOutputFlag=true, bool createEventFlag=true)
 Finds the index of the passed in input and calls disconnectMyInput(inputIndex, disconnectOutputFlag, createEventFlag);. More...
 
virtual void disconnectMyInputs (ConnectableObjectList &inputList, bool disconnectOutputFlag=true, bool createEventFlag=true)
 
virtual ossimRefPtr< ossimConnectableObjectdisconnectMyOutput (ossim_int32 outputIndex, bool disconnectInputFlag=true, bool createEventFlag=true)
 Will disconnect the object at the given output index and generate a connection event. More...
 
virtual void disconnectMyOutput (ossimConnectableObject *output, bool disconnectInputFlag=true, bool createEventFlag=true)
 Will disconnect the output object. More...
 
virtual void disconnectMyOutputs (ConnectableObjectList &outputList, bool disconnectOutputFlag=true, bool createEventFlag=true)
 
virtual void disconnectAllInputs ()
 Will disconnect all of the input objects. More...
 
virtual void disconnectAllOutputs ()
 Will disconnect all of the output objects. More...
 
virtual ossim_int32 connectMyInputTo (ossimConnectableObject *inputObject, bool makeOutputConnection=true, bool createEventFlag=true)
 Will try to connect this objects input to the passed in object. More...
 
virtual ossim_int32 connectMyInputTo (ossim_int32 inputIndex, ossimConnectableObject *inputObject, bool makeOutputConnection=true, bool createEventFlag=true)
 Will connect the specified input to the passed in object. More...
 
virtual bool connectMyInputTo (ConnectableObjectList &inputList, bool makeOutputConnection=true, bool createEventFlag=true)
 
virtual ossim_int32 connectMyOutputTo (ossimConnectableObject *outputObject, bool makeInputConnection=true, bool createEventFlag=true)
 Will try to connect this objects output to the passed in object. More...
 
virtual bool connectMyOutputTo (ConnectableObjectList &outputList, bool makeInputConnection=true, bool createEventFlag=true)
 
virtual bool connectInputList (ConnectableObjectList &inputList)
 Will disconnect itself from all inputs and reset to the passed in input list. More...
 
virtual bool connectOutputList (ConnectableObjectList &outputList)
 Will disconnect itself from all outputs and reset to the passed in output list. More...
 
virtual ossim_uint32 getNumberOfInputs () const
 Returns the number of input objects. More...
 
virtual ossim_uint32 getNumberOfOutputs () const
 Return the number of output objects. More...
 
ossimConnectableObjectgetInput (ossim_uint32 index=0)
 returns the object at the specified index. More...
 
const ossimConnectableObjectgetInput (ossim_uint32 index=0) const
 returns the object at the specified index. More...
 
ossimConnectableObjectgetOutput (ossim_uint32 index=0)
 returns the object at the specified index. More...
 
const ossimConnectableObjectgetOutput (ossim_uint32 index=0) const
 returns the object at the specified index. More...
 
virtual void setNumberOfInputs (ossim_int32 numberOfInputs)
 Will set the number of inputs. More...
 
virtual bool getInputListIsFixedFlag () const
 
virtual bool getOutputListIsFixedFlag () const
 
virtual void setNumberOfOutputs (ossim_int32 numberOfInputs)
 Will set the number of outputs. More...
 
const ConnectableObjectListgetInputList () const
 
const ConnectableObjectListgetOutputList () const
 
ConnectableObjectListgetInputList ()
 
ConnectableObjectListgetOutputList ()
 
 OSSIM_DEPRECATE_METHOD (virtual void findAllObjectsOfType(ConnectableObjectList &result, const RTTItypeid &typeInfo, bool recurse=true))
 
 OSSIM_DEPRECATE_METHOD (virtual void findAllObjectsOfType(ConnectableObjectList &result, const ossimString &className, bool recurse=true))
 
virtual void propagateEventToOutputs (ossimEvent &event)
 
virtual void propagateEventToInputs (ossimEvent &event)
 
virtual void setProperty (const ossimString &name, const ossimString &value)
 
virtual ossim_uint32 saveStateOfAllInputs (ossimKeywordlist &kwl, bool saveThisStateFlag=true, ossim_uint32 objectIndex=1, const char *prefix=0) const
 Save the state of all inputs to a keyword list. More...
 
virtual bool fillContainer (ossimConnectableContainer &container)
 Inserts this object and all of its children and inputs into the container provided. More...
 
bool moveInputUp (const ossimId &id)
 Moves the input connection matching id up one in the connection list. More...
 
bool moveInputDown (const ossimId &id)
 Moves the input connection matching id down one in the connection list. More...
 
bool moveInputToTop (const ossimId &id)
 Moves the input connection matching id to the top of the connection list. More...
 
bool moveInputToBottom (const ossimId &id)
 Moves the input connection matching id to the bottom of the connection list. More...
 
virtual void accept (ossimVisitor &visitor)
 We will add a visitor interface for all connectable objects. More...
 
- Public Member Functions inherited from ossimObject
 ossimObject ()
 
virtual ~ossimObject ()
 
virtual ossimObjectdup () const
 
virtual ossimString getShortName () const
 
virtual ossimString getLongName () const
 
virtual ossimString getClassName () const
 
virtual RTTItypeid getType () const
 
virtual bool canCastTo (ossimObject *obj) const
 
virtual bool canCastTo (const RTTItypeid &id) const
 
virtual bool canCastTo (const ossimString &parentClassName) const
 
virtual bool isEqualTo (const ossimObject &obj, ossimCompareType compareType=OSSIM_COMPARE_FULL) const
 
- 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 ossimListenerManager
 ossimListenerManager ()
 
virtual ~ossimListenerManager ()
 
virtual void fireEvent (ossimEvent &event)
 
virtual bool addListener (ossimListener *listener)
 
virtual bool removeListener (ossimListener *listener)
 
virtual bool findListener (ossimListener *listener)
 
- Public Member Functions inherited from ossimPropertyInterface
 ossimPropertyInterface ()
 
virtual ~ossimPropertyInterface ()
 
virtual ossimString getPropertyValueAsString (const ossimString &name) const
 
void getPropertyList (std::vector< ossimRefPtr< ossimProperty > > &propertyList) const
 
void setProperties (std::vector< ossimRefPtr< ossimProperty > > &propertyList)
 
- 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
 

Protected Member Functions

virtual ~ossimBitMaskTileSource ()
 
bool isSupportedExtension ()
 Returns true if this handler recognizes the file name extension as an OSSIM raster mask file. More...
 
virtual void establishDecimationFactors ()
 Overrides base class implementation. More...
 
- Protected Member Functions inherited from ossimImageHandler
virtual ossimRefPtr< ossimImageGeometrygetExternalImageGeometry () const
 Returns the image geometry object associated with this tile source or NULL if non defined. More...
 
virtual ossimRefPtr< ossimImageGeometrygetInternalImageGeometry () const
 
virtual bool getOverviewTile (ossim_uint32 resLevel, ossimImageData *result)
 Method to get an overview tile. More...
 
bool initVertices (const char *file)
 Opens file and attempts to initialize the valid image vertices. More...
 
virtual void completeOpen ()
 Will complete the opening process. More...
 
void initImageParameters (ossimImageGeometry *geom) const
 Convenience method to set things needed in the image geometry from the image handler. More...
 
virtual bool setOutputBandList (const std::vector< ossim_uint32 > &inBandList, std::vector< ossim_uint32 > &outBandList)
 Convenience method to set output band list. More...
 
void getFilenameWithNoExtension (ossimFilename &f) const
 Get filename with no extension, using supplentary directory for dirname if set. More...
 
- Protected Member Functions inherited from ossimImageSource
 ossimImageSource (const ossimImageSource &rhs)
 
const ossimImageSourceoperator= (const ossimImageSource &)
 
- Protected Member Functions inherited from ossimSource
 ossimSource (const ossimSource &rhs)
 
const ossimSourceoperator= (const ossimSource &rhs)
 
- Protected Member Functions inherited from ossimConnectableObject
ossimConnectableObjectfindObjectOfType (ConnectableObjectList *connectableList, ossimVisitor &visitor)
 
- Protected Member Functions inherited from ossimReferenced
virtual ~ossimReferenced ()
 
- Protected Member Functions inherited from ossimListenerManager
 ossimListenerManager (const ossimListenerManager &rhs)
 

Protected Attributes

ossimRefPtr< ossimImageDatam_tile
 
vector< ossim_uint8 * > m_buffers
 
vector< ossimIptm_bufferSizes
 
ossimRefPtr< ossimImageHandlerm_handler
 For backward compatibility with older mask format ("Ming Mask"), provide for associating the mask with an image handler: More...
 
ossimRefPtr< ossimBitMaskWriterm_maskWriter
 This class can be used during overview generation, in which case there will be a simultaneous mask writing. More...
 
- Protected Attributes inherited from ossimImageHandler
ossimFilename theImageFile
 
ossimFilename theOverviewFile
 
ossimFilename theSupplementaryDirectory
 
ossimRefPtr< ossimImageHandlertheOverview
 
vector< ossimIpttheValidImageVertices
 
ossimImageMetaData theMetaData
 
ossimRefPtr< ossimImageGeometrytheGeometry
 
ossimRefPtr< ossimNBandLutDataObjecttheLut
 
std::vector< ossimDpttheDecimationFactors
 
ossimString theImageID
 
ossim_uint32 theStartingResLevel
 theStartingResLevel If set to something other than zero(default) this is indicative that the reader is an overview. More...
 
bool theOpenOverviewFlag
 If true opening of overviews will be attempted. More...
 
ossimPixelType thePixelType
 
std::shared_ptr< ossim::ImageHandlerState > m_state
 
- Protected Attributes inherited from ossimSource
bool theEnableFlag
 
bool theInitializedFlag
 
- Protected Attributes inherited from ossimConnectableObject
ossimId theId
 
ossimString theDescription
 
ossimObjecttheOwner
 
bool theInputListIsFixedFlag
 Indicates whether the theInputObjectList is fixed. More...
 
bool theOutputListIsFixedFlag
 Indicates whether the theOutputObjectList is fixed. More...
 
ConnectableObjectList theInputObjectList
 Holds a list of input objects. More...
 
ConnectableObjectList theOutputObjectList
 Holds a list of output objects. More...
 
- Protected Attributes inherited from ossimListenerManager
std::list< ossimListener * > theListenerList
 
bool theEnabledFlag
 
std::list< ossimListener * > theDelayedAdd
 
std::list< ossimListener * > theDelayedRemove
 
bool theFireEventFlag
 
- Protected Attributes inherited from ossimErrorStatusInterface
ossimErrorCode theErrorStatus
 

Additional Inherited Members

- Public Types inherited from ossimImageHandler
enum  ossimImageHandlerOverviewCompressionType {
  OSSIM_OVERVIEW_COMPRESSION_NONE = 0, OSSIM_OVERVIEW_COMPRESSION_JPEG, OSSIM_OVERVIEW_COMPRESSION_LZW, OSSIM_OVERVIEW_COMPRESSION_DEFLATE,
  OSSIM_OVERVIEW_COMPRESSION_PACKBITS
}
 
- Public Types inherited from ossimConnectableObject
enum  ossimConnectableObjectDirectionType { CONNECTABLE_DIRECTION_NONE = 0, CONNECTABLE_DIRECTION_INPUT = 1, CONNECTABLE_DIRECTION_OUTPUT = 2 }
 
typedef std::vector< ossimRefPtr< ossimConnectableObject > > ConnectableObjectList
 

Detailed Description

This is the image handler for providing mask pixels to an ossimMaskFilter object.

This class takes care of reading the custom, bit-compressed OSSIM bit mask file format.

When the developer needs to mask an image, the following needs to be done:

Creating the Mask:

  1. A mask file first needs to be created using ossimBitMaskWriter and a source image. The app "img2rr --create-mask" directs that program to use ossimBitMaskWriter to generate a mask
    during overview generation. There is also create-bitmask app that will generate the mask.
  2. An OSSIM ".mask" file should exist on disk after step 0. This is typically the same base name as the source image file being masked.

Using the Mask:

  1. An ossimBitMaskTileSource (derived from ossimImageHandler) needs to be instantiated and the mask file name used to open it.
  2. An ossimMaskFilter (derived from ossimImageCombiner) is the actual filter that combines the source image handler and the ossimBitMaskTileSource object to provide the resultant masked tiles.

The OSSIM bit mask file contains a small header that consists of: magic number, starting res level, number of res levels num columns at starting res level, num rows at starting res level, num columns at 2nd res level, num rows at 2nd res level, etc., for all res levels <space> <compressed binary="" mask="" data>="">

The number of rows and columns represents the number of bytes in the mask, with each byte containing 8 alpha mask bits representing 8 pixels in the original image.

This class functions as an image handler, returning 255 for unmasked pixels, and 0 for masked pixels.

For debug purposes, this code initializes the tile to all 128's so that the ossimMaskFilter can recognize uninitialized mask data.

Definition at line 64 of file ossimBitMaskTileSource.h.

Constructor & Destructor Documentation

◆ ossimBitMaskTileSource()

ossimBitMaskTileSource::ossimBitMaskTileSource ( )

Definition at line 35 of file ossimBitMaskTileSource.cpp.

36  :
38  m_tile(NULL)
39 {
40 }
ossimRefPtr< ossimImageData > m_tile
ossimImageHandler()
Constructor (default):

◆ ~ossimBitMaskTileSource()

ossimBitMaskTileSource::~ossimBitMaskTileSource ( )
protectedvirtual

Definition at line 45 of file ossimBitMaskTileSource.cpp.

References close().

46 {
47  close();
48 }
virtual void close()
Deletes the overview and clears the valid image vertices.

Member Function Documentation

◆ close()

void ossimBitMaskTileSource::close ( )
virtual

Deletes the overview and clears the valid image vertices.

Derived classes should implement.

Reimplemented from ossimImageHandler.

Definition at line 53 of file ossimBitMaskTileSource.cpp.

References ossimImageHandler::close(), m_buffers, m_bufferSizes, and m_tile.

Referenced by open(), and ~ossimBitMaskTileSource().

54 {
55  ossimImageHandler::close(); // base class
56 
57  // Wipe the mask buffers:
58  vector<ossim_uint8*>::iterator iter = m_buffers.begin();
59  while (iter != m_buffers.end())
60  {
61  delete [] (*iter);
62  iter++;
63  }
64  m_buffers.clear();
65  m_bufferSizes.clear();
66  m_tile = NULL;
67 }
vector< ossimIpt > m_bufferSizes
virtual void close()
Deletes the overview and clears the valid image vertices.
ossimRefPtr< ossimImageData > m_tile
vector< ossim_uint8 * > m_buffers

◆ establishDecimationFactors()

void ossimBitMaskTileSource::establishDecimationFactors ( )
protectedvirtual

Overrides base class implementation.

Reimplemented from ossimImageHandler.

Definition at line 353 of file ossimBitMaskTileSource.cpp.

References m_buffers, and ossimImageHandler::theDecimationFactors.

Referenced by open().

354 {
355  theDecimationFactors.clear();
356  ossim_uint32 num_res_levels = (ossim_uint32) m_buffers.size();
357  ossimDpt decimation(1, 1);
358  for (ossim_uint32 r=0; r<num_res_levels; r++)
359  {
360  theDecimationFactors.push_back(decimation);
361  decimation = decimation/2.0;
362  }
363 }
std::vector< ossimDpt > theDecimationFactors
unsigned int ossim_uint32
vector< ossim_uint8 * > m_buffers

◆ getImageGeometry()

ossimRefPtr< ossimImageGeometry > ossimBitMaskTileSource::getImageGeometry ( )
virtual

There is no geometry associated with a mask file – it is pixel-for-pixel mapped to an image file.

The image file must have the valid geometry.

Reimplemented from ossimImageHandler.

Definition at line 337 of file ossimBitMaskTileSource.cpp.

338 {
339  return 0;
340 }

◆ getImageTileHeight()

virtual ossim_uint32 ossimBitMaskTileSource::getImageTileHeight ( ) const
inlinevirtual

Returns the tile width of the image or 0 if the image is not tiled.

Note: this is not the same as the ossimImageSource::getTileWidth which returns the output tile width which can be different than the internal image tile width on disk.

Implements ossimImageHandler.

Definition at line 82 of file ossimBitMaskTileSource.h.

82 { return 0; }

◆ getImageTileWidth()

virtual ossim_uint32 ossimBitMaskTileSource::getImageTileWidth ( ) const
inlinevirtual

Returns the tile width of the image or 0 if the image is not tiled.

Note: this is not the same as the ossimImageSource::getTileWidth which returns the output tile width which can be different than the internal image tile width on disk.

Implements ossimImageHandler.

Definition at line 81 of file ossimBitMaskTileSource.h.

81 { return 0; }

◆ getMaxPixelValue()

virtual double ossimBitMaskTileSource::getMaxPixelValue ( ossim_uint32  band) const
inlinevirtual

Returns the max pixel of the band.

Reimplemented from ossimImageHandler.

Definition at line 90 of file ossimBitMaskTileSource.h.

90 { return 1.0; }

◆ getMinPixelValue()

virtual double ossimBitMaskTileSource::getMinPixelValue ( ossim_uint32  band) const
inlinevirtual

Retuns the min pixel value.

If there was an external eta data file then use the meta data from that file. If not given then we will return the default min

Reimplemented from ossimImageHandler.

Definition at line 89 of file ossimBitMaskTileSource.h.

89 { return 0; }

◆ getNullPixelValue()

virtual double ossimBitMaskTileSource::getNullPixelValue ( ossim_uint32  band) const
inlinevirtual

Each band has a null pixel associated with it.

The null pixel represents an invalid value.

Reimplemented from ossimImageHandler.

Definition at line 88 of file ossimBitMaskTileSource.h.

88 { return 0; }

◆ getNumberOfDecimationLevels()

ossim_uint32 ossimBitMaskTileSource::getNumberOfDecimationLevels ( ) const
virtual

Overrides base class implementation.

Reimplemented from ossimImageHandler.

Definition at line 345 of file ossimBitMaskTileSource.cpp.

References ossimImageHandler::theDecimationFactors.

346 {
347  return (ossim_uint32) theDecimationFactors.size();
348 }
std::vector< ossimDpt > theDecimationFactors
unsigned int ossim_uint32

◆ getNumberOfInputBands()

virtual ossim_uint32 ossimBitMaskTileSource::getNumberOfInputBands ( ) const
inlinevirtual

Returns the number of bands available from the input.

Implements ossimImageSource.

Definition at line 78 of file ossimBitMaskTileSource.h.

78 { return 1; }

◆ getNumberOfLines()

ossim_uint32 ossimBitMaskTileSource::getNumberOfLines ( ossim_uint32  resLevel = 0) const
virtual

Pure virtual, derived classes must implement.

Parameters
resLevelReduced resolution level to return lines of. Default = 0
Returns
The number of lines for specified reduced resolution level.

Implements ossimImageHandler.

Definition at line 309 of file ossimBitMaskTileSource.cpp.

References isValidRLevel(), m_bufferSizes, ossimBitMaskWriter::m_bufferSizes, m_maskWriter, ossimImageHandler::theStartingResLevel, and ossimRefPtr< T >::valid().

310 {
311  if (!isValidRLevel(res_Level))
312  return 0;
313 
314  if (m_maskWriter.valid())
315  return m_maskWriter->m_bufferSizes[res_Level-theStartingResLevel].y;
316 
317  return m_bufferSizes[res_Level-theStartingResLevel].y;
318 }
vector< ossimIpt > m_bufferSizes
bool valid() const
Definition: ossimRefPtr.h:75
vector< ossimIpt > m_bufferSizes
ossimRefPtr< ossimBitMaskWriter > m_maskWriter
This class can be used during overview generation, in which case there will be a simultaneous mask wr...
virtual bool isValidRLevel(ossim_uint32 res_level) const
Determines if the passed in reslution level is valid.
ossim_uint32 theStartingResLevel
theStartingResLevel If set to something other than zero(default) this is indicative that the reader i...

◆ getNumberOfOutputBands()

virtual ossim_uint32 ossimBitMaskTileSource::getNumberOfOutputBands ( ) const
inlinevirtual

Returns the number of bands in a tile returned from this TileSource.

Reimplemented from ossimImageSource.

Definition at line 79 of file ossimBitMaskTileSource.h.

79 { return 1; }

◆ getNumberOfSamples()

ossim_uint32 ossimBitMaskTileSource::getNumberOfSamples ( ossim_uint32  resLevel = 0) const
virtual

Pure virtual, derived classes must implement.

Parameters
resLevelReduced resolution level to return samples of. Default = 0
Returns
The number of samples for specified reduced resolution level.

Implements ossimImageHandler.

Definition at line 323 of file ossimBitMaskTileSource.cpp.

References isValidRLevel(), m_bufferSizes, ossimBitMaskWriter::m_bufferSizes, m_maskWriter, n, ossimImageHandler::theStartingResLevel, and ossimRefPtr< T >::valid().

324 {
325  if (!isValidRLevel(res_Level))
326  return 0;
327 
328  ossim_uint32 n = 0;
329  if (m_maskWriter.valid())
331  else
332  n = m_bufferSizes[res_Level-theStartingResLevel].x;
333 
334  return n*8; // 8 pixels represented in one mask byte entry
335 }
vector< ossimIpt > m_bufferSizes
bool valid() const
Definition: ossimRefPtr.h:75
vector< ossimIpt > m_bufferSizes
os2<< "> n<< " > nendobj n
unsigned int ossim_uint32
ossimRefPtr< ossimBitMaskWriter > m_maskWriter
This class can be used during overview generation, in which case there will be a simultaneous mask wr...
virtual bool isValidRLevel(ossim_uint32 res_level) const
Determines if the passed in reslution level is valid.
ossim_uint32 theStartingResLevel
theStartingResLevel If set to something other than zero(default) this is indicative that the reader i...

◆ getOutputScalarType()

virtual ossimScalarType ossimBitMaskTileSource::getOutputScalarType ( ) const
inlinevirtual

This will be used to query the output pixel type of the tile source.

Please ignore the argument. It will soon be removed.

Reimplemented from ossimImageSource.

Definition at line 80 of file ossimBitMaskTileSource.h.

References OSSIM_UINT8.

80 { return OSSIM_UINT8; }
8 bit unsigned integer

◆ getTile()

ossimRefPtr< ossimImageData > ossimBitMaskTileSource::getTile ( const ossimIrect tile_rect,
ossim_uint32  rLevel = 0 
)
virtual

Return a tile of masks.

These are "bit masks", i.e., either 0 (hide) or 1 (show). The pixels' remaining 7 bits are cleared and should not be used.

Reimplemented from ossimImageSource.

Definition at line 198 of file ossimBitMaskTileSource.cpp.

References ossimIrect::completely_within(), ossimImageDataFactory::create(), for(), ossimImageData::getBuf(), ossimImageData::getHeight(), ossimImageHandler::getImageRectangle(), ossimImageData::getWidth(), ossimIrect::height(), ossimImageData::initialize(), ossimImageDataFactory::instance(), isOpen(), ossimSource::isSourceEnabled(), isValidRLevel(), ossimIrect::lr(), m_buffers, ossimBitMaskWriter::m_buffers, m_maskWriter, m_tile, ossimImageData::makeBlank(), ossimImageData::setImageRectangle(), ossimImageData::setWidthHeight(), ossimIrect::size(), ossimImageHandler::theStartingResLevel, ossimIrect::ul(), ossimRefPtr< T >::valid(), ossimImageData::validate(), ossimIrect::width(), x, and y.

200 {
201  static const ossim_uint8 MASK_BITS[] = {0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01};
202 
203  // Allocate the mask tile. This will be 8-bits per pixel (i.e., decompressed):
204  if (!m_tile.valid())
205  {
207  m_tile->initialize();
208  }
209 
210  // Initial screening:
211  if (!(isOpen() && isSourceEnabled() && isValidRLevel(resLevel)))
212  return NULL;
213 
214  // Check if requested rect falls inside valid mask area:
215  if (!getImageRectangle(resLevel).intersects(tile_rect))
216  return NULL;
217 
218  // Check if tile size matches requested size:
219  if ((m_tile->getWidth() != tile_rect.width()) || (m_tile->getHeight() != tile_rect.height()))
220  {
221  m_tile->setWidthHeight(tile_rect.width(), tile_rect.height());
222  m_tile->initialize();
223  }
224  m_tile->setImageRectangle(tile_rect);
225 
226  // Start with blank tile if rect partially intersects defined mask area:
227  ossimIrect image_rect (getImageRectangle(resLevel));
228  if (!tile_rect.completely_within(image_rect))
229  m_tile->makeBlank();
230 
231  //##### START DEBUG CODE #########################
232  // This else if identifies unassigned mask pixels being returned by this method incorrectly.
233  // See ossimMaskFilter::executeMaskFilterSelection() (OLK 2/11)
234  //m_tile->fill(128.0);//###
235  //##### END DEBUG CODE #########################
236 
237  ossimIpt image_size (image_rect.size());
238  ossim_uint32 num_mask_cols = (image_size.x+7)/8;
239  ossim_uint8* tilebuf = (ossim_uint8*) m_tile->getBuf(0);
240  ossim_uint32 tile_index = 0, mask_index = 0, start_bit=0;
241  ossimIpt ul (tile_rect.ul());
242  ossimIpt lr (tile_rect.lr());
243 
244  // Decide if we use our own mask buffer (read from file) or borrow tha active mask writer's
245  // buffer:
246  ossim_uint8* maskbuf;
247  if (m_maskWriter.valid())
248  maskbuf = m_maskWriter->m_buffers[resLevel-theStartingResLevel];
249  else
250  maskbuf = m_buffers[resLevel-theStartingResLevel];
251 
252  // Nested loop to fill tile:
253  for (int y=ul.y; (y<=lr.y)&&(y<image_size.y); y++)
254  {
255  mask_index = y*num_mask_cols + ul.x/8;
256  start_bit = ul.x % 8; // may not start on even mask byte boundary
257  for (int x=ul.x; x<=lr.x;)
258  {
259  if (x < image_size.x)
260  {
261  // fetch mask pixel and isolate bit of interest:
262  for (ossim_uint32 mask_bit=start_bit; mask_bit<8; ++mask_bit)
263  {
264  if (maskbuf[mask_index] & MASK_BITS[mask_bit])
265  tilebuf[tile_index++] = 255;
266  else
267  tilebuf[tile_index++] = 0;
268 
269  // Advance the pixel column and check for end of image rect:
270  ++x;
271  if ((x >= image_size.x) || (x>lr.x))
272  break;
273  }
274 
275  ++mask_index; // advance the mask buffer index 1 after processing 8 tile samples
276  start_bit = 0;
277  }
278  else
279  {
280  // Tile buffer extends beyond valid mask rect, so assume it is masked (0):
281  tilebuf[tile_index++] = 0;
282  ++x;
283  }
284  }
285  }
286 
287  m_tile->validate();
288  return m_tile;
289 }
virtual ossim_uint32 getWidth() const
ossim_uint32 x
virtual bool isSourceEnabled() const
Definition: ossimSource.cpp:79
RTTI_DEF1_INST(ossimGeneralRasterTileSource, "ossimGeneralRasterTileSource", ossimImageHandler) static ossimTrace traceDebug("ossimGeneralRasterTileSource for(ossim_uint32 i=0;i< aList.size();++i)
virtual void setImageRectangle(const ossimIrect &rect)
virtual void setWidthHeight(ossim_uint32 w, ossim_uint32 h)
ossim_uint32 y
bool valid() const
Definition: ossimRefPtr.h:75
ossim_uint32 height() const
Definition: ossimIrect.h:487
const ossimIpt & ul() const
Definition: ossimIrect.h:274
virtual ossim_uint32 getHeight() const
vector< ossim_uint8 * > m_buffers
virtual void initialize()
Initialize the data buffer.
bool completely_within(const ossimIrect &rect) const
Definition: ossimIrect.cpp:425
static ossimImageDataFactory * instance()
virtual ossimDataObjectStatus validate() const
unsigned int ossim_uint32
const ossimIpt & lr() const
Definition: ossimIrect.h:276
virtual ossimIrect getImageRectangle(ossim_uint32 resLevel=0) const
Returns zero-based bounding rectangle of the image.
virtual ossimRefPtr< ossimImageData > create(ossimSource *owner, ossimScalarType scalar, ossim_uint32 bands=1) const
ossim_uint32 width() const
Definition: ossimIrect.h:500
virtual void makeBlank()
Initializes data to null pixel values.
ossimRefPtr< ossimImageData > m_tile
ossimRefPtr< ossimBitMaskWriter > m_maskWriter
This class can be used during overview generation, in which case there will be a simultaneous mask wr...
virtual const void * getBuf() const
virtual bool isOpen() const
Derived classes must implement this method to be concrete.
vector< ossim_uint8 * > m_buffers
virtual bool isValidRLevel(ossim_uint32 res_level) const
Determines if the passed in reslution level is valid.
unsigned char ossim_uint8
ossim_uint32 theStartingResLevel
theStartingResLevel If set to something other than zero(default) this is indicative that the reader i...

◆ isOpen()

bool ossimBitMaskTileSource::isOpen ( ) const
virtual

Derived classes must implement this method to be concrete.

Returns
true if open, false if not.

Implements ossimImageHandler.

Definition at line 178 of file ossimBitMaskTileSource.cpp.

References m_buffers, m_maskWriter, and ossimRefPtr< T >::valid().

Referenced by getTile().

179 {
180  return ((m_buffers.size() != 0) || (m_maskWriter.valid()));
181 }
bool valid() const
Definition: ossimRefPtr.h:75
ossimRefPtr< ossimBitMaskWriter > m_maskWriter
This class can be used during overview generation, in which case there will be a simultaneous mask wr...
vector< ossim_uint8 * > m_buffers

◆ isSupportedExtension()

bool ossimBitMaskTileSource::isSupportedExtension ( )
protected

Returns true if this handler recognizes the file name extension as an OSSIM raster mask file.

Definition at line 186 of file ossimBitMaskTileSource.cpp.

References ossimFilename::ext(), and ossimImageHandler::theImageFile.

Referenced by open().

187 {
188  ossimString ext = theImageFile.ext();
189  if (ext == "mask")
190  return true;
191 
192  return false;
193 }
ossimFilename theImageFile
ossimString ext() const

◆ isValidRLevel()

bool ossimBitMaskTileSource::isValidRLevel ( ossim_uint32  resLevel) const
virtual

Determines if the passed in reslution level is valid.

If this reader is used as an overview the caller should pass in a resLevel relative to the full image.

Parameters
resLevelzero base resolution level.
Returns
true on success, false on error.

Reimplemented from ossimImageHandler.

Definition at line 294 of file ossimBitMaskTileSource.cpp.

References m_buffers, ossimBitMaskWriter::m_buffers, m_maskWriter, ossimImageHandler::theStartingResLevel, and ossimRefPtr< T >::valid().

Referenced by getNumberOfLines(), getNumberOfSamples(), and getTile().

295 {
296  ossim_uint32 num_rlevels;
297  if (m_maskWriter.valid())
298  num_rlevels = (ossim_uint32) m_maskWriter->m_buffers.size();
299  else
300  num_rlevels = (ossim_uint32) m_buffers.size();
301 
302  return ((res_Level >= theStartingResLevel) &&
303  ((res_Level-theStartingResLevel) < num_rlevels));
304 }
bool valid() const
Definition: ossimRefPtr.h:75
vector< ossim_uint8 * > m_buffers
unsigned int ossim_uint32
ossimRefPtr< ossimBitMaskWriter > m_maskWriter
This class can be used during overview generation, in which case there will be a simultaneous mask wr...
vector< ossim_uint8 * > m_buffers
ossim_uint32 theStartingResLevel
theStartingResLevel If set to something other than zero(default) this is indicative that the reader i...

◆ open()

bool ossimBitMaskTileSource::open ( )
virtual

Pure virtual open.

Derived classes must implement.

Returns
Returns true on success, false on error.
Note
This method relies on the data member ossimImageData::theImageFile being set. Callers should do a "setFilename" prior to calling this method or use the ossimImageHandler::open that takes a file name and an entry index.

Implements ossimImageHandler.

Definition at line 72 of file ossimBitMaskTileSource.cpp.

References ossimString::chars(), close(), ossimImageDataFactory::create(), establishDecimationFactors(), ossimImageHandler::getBoundingRect(), ossimImageHandler::getNumberOfDecimationLevels(), ossimImageData::initialize(), ossimImageDataFactory::instance(), isSupportedExtension(), m_buffers, m_bufferSizes, m_handler, m_tile, ossimBitMaskWriter::MASK_FILE_MAGIC_NUMBER, ossimNotify(), ossimNotifyLevel_FATAL, ossimIrect::size(), size, ossimImageHandler::theImageFile, ossimImageHandler::theStartingResLevel, ossimRefPtr< T >::valid(), ossimIpt::x, and ossimIpt::y.

73 {
74  static const char MODULE[] = "ossimBitMaskTileSource::open()";
75 
76  if (!isSupportedExtension())
77  {
78  close();
79  return false;
80  }
81 
82  close();
83 
84  // Open the mask file and verify magic number, read header info as well and verify good values:
85  std::ifstream fileStream(theImageFile.chars(), ios::in|ios::binary);
86  if (!fileStream.good())
87  return false;
88  ossimString magic_number;
89  int num_res_levels = 0;
90  char space;
91  fileStream >> magic_number;
93  {
94  // This is a next-generation mask file with header:
95  fileStream >> theStartingResLevel >> num_res_levels;
96  for (int r=0; r<num_res_levels; r++)
97  {
98  ossimIpt buffer_size;
99  fileStream >> buffer_size.x >> buffer_size.y;
100  m_bufferSizes.push_back(buffer_size);
101  }
102  fileStream >> space;
103  }
104  else
105  {
106  // This is the old headerless "Ming mask" format. Need to query the source image for image size.
107  // This format implies a starting res level of 1:
108  if (!m_handler.valid())
109  {
111  << MODULE << " ERROR:\nInput file <"<<theImageFile<<"> has no header information and "
112  "no valid source image has been provided. Cannot process mask" << std::endl;
113  fileStream.close();
114  close();
115  return false;
116  }
118  num_res_levels = m_handler->getNumberOfDecimationLevels() - 1;
119  fileStream.seekg(0);
120 
121  // Need to compute buffer sizes since they are not available in the mask header:
122  ossimIpt image_size = m_handler->getBoundingRect(1).size();
123  ossimIpt buffer_size ((image_size.x+7)/8, image_size.y);
124  for (int r=0; r<num_res_levels; r++)
125  {
126  m_bufferSizes.push_back(buffer_size);
127  buffer_size.x = (buffer_size.x+1)/2;
128  buffer_size.y = (buffer_size.y+1)/2;
129  }
130  }
131 
132  if (m_bufferSizes.empty())
133  {
135  << MODULE << " ERROR:\nInput file <"<<theImageFile<<"> is not recognized or has invalid "
136  "header information." << std::endl;
137  fileStream.close();
138  close();
139  return false;
140  }
141 
142  // Good to go, Need to now establish sizes for and offsets to each res level:
143  for (int r=0; r<num_res_levels; ++r)
144  {
145  // Allocate buffer for this res level:
147  ossim_uint8* buffer = new ossim_uint8[size];
148  m_buffers.push_back((ossim_uint8*) buffer);
149 
150  // Read from disk:
151  fileStream.read((char*)buffer, size);
152  if (fileStream.fail())
153  {
155  << MODULE << " ERROR:"
156  << "\nError encountered reading mask file <" << theImageFile << ">"<<std::endl;
157  fileStream.close();
158  close();
159  return false;
160  }
161  }
162 
163  fileStream.close();
164 
165  // Allocate the mask tile. This will be 8-bits per pixel (i.e., decompressed):
167  m_tile->initialize();
168 
169  // Computes decimation factors for additional reduced res sets:
171 
172  return true;
173 }
ossimFilename theImageFile
std::basic_ifstream< char > ifstream
Class for char input file streams.
Definition: ossimIosFwd.h:44
bool valid() const
Definition: ossimRefPtr.h:75
static const char * MASK_FILE_MAGIC_NUMBER
ossimRefPtr< ossimImageHandler > m_handler
For backward compatibility with older mask format ("Ming Mask"), provide for associating the mask wit...
bool isSupportedExtension()
Returns true if this handler recognizes the file name extension as an OSSIM raster mask file...
ossimIpt size() const
Definition: ossimIrect.h:510
virtual void initialize()
Initialize the data buffer.
virtual ossim_uint32 getNumberOfDecimationLevels() const
This returns the total number of decimation levels.
static ossimImageDataFactory * instance()
vector< ossimIpt > m_bufferSizes
yy_size_t size
virtual void close()
Deletes the overview and clears the valid image vertices.
unsigned int ossim_uint32
const char * chars() const
For backward compatibility.
Definition: ossimString.h:77
virtual ossimRefPtr< ossimImageData > create(ossimSource *owner, ossimScalarType scalar, ossim_uint32 bands=1) const
ossimRefPtr< ossimImageData > m_tile
ossim_int32 y
Definition: ossimIpt.h:142
virtual void establishDecimationFactors()
Overrides base class implementation.
virtual ossimIrect getBoundingRect(ossim_uint32 resLevel=0) const
Returns zero-based bounding rectangle of the image.
ossim_int32 x
Definition: ossimIpt.h:141
vector< ossim_uint8 * > m_buffers
unsigned char ossim_uint8
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
ossim_uint32 theStartingResLevel
theStartingResLevel If set to something other than zero(default) this is indicative that the reader i...

◆ setAssociatedImageHandler()

void ossimBitMaskTileSource::setAssociatedImageHandler ( ossimImageHandler handler)

For backward compatibility with older mask format ("Ming Mask"), provide for associating the mask with an image handler:

Definition at line 381 of file ossimBitMaskTileSource.cpp.

References m_handler.

382 {
383  m_handler = handler;
384 }
ossimRefPtr< ossimImageHandler > m_handler
For backward compatibility with older mask format ("Ming Mask"), provide for associating the mask wit...

◆ setAssociatedMaskWriter()

void ossimBitMaskTileSource::setAssociatedMaskWriter ( ossimBitMaskWriter maskWriter)

This class can be used during overview generation, in which case there will be a simultaneous mask writing.

Instead of accessing a mask file (which may not yet exist), the mask buffer of the writer will be accessed directly instead of our own buffer.

Definition at line 370 of file ossimBitMaskTileSource.cpp.

References m_maskWriter, ossimBitMaskWriter::m_startingResLevel, ossimImageHandler::theStartingResLevel, and ossimRefPtr< T >::valid().

371 {
372  m_maskWriter = maskWriter;
373  if (m_maskWriter.valid())
375 }
ossim_uint32 m_startingResLevel
bool valid() const
Definition: ossimRefPtr.h:75
ossimRefPtr< ossimBitMaskWriter > m_maskWriter
This class can be used during overview generation, in which case there will be a simultaneous mask wr...
ossim_uint32 theStartingResLevel
theStartingResLevel If set to something other than zero(default) this is indicative that the reader i...

Member Data Documentation

◆ m_buffers

vector<ossim_uint8*> ossimBitMaskTileSource::m_buffers
protected

◆ m_bufferSizes

vector<ossimIpt> ossimBitMaskTileSource::m_bufferSizes
protected

Definition at line 118 of file ossimBitMaskTileSource.h.

Referenced by close(), getNumberOfLines(), getNumberOfSamples(), and open().

◆ m_handler

ossimRefPtr<ossimImageHandler> ossimBitMaskTileSource::m_handler
protected

For backward compatibility with older mask format ("Ming Mask"), provide for associating the mask with an image handler:

Definition at line 122 of file ossimBitMaskTileSource.h.

Referenced by open(), and setAssociatedImageHandler().

◆ m_maskWriter

ossimRefPtr<ossimBitMaskWriter> ossimBitMaskTileSource::m_maskWriter
protected

This class can be used during overview generation, in which case there will be a simultaneous mask writing.

Instead of accessing a mask file (which may not yet exist), the mask buffer of the writer will be accessed directly instead of our own buffer.

Definition at line 127 of file ossimBitMaskTileSource.h.

Referenced by getNumberOfLines(), getNumberOfSamples(), getTile(), isOpen(), isValidRLevel(), and setAssociatedMaskWriter().

◆ m_tile

ossimRefPtr<ossimImageData> ossimBitMaskTileSource::m_tile
protected

Definition at line 116 of file ossimBitMaskTileSource.h.

Referenced by close(), getTile(), and open().


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