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

#include <ossimH5Reader.h>

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

Public Member Functions

 ossimH5ImageHandler ()
 default constructor More...
 
virtual ~ossimH5ImageHandler ()
 virtual destructor More...
 
virtual ossimString getShortName () const
 
virtual ossimString getLongName () const
 
virtual ossimString getClassName () const
 
virtual ossimRefPtr< ossimImageDatagetTile (const ossimIrect &rect, ossim_uint32 resLevel=0)
 Returns a pointer to a tile given an origin representing the upper left corner of the tile to grab from the image. More...
 
virtual bool getTile (ossimImageData *result, ossim_uint32 resLevel=0)
 Method to get a tile. More...
 
virtual ossim_uint32 getNumberOfInputBands () const
 Returns the number of bands in the image. More...
 
virtual ossim_uint32 getNumberOfOutputBands () const
 Returns the number of bands in a tile returned from this TileSource. More...
 
virtual ossim_uint32 getNumberOfLines (ossim_uint32 reduced_res_level=0) const
 Returns the number of lines in the image. More...
 
virtual ossim_uint32 getNumberOfSamples (ossim_uint32 reduced_res_level=0) const
 Returns the number of samples in the image. More...
 
virtual ossimIrect getImageRectangle (ossim_uint32 reduced_res_level=0) const
 Returns the zero based image rectangle for the reduced resolution data set (rrds) passed in. 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...
 
virtual ossimScalarType getOutputScalarType () const
 Returns 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...
 
bool isOpen () const
 Derived classes must implement this method to be concrete. More...
 
virtual void close ()
 Close method. More...
 
virtual ossim_uint32 getNumberOfEntries () const
 
virtual void getEntryNames (std::vector< ossimString > &entryNames) const
 Get the name of entry as a string. More...
 
virtual void getEntryList (std::vector< ossim_uint32 > &entryList) const
 
virtual bool setCurrentEntry (ossim_uint32 entryIdx)
 
virtual ossim_uint32 getCurrentEntry () const
 
virtual ossimRefPtr< ossimImageGeometrygetImageGeometry ()
 Returns the image geometry object associated with this tile source or NULL if non defined. More...
 
virtual double getNullPixelValue (ossim_uint32 band=0) const
 
virtual void setProperty (ossimRefPtr< ossimProperty > property)
 Set propterty method. More...
 
virtual ossimRefPtr< ossimPropertygetProperty (const ossimString &name) const
 Get propterty method. More...
 
virtual void getPropertyNames (std::vector< ossimString > &propertyNames) const
 Get propterty names. More...
 
virtual void addMetadata (ossimKeywordlist *kwl, const std::string &prefix) const
 Adds metadata to keyword list. 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 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 getNumberOfDecimationLevels () const
 This returns the total number of decimation 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 isValidRLevel (ossim_uint32 resLevel) const
 Determines if the passed in reslution level is valid. 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 double getMinPixelValue (ossim_uint32 band=0) const
 Retuns the min pixel value. More...
 
virtual double getMaxPixelValue (ossim_uint32 band=0) const
 Returns the max pixel of the band. 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 void getEntryName (ossim_uint32 entryIdx, std::string &name) const
 Get the name of entry as a string. More...
 
bool useEntryIndex () const
 Convenience method to determine if entry index should be used for support files, e.g. More...
 
ossimFilename getOverviewFile () 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 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 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
 
- Public Member Functions inherited from ossimMetadataInterface
 ossimMetadataInterface ()
 default constructor More...
 
virtual ~ossimMetadataInterface ()
 virtual destructor. More...
 

Protected Member Functions

virtual ossimRefPtr< ossimImageGeometrygetInternalImageGeometry ()
 Method to get geometry from hdf file. More...
 
ossimRefPtr< ossimProjectionprocessCoarseGridProjection (H5::DataSet &latDataSet, H5::DataSet &lonDataSet, const ossimIrect &validRect) const
 Gets projection from Latitude, Longitude, Height datasets if present. More...
 
bool getLatLonDatasetNames (H5::H5File *h5File, std::string &latName, std::string &lonName) const
 Get dataset names for Latiitude and Longitude datasets. More...
 
bool getLatLonDatasets (H5::H5File *h5File, H5::DataSet &latDataSet, H5::DataSet &lonDataSet) const
 
bool getDataSetRect (std::string &name, std::string &lonName) const
 
virtual bool open ()
 open method. More...
 
void allocate ()
 Allocates the tile. More...
 
void addImageDatasetEntries (const std::vector< std::string > &names)
 Adds image datasets from list of names. More...
 
bool isNppMission (H5::H5File *h5File) const
 
- 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 void establishDecimationFactors ()
 Virtual method determines the decimation factors at each resolution level. 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

H5::H5File * m_h5File
 
std::vector< ossimH5ImageDatasetm_entries
 
ossim_uint32 m_currentEntry
 
ossimRefPtr< ossimImageDatam_tile
 
ossimRefPtr< ossimProjectionm_projection
 
std::mutex m_mutex
 
- 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

Definition at line 35 of file ossimH5Reader.h.

Constructor & Destructor Documentation

◆ ossimH5ImageHandler()

ossimH5ImageHandler::ossimH5ImageHandler ( )

default constructor

Definition at line 61 of file ossimH5Reader.cpp.

62  :
64  m_h5File(0),
65  m_entries(),
66  m_currentEntry(0),
67  m_tile(0),
68  m_projection(0),
69  m_mutex()
70 {
71  // traceDebug.setTraceFlag(true);
72 
73  if (traceDebug())
74  {
76  << "ossimH5Reader::ossimH5Reader entered..." << std::endl;
77 #ifdef OSSIM_ID_ENABLED
79  << "OSSIM_ID: " << OSSIM_ID << endl;
80 #endif
81  }
82 }
ossimRefPtr< ossimImageData > m_tile
ossim_uint32 m_currentEntry
H5::H5File * m_h5File
ossimRefPtr< ossimProjection > m_projection
ossimImageHandler()
Constructor (default):
std::vector< ossimH5ImageDataset > m_entries
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ ~ossimH5ImageHandler()

ossimH5ImageHandler::~ossimH5ImageHandler ( )
virtual

virtual destructor

Definition at line 84 of file ossimH5Reader.cpp.

References close(), and isOpen().

85 {
86  if (isOpen())
87  {
88  close();
89  }
90 }
virtual void close()
Close method.
bool isOpen() const
Derived classes must implement this method to be concrete.

Member Function Documentation

◆ addImageDatasetEntries()

void ossimH5ImageHandler::addImageDatasetEntries ( const std::vector< std::string > &  names)
protected

Adds image datasets from list of names.

Parameters
namesList of dataset paths from hdf5 file.

Definition at line 370 of file ossimH5Reader.cpp.

References ossim_hdf5::getExtents(), ossimH5ImageDataset::initialize(), ossimH5Options::instance(), ossimH5Options::isDatasetRenderable(), m_entries, and m_h5File.

371 {
372  if ( m_h5File && names.size() )
373  {
374  std::vector<std::string>::const_iterator i = names.begin();
375  while ( i != names.end() )
376  {
377  if ( ossimH5Options::instance()->isDatasetRenderable(*i))//ossim_hdf5::isExcludedDataset( *i ) == false )
378  {
379  H5::DataSet dataset = m_h5File->openDataSet( *i );
380 
381  // Get the class of the datatype that is used by the dataset.
382  H5T_class_t type_class = dataset.getTypeClass();
383  if ( ( type_class == H5T_INTEGER ) || ( type_class == H5T_FLOAT ) )
384  {
385  // Get the extents:
386  std::vector<ossim_uint32> extents;
387  ossim_hdf5::getExtents( &dataset, extents );
388  if ( extents.size() >= 2 )
389  {
390  if ( ( extents[0] > 1 ) && ( extents[1] > 1 ) )
391  {
392  ossimH5ImageDataset hids;
393  hids.initialize( dataset, *i );
394  m_entries.push_back( hids );
395  }
396  }
397  }
398 
399  dataset.close();
400  }
401 
402  ++i;
403  }
404  }
405 
406 #if 0 /* Please leave for debug. (drb) */
407  std::vector<ossimH5ImageDataset>::const_iterator i = m_entries.begin();
408  while ( i != m_entries.end() )
409  {
410  std::cout << (*i) << endl;
411  ++i;
412  }
413 #endif
414 
415 } // End: ossimH5Reader::addImageDatasetEntries
static ossimH5Options * instance()
H5::H5File * m_h5File
void getExtents(const H5::DataSet *dataset, std::vector< ossim_uint32 > &extents)
bool isDatasetRenderable(const std::string &datasetName) const
Class encapsulates a HDF5 Data set that can be loaded as an image.
bool initialize(const H5::DataSet &dataset, const std::string &datasetName)
Opens datasetName and initializes all data members on success.
std::vector< ossimH5ImageDataset > m_entries

◆ addMetadata()

void ossimH5ImageHandler::addMetadata ( ossimKeywordlist kwl,
const std::string &  prefix 
) const
virtual

Adds metadata to keyword list.

This will add metadata to keyword list if found. Implemented to pass specific data to keyword list if found, e.g. acquisition_date, sensor_id, country_code

Satisfies pure virtual ossimMetadataInterface::addMetadata(...)

Parameters
kwlInitialized by this.
prefixe.g. "image0." (can be empty)

Implements ossimMetadataInterface.

Definition at line 920 of file ossimH5Reader.cpp.

References ossimKeywordlist::addPair(), ossim_hdf5::getDatasetAttributeValue(), ossim_hdf5::getGroupAttributeValue(), m_h5File, and ossimString::string().

921 {
922  // Note: hdf5 library throws exception if groupd is not found:
923 
924  if ( kwl && m_h5File )
925  {
926  // Look for country code(s): hdf5.CountryCodes: CA,MX,US
927  std::string group = "/";
928  std::string key = "CountryCodes";
929  std::string value;
930 
931  if ( ossim_hdf5::getGroupAttributeValue( m_h5File, group, key, value ) )
932  {
933  key = "country_code";
934  kwl->addPair( prefix, key, value );
935  }
936 
937  // Look for mission id: hdf5.Mission_Name: NPP
938  key = "Mission_Name";
939  if ( ossim_hdf5::getGroupAttributeValue( m_h5File, group, key, value ) )
940  {
941  key = "mission_id";
942  kwl->addPair( prefix, key, value );
943  }
944 
945 
946  //---
947  // Look for sensor type:
948  // hdf5.Data_Products.VIIRS-DNB-SDR.Instrument_Short_Name: VIIRS
949  //---
950  group = "/Data_Products/VIIRS-DNB-SDR";
951  key = "Instrument_Short_Name";
952  if ( ossim_hdf5::getGroupAttributeValue( m_h5File, group, key, value ) )
953  {
954  key = "sensor_id";
955  kwl->addPair( prefix, key, value );
956  }
957 
958  //---
959  // Look for acquisition date:
960  // hdf5.Data_Products.VIIRS-DNB-SDR.VIIRS-DNB-SDR_Aggr.AggregateBeginningDate: 20140113
961  // hdf5.Data_Products.VIIRS-DNB-SDR.VIIRS-DNB-SDR_Aggr.AggregateBeginningTime: 082810.354645Z
962  //---
963  group = "Data_Products/VIIRS-DNB-SDR/VIIRS-DNB-SDR_Aggr";
964  key = "AggregateBeginningDate";
965  if ( ossim_hdf5::getDatasetAttributeValue( m_h5File, group, key, value ) )
966  {
967  std::string time;
968  key = "AggregateBeginningTime";
969  if ( ossim_hdf5::getDatasetAttributeValue( m_h5File, group, key, time ) )
970  {
971  // Only grab yyyymmddmmss in the form ISO 8601: 2014-01-26T10:32:28Z
972  if ( (value.size() >= 8) && ( time.size() >= 6 ) )
973  {
974  std::string dateTime =
975  ossimString( ossimString(value.begin(), value.begin() + 4) + "-"
976  + ossimString(value.begin() + 4, value.begin() + 6) + "-"
977  + ossimString(value.begin() + 6, value.begin() + 8) + "T"
978  + ossimString(time.begin(), time.begin() + 2) + ":"
979  + ossimString(time.begin() + 2, time.begin() + 4) + ":"
980  + ossimString(time.begin() + 4, time.begin() + 6) + "Z" ).string();
981  key = "acquisition_date";
982  kwl->addPair( prefix, key, dateTime );
983  }
984  }
985  }
986  }
987 }
void addPair(const std::string &key, const std::string &value, bool overwrite=true)
bool getDatasetAttributeValue(H5::H5File *file, const std::string &objectName, const std::string &key, std::string &value)
Gets string value for attribute key.
H5::H5File * m_h5File
bool getGroupAttributeValue(H5::H5File *file, const std::string &group, const std::string &key, std::string &value)
Gets string value for attribute key.
const std::string & string() const
Definition: ossimString.h:414

◆ allocate()

void ossimH5ImageHandler::allocate ( )
protected

Allocates the tile.

Definition at line 92 of file ossimH5Reader.cpp.

References ossimImageDataFactory::create(), ossimImageData::initialize(), ossimImageDataFactory::instance(), m_mutex, and m_tile.

Referenced by getTile().

93 {
94  m_mutex.lock();
96  m_tile->initialize();
97  m_mutex.unlock();
98 }
virtual void initialize()
Initialize the data buffer.
static ossimImageDataFactory * instance()
virtual ossimRefPtr< ossimImageData > create(ossimSource *owner, ossimScalarType scalar, ossim_uint32 bands=1) const
ossimRefPtr< ossimImageData > m_tile

◆ close()

void ossimH5ImageHandler::close ( )
virtual

Close method.

Reimplemented from ossimImageHandler.

Definition at line 511 of file ossimH5Reader.cpp.

References ossimImageHandler::close(), m_entries, m_h5File, m_projection, and m_tile.

Referenced by ~ossimH5ImageHandler().

512 {
513  // Close the datasets.
514  m_entries.clear();
515 
516  // Then the file.
517  if ( m_h5File )
518  {
519  m_h5File->close();
520  delete m_h5File;
521  m_h5File = 0;
522  }
523 
524  // ossimRefPtr so assign to 0(unreferencing) will handle memory.
525  m_tile = 0;
526  m_projection = 0;
527 
529 }
virtual void close()
Deletes the overview and clears the valid image vertices.
ossimRefPtr< ossimImageData > m_tile
H5::H5File * m_h5File
ossimRefPtr< ossimProjection > m_projection
std::vector< ossimH5ImageDataset > m_entries

◆ getClassName()

ossimString ossimH5ImageHandler::getClassName ( ) const
virtual
Returns
"ossimH5Reader"

Reimplemented from ossimObject.

Definition at line 469 of file ossimH5Reader.cpp.

470 {
471  return ossimString("ossimH5Reader");
472 }

◆ getCurrentEntry()

ossim_uint32 ossimH5ImageHandler::getCurrentEntry ( ) const
virtual
Returns
The current entry number.

Reimplemented from ossimImageHandler.

Definition at line 602 of file ossimH5Reader.cpp.

References m_currentEntry.

603 {
604  return m_currentEntry;
605 }
ossim_uint32 m_currentEntry

◆ getDataSetRect()

bool ossimH5ImageHandler::getDataSetRect ( std::string &  name,
std::string &  lonName 
) const
protected

◆ getEntryList()

void ossimH5ImageHandler::getEntryList ( std::vector< ossim_uint32 > &  entryList) const
virtual
Parameters
entryListThis is the list to initialize with entry indexes.
Note
This implementation returns puts one entry "0" in the list.

Reimplemented from ossimImageHandler.

Definition at line 545 of file ossimH5Reader.cpp.

References m_entries.

546 {
547  const ossim_uint32 SIZE = m_entries.size();
548  entryList.resize( SIZE );
549  for ( ossim_uint32 i = 0; i < SIZE; ++i )
550  {
551  entryList[i] = i;
552  }
553 }
unsigned int ossim_uint32
std::vector< ossimH5ImageDataset > m_entries

◆ getEntryNames()

void ossimH5ImageHandler::getEntryNames ( std::vector< ossimString > &  entryNames) const
virtual

Get the name of entry as a string.

Example given from HDF5 file:

entry_name: /All_Data/VIIRS-IMG-GTM-EDR-GEO_All/QF1_VIIRSGTMGEO

Parameters
entryIdxZero based entry index. If out of range name will be cleared.
nameInitialized by this.

Reimplemented from ossimImageHandler.

Definition at line 536 of file ossimH5Reader.cpp.

References m_entries.

537 {
538  entryNames.clear();
539  for (ossim_uint32 i=0; i<m_entries.size(); ++i )
540  {
541  entryNames.push_back(m_entries[i].getName());
542  }
543 }
unsigned int ossim_uint32
std::vector< ossimH5ImageDataset > m_entries

◆ getImageGeometry()

ossimRefPtr< ossimImageGeometry > ossimH5ImageHandler::getImageGeometry ( )
virtual

Returns the image geometry object associated with this tile source or NULL if non defined.

The geometry contains full-to-local image transform as well as projection (image-to-world).

Reimplemented from ossimImageHandler.

Definition at line 607 of file ossimH5Reader.cpp.

References ossimImageGeometryRegistry::extendGeometry(), ossimRefPtr< T >::get(), ossimImageHandler::getExternalImageGeometry(), getInternalImageGeometry(), ossimImageGeometry::getProjection(), ossimImageHandler::initImageParameters(), ossimImageGeometryRegistry::instance(), m_mutex, and ossimImageHandler::theGeometry.

608 {
609  if ( !theGeometry )
610  {
611  //---
612  // Check for external geom:
613  //---
615 
616  if ( !theGeometry )
617  {
618  //---
619  // WARNING:
620  // Must create/set the geometry at this point or the next call to
621  // ossimImageGeometryRegistry::extendGeometry will put us in an infinite loop
622  // as it does a recursive call back to ossimImageHandler::getImageGeometry().
623  //---
624 
625  // Check the internal geometry first to avoid a factory call.
626  m_mutex.lock();
628  m_mutex.unlock();
629 
630  // At this point it is assured theGeometry is set.
631 
632  // Check for set projection.
633  if ( !theGeometry->getProjection() )
634  {
635  // Try factories for projection.
637  }
638  }
639 
640  // Set image things the geometry object should know about.
642  }
643 
644  return theGeometry;
645 }
static ossimImageGeometryRegistry * instance()
ossimRefPtr< ossimImageGeometry > theGeometry
virtual bool extendGeometry(ossimImageHandler *handler) const
void initImageParameters(ossimImageGeometry *geom) const
Convenience method to set things needed in the image geometry from the image handler.
virtual ossimRefPtr< ossimImageGeometry > getExternalImageGeometry() const
Returns the image geometry object associated with this tile source or NULL if non defined...
const ossimProjection * getProjection() const
Access methods for projection (may be NULL pointer).
virtual ossimRefPtr< ossimImageGeometry > getInternalImageGeometry()
Method to get geometry from hdf file.

◆ getImageRectangle()

ossimIrect ossimH5ImageHandler::getImageRectangle ( ossim_uint32  reduced_res_level = 0) const
virtual

Returns the zero based image rectangle for the reduced resolution data set (rrds) passed in.

Note that rrds 0 is the highest resolution rrds.

Reimplemented from ossimImageHandler.

Definition at line 222 of file ossimH5Reader.cpp.

References getNumberOfLines(), and getNumberOfSamples().

Referenced by getTile().

223 {
224  return ossimIrect(0,
225  0,
226  getNumberOfSamples(reduced_res_level) - 1,
227  getNumberOfLines(reduced_res_level) - 1);
228 }
virtual ossim_uint32 getNumberOfSamples(ossim_uint32 reduced_res_level=0) const
Returns the number of samples in the image.
virtual ossim_uint32 getNumberOfLines(ossim_uint32 reduced_res_level=0) const
Returns the number of lines in the image.

◆ getImageTileHeight()

ossim_uint32 ossimH5ImageHandler::getImageTileHeight ( ) const
virtual

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 454 of file ossimH5Reader.cpp.

455 {
456  return 0; // Not tiled format.
457 }

◆ getImageTileWidth()

ossim_uint32 ossimH5ImageHandler::getImageTileWidth ( ) const
virtual

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 449 of file ossimH5Reader.cpp.

450 {
451  return 0; // Not tiled format.
452 }

◆ getInternalImageGeometry()

ossimRefPtr< ossimImageGeometry > ossimH5ImageHandler::getInternalImageGeometry ( )
protectedvirtual

Method to get geometry from hdf file.

Definition at line 647 of file ossimH5Reader.cpp.

References ossimRefPtr< T >::get(), ossim_hdf5::getBilinearProjection(), getLatLonDatasetNames(), isOpen(), m_currentEntry, m_entries, m_h5File, m_projection, processCoarseGridProjection(), ossimImageGeometry::setProjection(), and ossimRefPtr< T >::valid().

Referenced by getImageGeometry().

648 {
650 
651  if ( m_projection.valid() )
652  {
653  // Stored projection, currently shared by all entries.
654  geom->setProjection( m_projection.get() );
655  }
656  else if ( isOpen() )
657  {
658  // Find the "Latitude" and "Longitude" datasets if present.
659  std::string latName;
660  std::string lonName;
661  if ( getLatLonDatasetNames( m_h5File, latName, lonName ) )
662  {
663  H5::DataSet latDataSet = m_h5File->openDataSet( latName );
664  H5::DataSet lonDataSet = m_h5File->openDataSet( lonName );
665 
666  // Get the valid rectangle of the dataset.
667  ossimIrect validRect = m_entries[m_currentEntry].getValidImageRect();
668 
669  // Try for a coarse projection first:
671  processCoarseGridProjection( latDataSet,
672  lonDataSet,
673  validRect );
674 
675  if ( proj.valid() == false )
676  {
677  ossimIrect rect;
678  proj = ossim_hdf5::getBilinearProjection( latDataSet, lonDataSet, validRect );
679  }
680 
681  if ( proj.valid() )
682  {
683  // Store it for next time:
684  m_projection = proj;
685 
686  // Set the geometry projection
687  geom->setProjection( proj.get() );
688  }
689 
690  latDataSet.close();
691  lonDataSet.close();
692  }
693  }
694 
695  return geom;
696 }
void setProjection(ossimProjection *projection)
Sets the projection to be used for local-to-world coordinate transformation.
bool valid() const
Definition: ossimRefPtr.h:75
ossim_uint32 m_currentEntry
Container class that holds both 2D transform and 3D projection information for an image Only one inst...
bool isOpen() const
Derived classes must implement this method to be concrete.
H5::H5File * m_h5File
ossimRefPtr< ossimProjection > getBilinearProjection(H5::DataSet &latDataSet, H5::DataSet &lonDataSet, const ossimIrect &validRect)
Gets bilinear projection from Latitude, Longitude layer.
ossimRefPtr< ossimProjection > m_projection
ossimRefPtr< ossimProjection > processCoarseGridProjection(H5::DataSet &latDataSet, H5::DataSet &lonDataSet, const ossimIrect &validRect) const
Gets projection from Latitude, Longitude, Height datasets if present.
bool getLatLonDatasetNames(H5::H5File *h5File, std::string &latName, std::string &lonName) const
Get dataset names for Latiitude and Longitude datasets.
std::vector< ossimH5ImageDataset > m_entries

◆ getLatLonDatasetNames()

bool ossimH5ImageHandler::getLatLonDatasetNames ( H5::H5File *  h5File,
std::string &  latName,
std::string &  lonName 
) const
protected

Get dataset names for Latiitude and Longitude datasets.

Parameters
h5FilePointer to file.
latNameInitializes by this.
lonNameInitializes by this.
Returns
true on sucess, false on error.

Definition at line 729 of file ossimH5Reader.cpp.

References ossimString::contains(), and ossim_hdf5::getDatasetNames().

Referenced by getInternalImageGeometry(), and getLatLonDatasets().

732 {
733  bool result = false;
734 
735  if ( h5File )
736  {
737  latName.clear();
738  lonName.clear();
739 
740  // Get the list of datasets.
741  std::vector<std::string> datasetNames;
742  ossim_hdf5::getDatasetNames( h5File, datasetNames );
743 
744  if ( datasetNames.size() )
745  {
746  std::vector<std::string>::const_iterator i = datasetNames.begin();
747  while ( i != datasetNames.end() )
748  {
749  ossimString os = *i;
750  if ( os.contains( "Latitude" ) )
751  {
752  latName = *i;
753  }
754  else if ( os.contains( "Longitude" ) )
755  {
756  lonName = *i;
757  }
758 
759  if ( latName.size() && lonName.size() )
760  {
761  result = true;
762  break;
763  }
764 
765  ++i;
766  }
767  }
768  }
769 
770  return result;
771 
772 } // End: ossimH5Reader::getLatLonDatasetNames
bool contains(char aChar) const
Definition: ossimString.h:58
void getDatasetNames(H5::H5File *file, std::vector< std::string > &names)

◆ getLatLonDatasets()

bool ossimH5ImageHandler::getLatLonDatasets ( H5::H5File *  h5File,
H5::DataSet &  latDataSet,
H5::DataSet &  lonDataSet 
) const
protected
Parameters
Initializeslat and lon data sets.
h5FilePointer to file.
latDataSetInitialized by this.
lonDataSetInitialized by this.

Definition at line 774 of file ossimH5Reader.cpp.

References ossimFilename::dirCat(), ossimFilename::exists(), ossim_hdf5::getGroupAttributeValue(), getLatLonDatasetNames(), ossimFilename::path(), status, ossimString::string(), and ossimImageHandler::theImageFile.

777 {
778  bool status = false;
779 
780  if ( h5File )
781  {
782  std::string latName;
783  std::string lonName;
784  if ( getLatLonDatasetNames( h5File, latName, lonName ) )
785  {
786  // Set the return status:
787  status = true;
788  latDataSet = h5File->openDataSet( latName );
789  lonDataSet = h5File->openDataSet( lonName );
790  }
791  else
792  {
793  // Look for the key: /N_GEO_Ref
794  std::string group = "/";
795  std::string key = "N_GEO_Ref";
796  std::string value;
797 
798  if ( ossim_hdf5::getGroupAttributeValue( h5File, group, key, value ) )
799  {
800  ossimFilename f = value;
801  ossimFilename latLonFile = theImageFile.path();
802  latLonFile = latLonFile.dirCat( f );
803 
804  if ( latLonFile.exists() )
805  {
806  if ( H5::H5File::isHdf5( latLonFile.string() ) )
807  {
808  H5::H5File* h5File = new H5::H5File();
809 
810  H5::FileAccPropList access_plist = H5::FileAccPropList::DEFAULT;
811  h5File->openFile( latLonFile.string(), H5F_ACC_RDONLY, access_plist );
812 
813  if ( getLatLonDatasetNames( h5File, latName, lonName ) )
814  {
815  // Set the return status:
816  status = true;
817  latDataSet = h5File->openDataSet( latName );
818  lonDataSet = h5File->openDataSet( lonName );
819  }
820  h5File->close();
821  delete h5File;
822  h5File = 0;
823  }
824  }
825  }
826  }
827  }
828 
829  return status;
830 
831 } // End: ossimH5Reader::getLatLonDatasets( ... )
ossimFilename theImageFile
bool exists() const
return status
bool getGroupAttributeValue(H5::H5File *file, const std::string &group, const std::string &key, std::string &value)
Gets string value for attribute key.
ossimFilename dirCat(const ossimFilename &file) const
bool getLatLonDatasetNames(H5::H5File *h5File, std::string &latName, std::string &lonName) const
Get dataset names for Latiitude and Longitude datasets.
ossimFilename path() const
const std::string & string() const
Definition: ossimString.h:414

◆ getLongName()

ossimString ossimH5ImageHandler::getLongName ( ) const
virtual
Returns
"ossim hdf5"

Reimplemented from ossimObject.

Definition at line 464 of file ossimH5Reader.cpp.

465 {
466  return ossimString("ossim hdf5 reader");
467 }

◆ getNullPixelValue()

double ossimH5ImageHandler::getNullPixelValue ( ossim_uint32  band = 0) const
virtual
Returns
Null pixel value.

Reimplemented from ossimImageHandler.

Definition at line 853 of file ossimH5Reader.cpp.

References ossimImageHandler::getNullPixelValue(), getOutputScalarType(), and OSSIM_FLOAT32.

Referenced by getTile().

854 {
856 #if 0
857  double result;
859  if ( scalar == OSSIM_FLOAT32 )
860  {
861  result = -9999.0;
862  }
863  else
864  {
865  result = ossimImageHandler::getNullPixelValue( band );
866  }
867  return result;
868 #endif
869 }
32 bit floating point
virtual ossimScalarType getOutputScalarType() const
Returns the output pixel type of the tile source.
ossimScalarType
virtual double getNullPixelValue(ossim_uint32 band=0) const
Each band has a null pixel associated with it.

◆ getNumberOfEntries()

ossim_uint32 ossimH5ImageHandler::getNumberOfEntries ( ) const
virtual
Returns
The number of entries (images) in the image file.

Reimplemented from ossimImageHandler.

Definition at line 531 of file ossimH5Reader.cpp.

References m_entries.

532 {
533  return (ossim_uint32)m_entries.size();
534 }
unsigned int ossim_uint32
std::vector< ossimH5ImageDataset > m_entries

◆ getNumberOfInputBands()

ossim_uint32 ossimH5ImageHandler::getNumberOfInputBands ( ) const
virtual

Returns the number of bands in the image.

Satisfies pure virtual from ImageHandler class.

Implements ossimImageSource.

Definition at line 474 of file ossimH5Reader.cpp.

References m_currentEntry, and m_entries.

Referenced by getNumberOfOutputBands(), and getTile().

475 {
476  ossim_uint32 result = 1;
477 
478  if ( m_currentEntry < m_entries.size() )
479  {
480  result = m_entries[m_currentEntry].getNumberOfBands();
481  }
482 
483  return result;
484 }
unsigned int ossim_uint32
ossim_uint32 m_currentEntry
std::vector< ossimH5ImageDataset > m_entries

◆ getNumberOfLines()

ossim_uint32 ossimH5ImageHandler::getNumberOfLines ( ossim_uint32  reduced_res_level = 0) const
virtual

Returns the number of lines in the image.

Satisfies pure virtual from ImageHandler class.

Implements ossimImageHandler.

Definition at line 417 of file ossimH5Reader.cpp.

References ossimImageHandler::getNumberOfLines(), m_currentEntry, m_entries, ossimImageHandler::theOverview, and ossimRefPtr< T >::valid().

Referenced by getImageRectangle().

418 {
419  ossim_uint32 result = 0;
420 
421  if ( (reduced_res_level == 0) && ( m_currentEntry < m_entries.size() ) )
422  {
423  result = m_entries[m_currentEntry].getNumberOfLines();
424  }
425  else if ( theOverview.valid() )
426  {
427  result = theOverview->getNumberOfLines(reduced_res_level);
428  }
429 
430  return result;
431 }
bool valid() const
Definition: ossimRefPtr.h:75
virtual ossim_uint32 getNumberOfLines(ossim_uint32 resLevel=0) const =0
Pure virtual, derived classes must implement.
unsigned int ossim_uint32
ossim_uint32 m_currentEntry
ossimRefPtr< ossimImageHandler > theOverview
std::vector< ossimH5ImageDataset > m_entries

◆ getNumberOfOutputBands()

ossim_uint32 ossimH5ImageHandler::getNumberOfOutputBands ( ) const
virtual

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

Note: we are supporting sources that can have multiple data objects. If you want to know the scalar type of an object you can pass in the

Reimplemented from ossimImageSource.

Definition at line 486 of file ossimH5Reader.cpp.

References getNumberOfInputBands().

Referenced by getTile().

487 {
488  // Currently not band selectable.
489  return getNumberOfInputBands();
490 }
virtual ossim_uint32 getNumberOfInputBands() const
Returns the number of bands in the image.

◆ getNumberOfSamples()

ossim_uint32 ossimH5ImageHandler::getNumberOfSamples ( ossim_uint32  reduced_res_level = 0) const
virtual

Returns the number of samples in the image.

Satisfies pure virtual from ImageHandler class.

Implements ossimImageHandler.

Definition at line 433 of file ossimH5Reader.cpp.

References ossimImageHandler::getNumberOfSamples(), m_currentEntry, m_entries, ossimImageHandler::theOverview, and ossimRefPtr< T >::valid().

Referenced by getImageRectangle().

434 {
435  ossim_uint32 result = 0;
436 
437  if ( (reduced_res_level == 0) && ( m_currentEntry < m_entries.size() ) )
438  {
439  result = m_entries[m_currentEntry].getNumberOfSamples();
440  }
441  else if ( theOverview.valid() )
442  {
443  result = theOverview->getNumberOfSamples(reduced_res_level);
444  }
445 
446  return result;
447 }
bool valid() const
Definition: ossimRefPtr.h:75
unsigned int ossim_uint32
ossim_uint32 m_currentEntry
ossimRefPtr< ossimImageHandler > theOverview
virtual ossim_uint32 getNumberOfSamples(ossim_uint32 resLevel=0) const =0
Pure virtual, derived classes must implement.
std::vector< ossimH5ImageDataset > m_entries

◆ getOutputScalarType()

ossimScalarType ossimH5ImageHandler::getOutputScalarType ( ) const
virtual

Returns the output pixel type of the tile source.

Reimplemented from ossimImageSource.

Definition at line 492 of file ossimH5Reader.cpp.

References m_currentEntry, m_entries, and OSSIM_SCALAR_UNKNOWN.

Referenced by getNullPixelValue().

493 {
495 
496  if ( m_currentEntry < m_entries.size() )
497  {
498  result = m_entries[m_currentEntry].getScalarType();
499  }
500 
501  return result;
502 }
ossim_uint32 m_currentEntry
ossimScalarType
std::vector< ossimH5ImageDataset > m_entries

◆ getProperty()

ossimRefPtr< ossimProperty > ossimH5ImageHandler::getProperty ( const ossimString name) const
virtual

Get propterty method.

Overrides ossimImageHandler::getProperty.

Parameters
nameProperty name to get.

Reimplemented from ossimImageHandler.

Definition at line 895 of file ossimH5Reader.cpp.

References ossimString::string().

896 {
898  if ( name.string() == LAYER_KW )
899  {
900  if ( m_currentEntry < m_entries.size() )
901  {
902  ossimString value = m_entries[m_currentEntry].getName();
903  prop = new ossimStringProperty(name, value);
904  }
905  }
906  else
907  {
908  prop = ossimImageHandler::getProperty(name);
909  }
910  return prop;
911 }
ossim_uint32 m_currentEntry
virtual ossimRefPtr< ossimProperty > getProperty(const ossimString &name) const
std::vector< ossimH5ImageDataset > m_entries
const std::string & string() const
Definition: ossimString.h:414

◆ getPropertyNames()

void ossimH5ImageHandler::getPropertyNames ( std::vector< ossimString > &  propertyNames) const
virtual

Get propterty names.

Overrides ossimImageHandler::getPropertyNames.

Parameters
propertyNamesArray to initialize.

Reimplemented from ossimImageHandler.

Definition at line 913 of file ossimH5Reader.cpp.

References ossimImageHandler::getPropertyNames().

914 {
915  propertyNames.push_back( ossimString("layer") );
917 }
virtual void getPropertyNames(std::vector< ossimString > &propertyNames) const

◆ getShortName()

ossimString ossimH5ImageHandler::getShortName ( ) const
virtual
Returns
"hdf5"

Reimplemented from ossimObject.

Definition at line 459 of file ossimH5Reader.cpp.

460 {
461  return ossimString("ossim_hdf5_reader");
462 }

◆ getTile() [1/2]

ossimRefPtr< ossimImageData > ossimH5ImageHandler::getTile ( const ossimIrect rect,
ossim_uint32  resLevel = 0 
)
virtual

Returns a pointer to a tile given an origin representing the upper left corner of the tile to grab from the image.

Satisfies pure virtual from TileSource class.

Reimplemented from ossimImageSource.

Definition at line 100 of file ossimH5Reader.cpp.

References allocate(), ossimRefPtr< T >::get(), ossimDataObject::getDataObjectStatus(), m_mutex, m_tile, ossimImageData::makeBlank(), OSSIM_NULL, ossimImageData::setImageRectangle(), and ossimRefPtr< T >::valid().

102 {
103  if ( m_tile.valid() == false ) // First time through.
104  {
105  allocate();
106  }
107 
108  if (m_tile.valid())
109  {
110  // Image rectangle must be set prior to calling getTile.
111  m_mutex.lock();
112  m_tile->setImageRectangle(rect);
113  m_mutex.unlock();
114 
115  if ( getTile( m_tile.get(), resLevel ) == false )
116  {
117  m_mutex.lock();
119  {
120  m_tile->makeBlank();
121  }
122  m_mutex.unlock();
123  }
124  }
125 
126  return m_tile;
127 }
virtual void setImageRectangle(const ossimIrect &rect)
bool valid() const
Definition: ossimRefPtr.h:75
void allocate()
Allocates the tile.
virtual ossimDataObjectStatus getDataObjectStatus() const
virtual ossimRefPtr< ossimImageData > getTile(const ossimIrect &rect, ossim_uint32 resLevel=0)
Returns a pointer to a tile given an origin representing the upper left corner of the tile to grab fr...
ossimRefPtr< ossimImageData > m_tile
virtual void makeBlank()
Initializes data to null pixel values.

◆ getTile() [2/2]

bool ossimH5ImageHandler::getTile ( ossimImageData result,
ossim_uint32  resLevel = 0 
)
virtual

Method to get a tile.

Parameters
resultThe tile to stuff. Note The requested rectangle in full image space and bands should be set in the result tile prior to passing. It will be an error if: result.getNumberOfBands() != this->getNumberOfOutputBands()
Returns
true on success false on error. If return is false, result is undefined so caller should handle appropriately with makeBlank or whatever.

Reimplemented from ossimImageSource.

Definition at line 129 of file ossimH5Reader.cpp.

References ossimIrect::area(), ossimIrect::clipToRect(), ossimIrect::completely_within(), getImageRectangle(), ossimImageData::getImageRectangle(), getNullPixelValue(), ossimImageData::getNumberOfBands(), getNumberOfInputBands(), getNumberOfOutputBands(), ossimImageHandler::getOverviewTile(), ossim_hdf5::getScalarType(), isOpen(), ossimSource::isSourceEnabled(), ossimImageHandler::isValidRLevel(), ossimImageData::loadBand(), m_currentEntry, m_entries, m_mutex, ossimImageData::makeBlank(), OSSIM_FLOAT32, ossimReferenced::ref(), ossim::scalarSizeInBytes(), status, ossimReferenced::unref(), and ossimImageData::validate().

130 {
131  bool status = false;
132 
133  m_mutex.lock();
134 
135  //---
136  // Not open, this tile source bypassed, or invalid res level,
137  // return a blank tile.
138  //---
139  if( isOpen() && isSourceEnabled() && isValidRLevel(resLevel) &&
140  result && (result->getNumberOfBands() == getNumberOfOutputBands()) )
141  {
142  result->ref(); // Increment ref count.
143 
144  //---
145  // Check for overview tile. Some overviews can contain r0 so always
146  // call even if resLevel is 0. Method returns true on success, false
147  // on error.
148  //---
149  status = getOverviewTile(resLevel, result);
150 
151  if (!status) // Did not get an overview tile.
152  {
153  status = true;
154 
155  ossimIrect tile_rect = result->getImageRectangle();
156 
157  if ( ! tile_rect.completely_within(getImageRectangle(0)) )
158  {
159  // We won't fill totally so make blank first.
160  result->makeBlank();
161  }
162 
163  if (getImageRectangle(0).intersects(tile_rect))
164  {
165  // Make a clip rect.
166  ossimIrect clipRect = tile_rect.clipToRect(getImageRectangle(0));
167 
168  if (tile_rect.completely_within( clipRect) == false)
169  {
170  // Not filling whole tile so blank it out first.
171  result->makeBlank();
172  }
173 
174  // Create buffer to hold the clip rect for a single band.
175  ossim_uint32 clipRectSizeInBytes = clipRect.area() *
177  vector<char> dataBuffer(clipRectSizeInBytes);
178 
179  // Get the data.
180  for (ossim_uint32 band = 0; band < getNumberOfInputBands(); ++band)
181  {
182  // Hdf5 file to buffer:
183  m_entries[m_currentEntry].getTileBuf(&dataBuffer.front(), clipRect, band);
184 
186  {
187  //---
188  // NPP VIIRS data has null of "-999.3".
189  // Scan and fix non-standard null value.
190  //---
191  const ossim_float32 NP = getNullPixelValue(band);
192  const ossim_uint32 COUNT = clipRect.area();
193  ossim_float32* float_buffer = (ossim_float32*)&dataBuffer.front();
194  for ( ossim_uint32 i = 0; i < COUNT; ++i )
195  {
196  if ( float_buffer[i] <= -999.0 ) float_buffer[i] = NP;
197  }
198  }
199 
200  // Buffer to tile:
201  result->loadBand((void*)&dataBuffer.front(), clipRect, band);
202  }
203 
204  // Validate the tile, i.e. full, partial, empty.
205  result->validate();
206  }
207  else // No intersection...
208  {
209  result->makeBlank();
210  }
211  }
212 
213  result->unref(); // Decrement ref count.
214  }
215 
216  m_mutex.unlock();
217 
218  return status;
219 }
virtual void loadBand(const void *src, const ossimIrect &src_rect, ossim_uint32 band)
virtual bool isSourceEnabled() const
Definition: ossimSource.cpp:79
virtual ossim_uint32 getNumberOfBands() const
float ossim_float32
ossimScalarType getScalarType(const H5::DataSet *dataset)
virtual double getNullPixelValue(ossim_uint32 band=0) const
32 bit floating point
void ref() const
increment the reference count by one, indicating that this object has another pointer which is refere...
virtual bool isValidRLevel(ossim_uint32 resLevel) const
Determines if the passed in reslution level is valid.
bool completely_within(const ossimIrect &rect) const
Definition: ossimIrect.cpp:425
virtual bool getOverviewTile(ossim_uint32 resLevel, ossimImageData *result)
Method to get an overview tile.
virtual ossimDataObjectStatus validate() const
unsigned int ossim_uint32
virtual ossimIrect getImageRectangle() const
OSSIM_DLL ossim_uint32 scalarSizeInBytes(ossimScalarType scalarType)
ossimIrect clipToRect(const ossimIrect &rect) const
Definition: ossimIrect.cpp:501
virtual ossimIrect getImageRectangle(ossim_uint32 reduced_res_level=0) const
Returns the zero based image rectangle for the reduced resolution data set (rrds) passed in...
ossim_uint32 m_currentEntry
void unref() const
decrement the reference count by one, indicating that a pointer to this object is referencing it...
return status
virtual void makeBlank()
Initializes data to null pixel values.
bool isOpen() const
Derived classes must implement this method to be concrete.
virtual ossim_uint32 getNumberOfOutputBands() const
Returns the number of bands in a tile returned from this TileSource.
virtual ossim_uint32 getNumberOfInputBands() const
Returns the number of bands in the image.
ossim_uint32 area() const
Definition: ossimIrect.h:396
std::vector< ossimH5ImageDataset > m_entries

◆ isNppMission()

bool ossimH5ImageHandler::isNppMission ( H5::H5File *  h5File) const
protected
Returns
true if key "Mission_Name" is equal to NPP.

Definition at line 833 of file ossimH5Reader.cpp.

References ossim_hdf5::getGroupAttributeValue().

834 {
835  bool result = false;
836 
837  // Look for "Mission_Name"
838  const std::string GROUP = "/";
839  const std::string KEY = "Mission_Name";
840  std::string value;
841 
842  if ( ossim_hdf5::getGroupAttributeValue( h5File, GROUP, KEY, value ) )
843  {
844  if ( value == "NPP" )
845  {
846  result = true;
847  }
848  }
849 
850  return result;
851 }
bool getGroupAttributeValue(H5::H5File *file, const std::string &group, const std::string &key, std::string &value)
Gets string value for attribute key.

◆ isOpen()

bool ossimH5ImageHandler::isOpen ( ) const
virtual

Derived classes must implement this method to be concrete.

Returns
true if open, false if not.

Implements ossimImageHandler.

Definition at line 504 of file ossimH5Reader.cpp.

References m_currentEntry, m_entries, m_h5File, and true.

Referenced by getInternalImageGeometry(), getTile(), setCurrentEntry(), and ~ossimH5ImageHandler().

505 {
506  return ( ( m_h5File != 0 ) &&
507  m_entries.size() &&
508  ( m_currentEntry < m_entries.size() ) ) ? true : false ;
509 }
ossim_uint32 m_currentEntry
H5::H5File * m_h5File
std::vector< ossimH5ImageDataset > m_entries

◆ loadState()

bool ossimH5ImageHandler::loadState ( const ossimKeywordlist kwl,
const char *  prefix = 0 
)
virtual

Method to the load (recreate) the state of an object from a keyword list.

Return true if ok or false on error.

Reimplemented from ossimImageHandler.

Definition at line 236 of file ossimH5Reader.cpp.

References ossimImageHandler::loadState(), and open().

238 {
239  if (ossimImageHandler::loadState(kwl, prefix))
240  {
241  return open();
242  }
243 
244  return false;
245 }
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
Method to the load (recreate) the state of an object from a keyword list.
virtual bool open()
open method.

◆ open()

bool ossimH5ImageHandler::open ( )
protectedvirtual

open method.

Returns
true on success, false on error.

Implements ossimImageHandler.

Definition at line 247 of file ossimH5Reader.cpp.

Referenced by loadState().

248 {
249  static const char MODULE[] = "ossimH5Reader::open";
250 
251  if (traceDebug())
252  {
254  << MODULE << " entered..."
255  << "File: " << theImageFile.c_str()
256  << std::endl;
257  }
258 
259  bool status = false;
260 
261  // Start with a clean slate.
262  if (isOpen())
263  {
264  close();
265  }
266 
267  // Check for empty filename.
268  if (theImageFile.size())
269  {
270  try
271  {
272  //--
273  // Turn off the auto-printing when failure occurs so that we can
274  // handle the errors appropriately
275  //---
276  // H5::Exception::dontPrint();
277 
279 
280  if ( H5::H5File::isHdf5( theImageFile.c_str() ) )
281  {
282  m_h5File = new H5::H5File();
283 
284  H5::FileAccPropList access_plist = H5::FileAccPropList::DEFAULT;
285 
286  m_h5File->openFile( theImageFile.string(), H5F_ACC_RDONLY, access_plist );
287 
288  std::vector<std::string> names;
290 
291  if ( names.size() )
292  {
293  if ( traceDebug() )
294  {
296  << MODULE << " DEBUG\nDataset names:\n";
297  for ( ossim_uint32 i = 0; i < names.size(); ++i )
298  {
300  << "dataset[" << i << "]: " << names[i] << "\n";
301  }
302  }
303 
304  // Add the image dataset entries.
305  addImageDatasetEntries( names );
306  if ( m_entries.size() )
307  {
308  // Set the return status.
309  status = true;
310  }
311  else
312  {
313  m_h5File->close();
314  delete m_h5File;
315  m_h5File = 0;
316  }
317  }
318  }
319 
320  } // End: try block
321 
322  catch( const H5::FileIException& error )
323  {
324  if ( traceDebug() )
325  {
326  error.printError();
327  }
328  }
329 
330  // catch failure caused by the DataSet operations
331  catch( const H5::DataSetIException& error )
332  {
333  if ( traceDebug() )
334  {
335  error.printError();
336  }
337  }
338 
339  // catch failure caused by the DataSpace operations
340  catch( const H5::DataSpaceIException& error )
341  {
342  if ( traceDebug() )
343  {
344  error.printError();
345  }
346  }
347 
348  // catch failure caused by the DataSpace operations
349  catch( const H5::DataTypeIException& error )
350  {
351  if ( traceDebug() )
352  {
353  error.printError();
354  }
355  }
356  catch( ... )
357  {
358 
359  }
360 
361  if ( status )
362  {
363  completeOpen();
364  }
365  }
366 
367  return status;
368 }
ossimFilename theImageFile
ossimFilename expand() const
Method to do file name expansion.
void addImageDatasetEntries(const std::vector< std::string > &names)
Adds image datasets from list of names.
std::string::size_type size() const
Definition: ossimString.h:405
unsigned int ossim_uint32
virtual void close()
Close method.
return status
bool isOpen() const
Derived classes must implement this method to be concrete.
virtual void completeOpen()
Will complete the opening process.
H5::H5File * m_h5File
const char * c_str() const
Returns a pointer to a null-terminated array of characters representing the string&#39;s contents...
Definition: ossimString.h:396
void getDatasetNames(H5::H5File *file, std::vector< std::string > &names)
std::vector< ossimH5ImageDataset > m_entries
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
const std::string & string() const
Definition: ossimString.h:414

◆ processCoarseGridProjection()

ossimRefPtr< ossimProjection > ossimH5ImageHandler::processCoarseGridProjection ( H5::DataSet &  latDataSet,
H5::DataSet &  lonDataSet,
const ossimIrect validRect 
) const
protected

Gets projection from Latitude, Longitude, Height datasets if present.

Parameters
latDataSetH5::DataSet& to layer, e.g. /All_Data/VIIRS-DNB-GEO_All/Latitude
lonDataSetH5::DataSet& to layer, e.g. /All_Data/VIIRS-DNB-GEO_All/Longitude

Definition at line 698 of file ossimH5Reader.cpp.

References ossimRefPtr< T >::get().

Referenced by getInternalImageGeometry().

702 {
704 
706 
707  try
708  {
709  if ( model->setGridNodes( &latDataSet,
710  &lonDataSet,
711  validRect ) )
712  {
713  proj = model.get();
714  }
715  }
716  catch ( const ossimException& e )
717  {
718  if ( traceDebug() )
719  {
721  << "ossimH5Reader::processCoarseGridProjection caught exception\n"
722  << e.what() << std::endl;
723  }
724  }
725 
726  return proj;
727 }
virtual const char * what() const
Returns the error message.
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ saveState()

bool ossimH5ImageHandler::saveState ( ossimKeywordlist kwl,
const char *  prefix = 0 
) const
virtual

Method to save the state of an object to a keyword list.

Return true if ok or false on error.

Reimplemented from ossimImageHandler.

Definition at line 230 of file ossimH5Reader.cpp.

References ossimImageHandler::saveState().

232 {
233  return ossimImageHandler::saveState(kwl, prefix);
234 }
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
Method to save the state of an object to a keyword list.

◆ setCurrentEntry()

bool ossimH5ImageHandler::setCurrentEntry ( ossim_uint32  entryIdx)
virtual
Parameters
entryIdxEntry number to select.
Note
The implementation does nothing. Derived classes that handle multiple images should override.
Returns
true if it was able to set the current entry and false otherwise.

Reimplemented from ossimImageHandler.

Definition at line 555 of file ossimH5Reader.cpp.

References ossimString::clear(), ossimImageHandler::completeOpen(), isOpen(), m_currentEntry, m_entries, m_tile, ossimImageHandler::theGeometry, and ossimImageHandler::theOverviewFile.

556 {
557  bool result = true;
558  if (m_currentEntry != entryIdx)
559  {
560  if ( isOpen() )
561  {
562  // Entries always start at zero and increment sequentially..
563  if ( entryIdx < m_entries.size() )
564  {
565  // Clear the geometry.
566  theGeometry = 0;
567 
568  // Must clear or openOverview will use last entries.
570 
571  m_currentEntry = entryIdx;
572 
573  //---
574  // Since we were previously open and the the entry has changed we
575  // need to reinitialize some things. Setting tile to 0 will force an
576  // allocate call on first getTile.
577  //---
578 
579  // ossimRefPtr so assign to 0(unreferencing) will handle memory.
580  m_tile = 0;
581 
582  completeOpen();
583  }
584  else
585  {
586  result = false; // Entry index out of range.
587  }
588  }
589  else
590  {
591  //---
592  // Not open.
593  // Allow this knowing that open will check for out of range.
594  //---
595  m_currentEntry = entryIdx;
596  }
597  }
598 
599  return result;
600 }
void clear()
Erases the entire container.
Definition: ossimString.h:432
ossimRefPtr< ossimImageGeometry > theGeometry
ossimRefPtr< ossimImageData > m_tile
ossim_uint32 m_currentEntry
bool isOpen() const
Derived classes must implement this method to be concrete.
virtual void completeOpen()
Will complete the opening process.
ossimFilename theOverviewFile
std::vector< ossimH5ImageDataset > m_entries

◆ setProperty()

void ossimH5ImageHandler::setProperty ( ossimRefPtr< ossimProperty property)
virtual

Set propterty method.

Overrides ossimImageHandler::setProperty.

Current property name handled: "scale" One double value representing the scale in meters per pixel. It is assumed the scale is same for x and y direction.

Parameters
propertyto set.

Reimplemented from ossimImageHandler.

Definition at line 871 of file ossimH5Reader.cpp.

References ossimProperty::getName(), ossimString::string(), and ossimRefPtr< T >::valid().

872 {
873  if ( property.valid() )
874  {
875  if ( property->getName().string() == LAYER_KW )
876  {
877  ossimString s;
878  property->valueToString(s);
879  ossim_uint32 SIZE = (ossim_uint32)m_entries.size();
880  for ( ossim_uint32 i = 0; i < SIZE; ++i )
881  {
882  if ( m_entries[i].getName() == s.string() )
883  {
884  setCurrentEntry( i );
885  }
886  }
887  }
888  else
889  {
891  }
892  }
893 }
bool valid() const
Definition: ossimRefPtr.h:75
virtual void setProperty(ossimRefPtr< ossimProperty > property)
unsigned int ossim_uint32
virtual bool setCurrentEntry(ossim_uint32 entryIdx)
std::vector< ossimH5ImageDataset > m_entries
const ossimString & getName() const
const std::string & string() const
Definition: ossimString.h:414

Member Data Documentation

◆ m_currentEntry

ossim_uint32 ossimH5ImageHandler::m_currentEntry
protected

◆ m_entries

std::vector<ossimH5ImageDataset> ossimH5ImageHandler::m_entries
protected

◆ m_h5File

H5::H5File* ossimH5ImageHandler::m_h5File
protected

◆ m_mutex

std::mutex ossimH5ImageHandler::m_mutex
protected

Definition at line 293 of file ossimH5Reader.h.

Referenced by allocate(), getImageGeometry(), and getTile().

◆ m_projection

ossimRefPtr<ossimProjection> ossimH5ImageHandler::m_projection
protected

Definition at line 292 of file ossimH5Reader.h.

Referenced by close(), and getInternalImageGeometry().

◆ m_tile

ossimRefPtr<ossimImageData> ossimH5ImageHandler::m_tile
protected

Definition at line 291 of file ossimH5Reader.h.

Referenced by allocate(), close(), getTile(), and setCurrentEntry().


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