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

#include <ossimOpjJp2Reader.h>

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

Public Types

enum  { SIGNATURE_BOX_SIZE = 12, GEOTIFF_UUID_SIZE = 16 }
 Anonymous enumerations: More...
 
enum  ossimOpjJp2ReadMode { ossimOpjJp2ReadUnknown = 0 }
 
- 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
 

Public Member Functions

 ossimOpjJp2Reader ()
 default constructor More...
 
virtual ~ossimOpjJp2Reader ()
 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 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 getNumberOfDecimationLevels () const
 Returns the number of decimation levels. 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...
 
virtual bool isOpen () const
 Derived classes must implement this method to be concrete. More...
 
virtual double getMaxPixelValue (ossim_uint32 band=0) const
 Returns the max pixel of the band. More...
 
virtual bool open ()
 open method. More...
 
virtual void close ()
 close method More...
 
virtual ossimRefPtr< ossimImageGeometrygetImageGeometry ()
 Returns the image geometry object associated with this tile source or NULL if non defined. 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 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 getNullPixelValue (ossim_uint32 band=0) const
 Each band has a null pixel associated with it. 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 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 bool getOverviewTile (ossim_uint32 resLevel, ossimImageData *result)
 Gets an overview tile. 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
 
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)
 

Private Member Functions

virtual ossimRefPtr< ossimImageGeometrygetInternalImageGeometry ()
 
virtual ossimRefPtr< ossimImageGeometrygetImageGeometryFromGeotiffBox ()
 
virtual ossimRefPtr< ossimImageGeometrygetImageGeometryFromGmlBox ()
 
ossimRefPtr< ossimImageGeometrygetMetadataImageGeometry () const
 
void destroy ()
 
bool initSizRecord (std::istream *str, ossimJ2kSizRecord &sizRecord) const
 
bool initCodRecord (std::istream *str, ossimJ2kCodRecord &sizRecord) const
 
void allocate ()
 Initializes tiles. More...
 

Private Attributes

ossimJ2kSizRecord m_sizRecord
 
ossimRefPtr< ossimImageDatam_tile
 
ossimRefPtr< ossimImageDatam_cacheTile
 
std::ifstream * m_str
 
ossim_uint32 m_minDwtLevels
 
ossim_int32 m_format
 

Additional Inherited Members

- 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
 

Detailed Description

Definition at line 25 of file ossimOpjJp2Reader.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

Anonymous enumerations:

Enumerator
SIGNATURE_BOX_SIZE 
GEOTIFF_UUID_SIZE 

Definition at line 30 of file ossimOpjJp2Reader.h.

◆ ossimOpjJp2ReadMode

Enumerator
ossimOpjJp2ReadUnknown 

Definition at line 36 of file ossimOpjJp2Reader.h.

Constructor & Destructor Documentation

◆ ossimOpjJp2Reader()

ossimOpjJp2Reader::ossimOpjJp2Reader ( )

default constructor

Definition at line 60 of file ossimOpjJp2Reader.cpp.

61  :
63  m_sizRecord(),
64  m_tile(0),
65  m_str(0),
67 {
68  // Uncomment to enable trace for debug:
69  // traceDebug.setTraceFlag(true);
70 
71  if (traceDebug())
72  {
74  << "ossimOpjJp2Reader::ossimOpjJp2Reader entered..." << std::endl;
75 #ifdef OSSIM_ID_ENABLED
77  << "OSSIM_ID: " << OSSIM_ID << endl;
78 #endif
79  }
80 }
ossimRefPtr< ossimImageData > m_tile
ossim_uint32 m_minDwtLevels
ossimJ2kSizRecord m_sizRecord
ossimImageHandler()
Constructor (default):
std::ifstream * m_str
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ ~ossimOpjJp2Reader()

ossimOpjJp2Reader::~ossimOpjJp2Reader ( )
virtual

virtual destructor

Definition at line 82 of file ossimOpjJp2Reader.cpp.

References destroy().

83 {
84  destroy();
85 }

Member Function Documentation

◆ allocate()

void ossimOpjJp2Reader::allocate ( )
private

Initializes tiles.

Called once on first getTile request.

Definition at line 998 of file ossimOpjJp2Reader.cpp.

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

Referenced by getTile().

999 {
1001  m_tile->initialize();
1004 
1005  if (traceDebug())
1006  {
1008  << "ossimOpjJp2Reader::allocate DEBUG:"
1009  << "\nm_tile:\n" << *(m_tile.get())
1010  << endl;
1011  }
1012 }
virtual void initialize()
Initialize the data buffer.
ossimRefPtr< ossimImageData > m_tile
static ossimImageDataFactory * instance()
virtual ossimRefPtr< ossimImageData > create(ossimSource *owner, ossimScalarType scalar, ossim_uint32 bands=1) const
ossimRefPtr< ossimImageData > m_cacheTile
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ close()

void ossimOpjJp2Reader::close ( )
virtual

close method

Reimplemented from ossimImageHandler.

Definition at line 183 of file ossimOpjJp2Reader.cpp.

References ossimImageHandler::close(), and destroy().

184 {
185  destroy();
187 }
virtual void close()
Deletes the overview and clears the valid image vertices.

◆ destroy()

void ossimOpjJp2Reader::destroy ( )
private

Definition at line 87 of file ossimOpjJp2Reader.cpp.

References m_cacheTile, m_str, and m_tile.

Referenced by close(), and ~ossimOpjJp2Reader().

88 {
89  m_tile = 0; // ossimRefPtr
90  m_cacheTile = 0; // ossimRefPtr
91 
92  if ( m_str )
93  {
94  m_str->close();
95  delete m_str;
96  m_str = 0;
97  }
98 }
ossimRefPtr< ossimImageData > m_tile
ossimRefPtr< ossimImageData > m_cacheTile
std::ifstream * m_str

◆ getClassName()

ossimString ossimOpjJp2Reader::getClassName ( ) const
virtual
Returns
"ossimOpjJp2Reader"

Reimplemented from ossimObject.

Definition at line 469 of file ossimOpjJp2Reader.cpp.

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

◆ getImageGeometry()

ossimRefPtr< ossimImageGeometry > ossimOpjJp2Reader::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 599 of file ossimOpjJp2Reader.cpp.

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

600 {
601  if ( !theGeometry )
602  {
603  //---
604  // Check for external geom - this is a file.geom not to be confused with
605  // geometries picked up from dot.xml, dot.prj, dot.j2w and so on. We
606  // will check for that later if the getInternalImageGeometry fails.
607  //---
609 
610  if ( !theGeometry )
611  {
612  //---
613  // Check for external files other than .geom, i.e. file.xml & j2w:
614  //---
616 
617  if ( !theGeometry )
618  {
619  // Check the internal geometry first to avoid a factory call.
621 
622  //---
623  // WARNING:
624  // Must create/set the geometry at this point or the next call to
625  // ossimImageGeometryRegistry::extendGeometry will put us in an infinite loop
626  // as it does a recursive call back to ossimImageHandler::getImageGeometry().
627  //---
628  if ( !theGeometry )
629  {
631  }
632 
633  // Check for set projection.
634  if ( !theGeometry->getProjection() )
635  {
636  // Last try factories for projection.
638  }
639  }
640  }
641 
642  // Set image things the geometry object should know about.
644  }
645  return theGeometry;
646 }
static ossimImageGeometryRegistry * instance()
ossimRefPtr< ossimImageGeometry > theGeometry
virtual bool extendGeometry(ossimImageHandler *handler) const
virtual ossimRefPtr< ossimImageGeometry > getInternalImageGeometry()
void initImageParameters(ossimImageGeometry *geom) const
Convenience method to set things needed in the image geometry from the image handler.
Container class that holds both 2D transform and 3D projection information for an image Only one inst...
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).
ossimRefPtr< ossimImageGeometry > getMetadataImageGeometry() const

◆ getImageGeometryFromGeotiffBox()

ossimRefPtr< ossimImageGeometry > ossimOpjJp2Reader::getImageGeometryFromGeotiffBox ( )
privatevirtual
Parameters
Methodto get geometry from the embedded JP2 GeoTIFF Box.

Definition at line 688 of file ossimOpjJp2Reader.cpp.

689 {
690  static const char MODULE[] = "ossimOpjJp2Reader::getImageGeometryFromGeotiffBox";
691 
692  if (traceDebug())
693  {
694  ossimNotify(ossimNotifyLevel_DEBUG) << MODULE << " entered...\n";
695  }
697 
698  if ( isOpen() )
699  {
700  std::streamoff pos = m_str->tellg();
701 
702  m_str->seekg(0, std::ios_base::beg );
703 
704  std::vector<ossim_uint8> box;
705  ossimJp2Info jp2Info;
706 
707  std::streamoff boxPos = jp2Info.getGeotiffBox( *m_str, box );
708 
709  // Seek back to original position.
710  m_str->seekg(pos, std::ios_base::beg );
711 
712  if ( boxPos && box.size() )
713  {
714  if (traceDebug())
715  {
717  << "Found geotiff uuid at: " << boxPos+8 << "\n";
718  }
719 
720  //---
721  // Create a string stream and set the vector buffer as its source.
722  // Note: The box has the 16 GEOTIFF_UUID bytes in there so offset
723  // address and size.
724  //---
725 #if 0
726  // This doesn't work with VS2010...
727  // Create a string stream and set the vector buffer as its source.
728  std::istringstream boxStream;
729  boxStream.rdbuf()->pubsetbuf( (char*)&box.front()+GEOTIFF_UUID_SIZE,
730  box.size()-GEOTIFF_UUID_SIZE );
731 #else
732  // convert the vector into a string
733  std::string boxString( box.begin()+GEOTIFF_UUID_SIZE, box.end() );
734  std::istringstream boxStream;
735  boxStream.str( boxString );
736 #endif
737 
738 
739  // Give the stream to tiff info to create a geometry.
740  ossimTiffInfo info;
741  ossim_uint32 entry = 0;
742  ossimKeywordlist kwl; // Used to capture geometry data.
743 
744  if ( info.getImageGeometry(boxStream, kwl, entry) )
745  {
746  //---
747  // The tiff embedded in the geojp2 only has one line
748  // and one sample by design so overwrite the lines and
749  // samples with the real value.
750  //---
751  ossimString pfx = "image";
752  pfx += ossimString::toString(entry);
753  pfx += ".";
754 
755  // Add the lines.
757  getNumberOfLines(0), true);
758 
759  // Add the samples.
761  getNumberOfSamples(0), true);
762 
763  // Create the projection.
766  if ( proj.valid() )
767  {
768  // Create and assign projection to our ossimImageGeometry object.
769  geom = new ossimImageGeometry();
770  geom->setProjection( proj.get() );
771  if (traceDebug())
772  {
773  ossimNotify(ossimNotifyLevel_DEBUG) << "Found GeoTIFF box." << std::endl;
774  }
775 
776  // Get the internal raster pixel alignment type and set the base class.
777  const char* lookup = kwl.find(pfx.chars(), ossimKeywordNames::PIXEL_TYPE_KW);
778  if ( lookup )
779  {
780  ossimString type = lookup;
781  type.downcase();
782  if ( type == "pixel_is_area" )
783  {
785  }
786  else if ( type == "pixel_is_point" )
787  {
789  }
790  }
791  }
792  }
793  }
794  else // Did not find box in file.
795  {
796  m_str->clear();
797  }
798  }
799  return geom;
800 
801 } // End: ossimOpjJp2Reader::getImageGeometryFromGeotiffBox
void setProjection(ossimProjection *projection)
Sets the projection to be used for local-to-world coordinate transformation.
Represents serializable keyword/value map.
bool valid() const
Definition: ossimRefPtr.h:75
const char * find(const char *key) const
bool getImageGeometry(ossimKeywordlist &geomKwl, ossim_uint32 entryIndex) const
Extracts geometry info to keyword list.
static ossimString toString(bool aValue)
Numeric to string methods.
static const char * NUMBER_LINES_KW
TIFF info class.
Definition: ossimTiffInfo.h:36
ossimPixelType thePixelType
void add(const char *prefix, const ossimKeywordlist &kwl, bool overwrite=true)
ossimProjection * createProjection(const ossimFilename &filename, ossim_uint32 entryIdx) const
JP2 info class.
Definition: ossimJp2Info.h:21
unsigned int ossim_uint32
const char * chars() const
For backward compatibility.
Definition: ossimString.h:77
static ossimString downcase(const ossimString &aString)
Definition: ossimString.cpp:48
Container class that holds both 2D transform and 3D projection information for an image Only one inst...
static ossimProjectionFactoryRegistry * instance()
static const char * PIXEL_TYPE_KW
virtual bool isOpen() const
Derived classes must implement this method to be concrete.
virtual ossim_uint32 getNumberOfLines(ossim_uint32 reduced_res_level=0) const
Returns the number of lines in the image.
std::basic_istringstream< char > istringstream
Class for char input memory streams.
Definition: ossimIosFwd.h:32
std::streamoff getGeotiffBox(std::ifstream &str, std::vector< ossim_uint8 > &box) const
Method to get the embedded JP2 GeoTIFF box.
std::ifstream * m_str
static const char * NUMBER_SAMPLES_KW
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
virtual ossim_uint32 getNumberOfSamples(ossim_uint32 reduced_res_level=0) const
Returns the number of samples in the image.

◆ getImageGeometryFromGmlBox()

ossimRefPtr< ossimImageGeometry > ossimOpjJp2Reader::getImageGeometryFromGmlBox ( )
privatevirtual
Parameters
Methodto get geometry from the embedded JP2 GML Box.

Definition at line 804 of file ossimOpjJp2Reader.cpp.

805 {
806  static const char MODULE[] = "ossimOpjJp2Reader::getImageGeometryFromGmlBox";
807 
808  if (traceDebug())
809  {
810  ossimNotify(ossimNotifyLevel_DEBUG) << MODULE << " entered...\n";
811  }
813 
814  if ( isOpen() )
815  {
816  std::streamoff pos = m_str->tellg();
817 
818  m_str->seekg(0, std::ios_base::beg );
819 
820  std::vector<ossim_uint8> box;
821  ossimJp2Info jp2Info;
822 
823  std::streamoff boxPos = jp2Info.getGmlBox( *m_str, box );
824 
825  // Seek back to original position.
826  m_str->seekg(pos, std::ios_base::beg );
827 
828  if ( boxPos && box.size() )
829  {
830  if (traceDebug())
831  {
833  << "Found gml box at: " << boxPos+8
834  << "\nbox size: " << box.size() << "\n";
835  }
836 
837 #if 0
838  // This doesn't work with VS2010...
839  // Create a string stream and set the vector buffer as its source.
840  std::istringstream boxStream;
841  boxStream.rdbuf()->pubsetbuf( (char*)&box.front(), box.size() );
842 #else
843  // convert the vector into a string
844  std::string boxString( box.begin(), box.end() );
845  std::istringstream boxStream;
846  boxStream.str( boxString );
847 #endif
848 
850 
851  if ( gml->initialize( boxStream ) )
852  {
853  // Tmp drb
854  //cout << *(gml->getXmlDoc().get()) << endl;
855 
856  ossimKeywordlist geomKwl;
857  if ( gml->getImageGeometry( geomKwl ) )
858  {
859  // Make projection:
860  // Create the projection.
863  if ( proj.valid() )
864  {
865  // Create and assign projection to our ossimImageGeometry object.
866  geom = new ossimImageGeometry();
867  geom->setProjection( proj.get() );
868  if (traceDebug())
869  {
870  ossimNotify(ossimNotifyLevel_DEBUG) << "Found GMLJP2 box." << std::endl;
871  }
872  }
873  }
874  }
875 
876  // Cleanup:
877  delete gml;
878  gml = 0;
879  }
880  else // Did not find box in file.
881  {
882  m_str->clear();
883  }
884  }
885  return geom;
886 
887 } // End: ossimOpjJp2Reader::getImageGeometryFromGmlBox
void setProjection(ossimProjection *projection)
Sets the projection to be used for local-to-world coordinate transformation.
Represents serializable keyword/value map.
bool valid() const
Definition: ossimRefPtr.h:75
GML support data class.
bool getImageGeometry(ossimKeywordlist &geomKwl) const
Extracts geometry info to keyword list.
ossimProjection * createProjection(const ossimFilename &filename, ossim_uint32 entryIdx) const
JP2 info class.
Definition: ossimJp2Info.h:21
bool initialize(const ossimImageGeometry *geom, const ossimIrect &rect)
Initializes gml block from geometry file.
Container class that holds both 2D transform and 3D projection information for an image Only one inst...
static ossimProjectionFactoryRegistry * instance()
virtual bool isOpen() const
Derived classes must implement this method to be concrete.
std::basic_istringstream< char > istringstream
Class for char input memory streams.
Definition: ossimIosFwd.h:32
std::streamoff getGmlBox(std::ifstream &str, std::vector< ossim_uint8 > &box) const
Method to get the embedded JP2 GML Box.
std::ifstream * m_str
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ getImageRectangle()

ossimIrect ossimOpjJp2Reader::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 342 of file ossimOpjJp2Reader.cpp.

References getNumberOfLines(), and getNumberOfSamples().

Referenced by getOverviewTile().

343 {
344  return ossimIrect(0,
345  0,
346  getNumberOfSamples(reduced_res_level) - 1,
347  getNumberOfLines(reduced_res_level) - 1);
348 }
virtual ossim_uint32 getNumberOfLines(ossim_uint32 reduced_res_level=0) const
Returns the number of lines in the image.
virtual ossim_uint32 getNumberOfSamples(ossim_uint32 reduced_res_level=0) const
Returns the number of samples in the image.

◆ getImageTileHeight()

ossim_uint32 ossimOpjJp2Reader::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 449 of file ossimOpjJp2Reader.cpp.

References getNumberOfLines(), m_sizRecord, ossimJ2kSizRecord::m_YTOsiz, and ossimJ2kSizRecord::m_YTsiz.

450 {
451  ossim_uint32 result = 0;
453  {
455  }
456  return result;
457 }
ossim_uint32 m_YTOsiz
Vertical offset from the orgin of reference grid to the top edge of first tile.
ossim_uint32 m_YTsiz
height of one reference tile
unsigned int ossim_uint32
ossimJ2kSizRecord m_sizRecord
virtual ossim_uint32 getNumberOfLines(ossim_uint32 reduced_res_level=0) const
Returns the number of lines in the image.

◆ getImageTileWidth()

ossim_uint32 ossimOpjJp2Reader::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 439 of file ossimOpjJp2Reader.cpp.

References getNumberOfSamples(), m_sizRecord, ossimJ2kSizRecord::m_XTOsiz, and ossimJ2kSizRecord::m_XTsiz.

440 {
441  ossim_uint32 result = 0;
443  {
445  }
446  return result;
447 }
ossim_uint32 m_XTOsiz
Horizontal offset from the orgin of reference grid to the left edge of first tile.
ossim_uint32 m_XTsiz
width of one reference tile
unsigned int ossim_uint32
ossimJ2kSizRecord m_sizRecord
virtual ossim_uint32 getNumberOfSamples(ossim_uint32 reduced_res_level=0) const
Returns the number of samples in the image.

◆ getInternalImageGeometry()

ossimRefPtr< ossimImageGeometry > ossimOpjJp2Reader::getInternalImageGeometry ( )
privatevirtual
Parameters
Methodto get geometry from the embedded JP2 Boxes.

Definition at line 648 of file ossimOpjJp2Reader.cpp.

Referenced by getImageGeometry().

649 {
650  static const char MODULE[] = "ossimOpjJp2Reader::getInternalImageGeometry";
651 
652  if (traceDebug())
653  {
654  ossimNotify(ossimNotifyLevel_DEBUG) << MODULE << " entered...\n";
655  }
656 
658 
659  if ( isOpen() )
660  {
661  std::streamoff pos = m_str->tellg();
662 
663  m_str->seekg(0, std::ios_base::beg );
664 
665  // Straight up J2k has no boxes.
666  if ( ossim::getCodecFormat( m_str ) == OPJ_CODEC_JP2 )
667  {
668  m_str->seekg(4, std::ios_base::beg );
669 
670  // Try to get geom from GML box:
672 
673  if ( geom.valid() == false )
674  {
675  // Try to get geom from geotiff box:
677  }
678  }
679 
680  // Seek back to original position.
681  m_str->seekg(pos, std::ios_base::beg );
682  }
683 
684  return geom;
685 
686 } // End: ossimOpjJp2Reader::getInternalImageGeometry()
virtual ossimRefPtr< ossimImageGeometry > getImageGeometryFromGeotiffBox()
bool valid() const
Definition: ossimRefPtr.h:75
virtual bool isOpen() const
Derived classes must implement this method to be concrete.
ossim_int32 getCodecFormat(std::istream *str)
Gets codec format from magic number.
std::ifstream * m_str
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
virtual ossimRefPtr< ossimImageGeometry > getImageGeometryFromGmlBox()

◆ getLongName()

ossimString ossimOpjJp2Reader::getLongName ( ) const
virtual
Returns
"ossim open jpeg reader"

Reimplemented from ossimObject.

Definition at line 464 of file ossimOpjJp2Reader.cpp.

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

◆ getMaxPixelValue()

double ossimOpjJp2Reader::getMaxPixelValue ( ossim_uint32  band = 0) const
virtual

Returns the max pixel of the band.

Reimplemented from ossimImageHandler.

Definition at line 494 of file ossimOpjJp2Reader.cpp.

References ossimImageData::getMaxPix(), m_tile, and ossimRefPtr< T >::valid().

495 {
496 
497  if (m_tile.valid())
498  {
499  return m_tile->getMaxPix(band);
500  }
501  return 255.0;
502 }
virtual const ossim_float64 * getMaxPix() const
bool valid() const
Definition: ossimRefPtr.h:75
ossimRefPtr< ossimImageData > m_tile

◆ getMetadataImageGeometry()

ossimRefPtr< ossimImageGeometry > ossimOpjJp2Reader::getMetadataImageGeometry ( ) const
private
Parameters
Methodto get geometry from the various external files like .prj, .j2w .xml and so on.

Definition at line 889 of file ossimOpjJp2Reader.cpp.

Referenced by getImageGeometry().

890 {
891  static const char M[] = "ossimOpjJp2Reader::getMetadataImageGeometry";
892  if ( traceDebug() )
893  {
894  ossimNotify(ossimNotifyLevel_DEBUG) << M << " entered...\n";
895  }
896 
899 
900  // See if we can pick up the projection from the FGDC file:
901  ossimFilename fdgcFile = theImageFile;
902 
903  fdgcFile += ".xml"; // file.jp2.xml
904  if ( fdgcFile.exists() == false )
905  {
906  fdgcFile = theImageFile;
907  fdgcFile.setExtension(ossimString("xml")); // file.xml
908  }
909 
910  if ( fdgcFile.exists() )
911  {
912  ossimFgdcXmlDoc fgdcDoc;
913  if ( fgdcDoc.open(fdgcFile) )
914  {
915  try
916  {
917  proj = fgdcDoc.getGridCoordSysProjection();
918  }
919  catch (const ossimException& e)
920  {
921  ossimNotify(ossimNotifyLevel_WARN) << e.what() << std::endl;
922  }
923 
924  if ( proj.valid() )
925  {
926  geom = new ossimImageGeometry();
927 
928  ossimMapProjection* mapProj = dynamic_cast<ossimMapProjection*>(proj.get());
929  if ( mapProj )
930  {
931  // See if we have a world file. Seems they have a more accurate tie point.
932  ossimFilename worldFile = theImageFile;
933  worldFile.setExtension(ossimString("j2w")); // file.j2w
934  if ( worldFile.exists() )
935  {
936  //---
937  // Note need a way to determine pixel type from fgdc doc.
938  // This can result in a half pixel shift.
939  //---
941  ossimUnitType unitType = fgdcDoc.getUnitType();
942 
943  ossimTiffWorld tfw;
944  if ( tfw.open(worldFile, pixelType, unitType) )
945  {
946  ossimDpt gsd = tfw.getScale();
947  gsd.y = std::fabs(gsd.y); // y positive up so negate.
948  ossimDpt tie = tfw.getTranslation();
949 
950  if ( unitType != OSSIM_METERS )
951  {
953 
954  // GSD (scale):
955  uct.setValue(gsd.x, unitType);
956  gsd.x = uct.getValue(OSSIM_METERS);
957  uct.setValue(gsd.y, unitType);
958  gsd.y = uct.getValue(OSSIM_METERS);
959 
960  // Tie point:
961  uct.setValue(tie.x, unitType);
962  tie.x = uct.getValue(OSSIM_METERS);
963  uct.setValue(tie.y, unitType);
964  tie.y = uct.getValue(OSSIM_METERS);
965  }
966 
967  mapProj->setMetersPerPixel(gsd);
968  mapProj->setUlTiePoints(tie);
969  }
970 
971  if ( tfw.getRotation() != 0.0 )
972  {
974  << M << " Unhandled rotation in tfw file." << std::endl;
975  }
976  }
977 
978  } // if ( worldFile.exists() )
979 
980  geom->setProjection( proj.get() );
981 
982  } // if ( proj.valid() )
983 
984  } // if ( fgdcDoc.open(fdgcFile) )
985 
986  } // if ( fdgcFile.exists() )
987 
988  if (traceDebug())
989  {
991  << M << " exit status = " << (geom.valid()?"true":"false\n")
992  << std::endl;
993  }
994 
995  return geom;
996 }
bool open(const ossimFilename &file, ossimPixelType ptype, ossimUnitType unit)
double getValue(ossimUnitType unitType=OSSIM_METERS) const
void setProjection(ossimProjection *projection)
Sets the projection to be used for local-to-world coordinate transformation.
ossimFilename theImageFile
ossimUnitType
bool valid() const
Definition: ossimRefPtr.h:75
void setValue(double value, ossimUnitType unitType=OSSIM_METERS)
double y
Definition: ossimDpt.h:165
ossimRefPtr< ossimProjection > getGridCoordSysProjection()
Gets projection from Grid Coordinate system node.
virtual void setMetersPerPixel(const ossimDpt &gsd)
bool exists() const
virtual const char * what() const
Returns the error message.
Class for FGDC XML doc parsing.
Container class that holds both 2D transform and 3D projection information for an image Only one inst...
ossimPixelType
const ossimDpt & getScale() const
Converts world file parameters into x, y scale (for use in affine transform)
double x
Definition: ossimDpt.h:164
const ossimDpt & getTranslation() const
Provides access to the translation (for use in affine transform)
virtual void setUlTiePoints(const ossimGpt &gpt)
bool open(const ossimFilename &xmlFileName)
Open method.
double getRotation() const
Converts world file parameters into RH rotation in radians (for use in affine transform) ...
ossimFilename & setExtension(const ossimString &e)
Sets the extension of a file name.
ossimUnitType getUnitType() const
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ getNumberOfDecimationLevels()

ossim_uint32 ossimOpjJp2Reader::getNumberOfDecimationLevels ( ) const
virtual

Returns the number of decimation levels.

This returns the total number of decimation levels. It is important to note that res level 0 or full resolution is included in the list and has decimation values 1.0, 1.0

Returns
The number of decimation levels.

Reimplemented from ossimImageHandler.

Definition at line 367 of file ossimOpjJp2Reader.cpp.

References ossimImageHandler::getNumberOfDecimationLevels(), m_minDwtLevels, ossimImageHandler::theOverview, and ossimRefPtr< T >::valid().

368 {
369  ossim_uint32 result = 1; // Add r0
370 
371  if (m_minDwtLevels)
372  {
373  //---
374  // Add internal overviews.
375  //---
376  result += m_minDwtLevels;
377  }
378 
379  if (theOverview.valid())
380  {
381  //---
382  // Add external overviews.
383  //---
385  }
386 
387  return result;
388 }
bool valid() const
Definition: ossimRefPtr.h:75
virtual ossim_uint32 getNumberOfDecimationLevels() const
This returns the total number of decimation levels.
ossim_uint32 m_minDwtLevels
unsigned int ossim_uint32
ossimRefPtr< ossimImageHandler > theOverview

◆ getNumberOfInputBands()

ossim_uint32 ossimOpjJp2Reader::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 ossimOpjJp2Reader.cpp.

References ossimJ2kSizRecord::m_Csiz, and m_sizRecord.

475 {
476  return m_sizRecord.m_Csiz;
477 }
ossim_uint16 m_Csiz
number of component in the image
ossimJ2kSizRecord m_sizRecord

◆ getNumberOfLines()

ossim_uint32 ossimOpjJp2Reader::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 390 of file ossimOpjJp2Reader.cpp.

References ossimImageHandler::getNumberOfLines(), ossimImageHandler::isValidRLevel(), m_minDwtLevels, m_sizRecord, ossimJ2kSizRecord::m_YOsiz, ossimJ2kSizRecord::m_Ysiz, ossimImageHandler::theOverview, ossimRefPtr< T >::valid(), x, and y.

Referenced by getImageRectangle(), and getImageTileHeight().

391 {
392  ossim_uint32 result = 0;
393  if ( isValidRLevel(resLevel) )
394  {
395  if (resLevel <= m_minDwtLevels)
396  {
398  if ( resLevel )
399  {
400  ossim_float32 x = 2.0;
401  ossim_float32 y = resLevel;
402  result = (ossim_uint32) result / std::pow(x, y);
403  }
404  }
405  else if (theOverview.valid())
406  {
407  result = theOverview->getNumberOfLines(resLevel);
408  }
409  }
410  return result;
411 }
ossim_uint32 x
ossim_uint32 y
bool valid() const
Definition: ossimRefPtr.h:75
float ossim_float32
virtual ossim_uint32 getNumberOfLines(ossim_uint32 resLevel=0) const =0
Pure virtual, derived classes must implement.
virtual bool isValidRLevel(ossim_uint32 resLevel) const
Determines if the passed in reslution level is valid.
ossim_uint32 m_minDwtLevels
unsigned int ossim_uint32
ossimRefPtr< ossimImageHandler > theOverview
ossimJ2kSizRecord m_sizRecord
ossim_uint32 m_YOsiz
Vertical offset from the orgin of reference grid to the top of image.
ossim_uint32 m_Ysiz
height of reference grid

◆ getNumberOfOutputBands()

ossim_uint32 ossimOpjJp2Reader::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 479 of file ossimOpjJp2Reader.cpp.

References ossimJ2kSizRecord::m_Csiz, and m_sizRecord.

480 {
481  return m_sizRecord.m_Csiz;
482 }
ossim_uint16 m_Csiz
number of component in the image
ossimJ2kSizRecord m_sizRecord

◆ getNumberOfSamples()

ossim_uint32 ossimOpjJp2Reader::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 413 of file ossimOpjJp2Reader.cpp.

References ossimImageHandler::getNumberOfLines(), ossimImageHandler::isValidRLevel(), m_minDwtLevels, m_sizRecord, ossimJ2kSizRecord::m_XOsiz, ossimJ2kSizRecord::m_Xsiz, ossimImageHandler::theOverview, ossimRefPtr< T >::valid(), x, and y.

Referenced by getImageRectangle(), and getImageTileWidth().

414 {
415  ossim_uint32 result = 0;
416  if ( isValidRLevel(resLevel) )
417  {
418  if (resLevel <= m_minDwtLevels)
419  {
421  if ( resLevel )
422  {
423  ossim_float32 x = 2.0;
424  ossim_float32 y = resLevel;
425  result = (ossim_uint32) result / std::pow(x, y);
426  }
427  }
428  else if (theOverview.valid())
429  {
430  result = theOverview->getNumberOfLines(resLevel);
431  }
432  }
433  return result;
434 }
ossim_uint32 x
ossim_uint32 m_Xsiz
width of reference grid
ossim_uint32 y
bool valid() const
Definition: ossimRefPtr.h:75
float ossim_float32
virtual ossim_uint32 getNumberOfLines(ossim_uint32 resLevel=0) const =0
Pure virtual, derived classes must implement.
virtual bool isValidRLevel(ossim_uint32 resLevel) const
Determines if the passed in reslution level is valid.
ossim_uint32 m_XOsiz
Horizontal offset from the orgin of reference grid to the left side of image.
ossim_uint32 m_minDwtLevels
unsigned int ossim_uint32
ossimRefPtr< ossimImageHandler > theOverview
ossimJ2kSizRecord m_sizRecord

◆ getOutputScalarType()

ossimScalarType ossimOpjJp2Reader::getOutputScalarType ( ) const
virtual

Returns the output pixel type of the tile source.

Reimplemented from ossimImageSource.

Definition at line 484 of file ossimOpjJp2Reader.cpp.

References ossimJ2kSizRecord::getScalarType(), and m_sizRecord.

485 {
486  return m_sizRecord.getScalarType();
487 }
ossimJ2kSizRecord m_sizRecord
ossimScalarType getScalarType() const
Gets the scalar type.

◆ getOverviewTile()

bool ossimOpjJp2Reader::getOverviewTile ( ossim_uint32  resLevel,
ossimImageData result 
)
protectedvirtual

Gets an overview tile.

Overrides ossimImageHandler::getOverviewTile

Parameters
resLevelThe resolution level to pull from with resLevel 0 being full res.
resultThe tile to stuff. Note The requested rectangle in full image space and bands should be set in the result tile prior to passing. This method will subtract the subImageOffset if needed for external overview call since they do not know about the sub image offset.
Returns
true on success false on error. Typically this will return false if resLevel==0 unless the overview has r0. If return is false, result is undefined so caller should handle appropriately with makeBlank or whatever.

Reimplemented from ossimImageHandler.

Definition at line 216 of file ossimOpjJp2Reader.cpp.

References ossimIrect::clipToRect(), getImageRectangle(), ossimImageData::getImageRectangle(), m_minDwtLevels, m_sizRecord, ossimJ2kSizRecord::m_XOsiz, ossimJ2kSizRecord::m_YOsiz, and status.

Referenced by getTile().

218 {
219  bool status = false;
220 
221  if ( result )
222  {
223  if (resLevel <= m_minDwtLevels)
224  {
225  // Using internal overviews.
226 
227  //---
228  // NOTE:
229  //
230  // The geojp2 doqq's that I have all have an offset in them. In
231  // other words the "pos" from "get_dims" is not always 0,0. I
232  // think this was intended for mosaicing without any projection. I
233  // do NOT think it was intended to be used as a sub image offset
234  // into the projection picked up by the geotiff_box. If this were
235  // so the current code here would not mosaic correctly.
236  //
237  // This may not be the case though with all data sets... In which
238  // case some kind of logic would have to be added to this code.
239 
240  ossimIrect tileRect = result->getImageRectangle();
241  ossimIrect imageRect = getImageRectangle( resLevel );
242  ossimIrect clipRect = tileRect.clipToRect(imageRect);
243 
246 
247  // tmp drb...
248  // ossimIrect rect(0,0,255,255);
249 
250  ossimIrect shiftedRect = clipRect + offset;
251  if ( traceDebug() )
252  {
254  << "ossimOpjJp2Reader::getOverviewTile DEBUG:"
255  << "\ntile rect: " << tileRect
256  << "\nimageRect: " << imageRect
257  << "\nclipRect: " << clipRect
258  << "\nshiftedRect: " << shiftedRect
259  << "\noffset: " << offset
260  << "\nresLevel: " << resLevel
261  << std::endl;
262  }
263 
264  m_cacheTile->setImageRectangle( clipRect );
265 
266  try
267  {
269  shiftedRect,
270  resLevel,
271  m_format,
272  0,
273  m_cacheTile.get() );
274 
275  if ( status )
276  {
277 
278  result->loadTile(m_cacheTile->getBuf(), clipRect, OSSIM_BSQ);
279  result->validate();
280  }
281  }
282  catch( const ossimException& e )
283  {
285  << __FILE__ << " " << __LINE__ << " caught exception\n"
286  << e.what() << "\n File:" << this->theImageFile << "\n";
287  status = false;
288  }
289  catch( ... )
290  {
292  << __FILE__ << " " << __LINE__ << " caught unknown exception\n";
293  }
294 
295  // result->setImageRectangle(originalTileRect);
296 
297  try
298  {
299 #if 0
300  if ( theChannels )
301  {
302  status = ossim::copyRegionToTile(theChannels,
303  theCodestream,
304  static_cast<int>(resLevel),
305  theThreadEnv,
306  theOpenTileThreadQueue,
307  result);
308  }
309  else
310  {
311  status = ossim::copyRegionToTile(theCodestream,
312  static_cast<int>(resLevel),
313  theThreadEnv,
314  theOpenTileThreadQueue,
315  result);
316  }
317 #endif
318  }
319  catch(const ossimException& e)
320  {
322  << __FILE__ << " " << __LINE__ << " caught exception\n"
323  << e.what();
324  status = false;
325  }
326 
327  // Set the rect back.
328  // result->setImageRectangle(originalTileRect);
329 
330  } // matches: if (resLevel <= theMinDwtLevels)
331  else
332  {
333  // Using external overview.
334  status = theOverview->getTile(result, resLevel);
335  }
336  }
337 
338  return status;
339 }
ossimFilename theImageFile
virtual void setImageRectangle(const ossimIrect &rect)
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...
virtual void loadTile(const void *src, const ossimIrect &src_rect, ossimInterleaveType il_type)
ossim_uint32 m_XOsiz
Horizontal offset from the orgin of reference grid to the left side of image.
virtual ossimDataObjectStatus validate() const
virtual const char * what() const
Returns the error message.
ossim_uint32 m_minDwtLevels
virtual ossimIrect getImageRectangle() const
ossimIrect clipToRect(const ossimIrect &rect) const
Definition: ossimIrect.cpp:501
bool opj_decode(std::ifstream *in, const ossimIrect &rect, ossim_uint32 resLevel, ossim_int32 format, std::streamoff fileOffset, ossimImageData *tile)
ossimRefPtr< ossimImageData > m_cacheTile
return status
ossimRefPtr< ossimImageHandler > theOverview
bool copyRegionToTile(kdu_supp::kdu_channel_mapping *channelMapping, kdu_core::kdu_codestream &codestream, int discard_levels, kdu_core::kdu_thread_env *threadEnv, kdu_core::kdu_thread_queue *threadQueue, ossimImageData *destTile)
Copies region from codestream to tile at a given rlevel.
virtual const void * getBuf() const
ossimJ2kSizRecord m_sizRecord
std::ifstream * m_str
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
ossim_uint32 m_YOsiz
Vertical offset from the orgin of reference grid to the top of image.
int ossim_int32
virtual ossimRefPtr< ossimImageData > getTile(const ossimIpt &origin, ossim_uint32 resLevel=0)

◆ getShortName()

ossimString ossimOpjJp2Reader::getShortName ( ) const
virtual
Returns
"ossim_openjpeg_reader"

Reimplemented from ossimObject.

Definition at line 459 of file ossimOpjJp2Reader.cpp.

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

◆ getTile()

ossimRefPtr< ossimImageData > ossimOpjJp2Reader::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 189 of file ossimOpjJp2Reader.cpp.

References allocate(), ossimRefPtr< T >::get(), getOverviewTile(), isOpen(), ossimSource::isSourceEnabled(), ossimImageHandler::isValidRLevel(), m_tile, ossimImageData::makeBlank(), ossimImageData::setImageRectangle(), and ossimRefPtr< T >::valid().

191 {
192  ossimRefPtr<ossimImageData> result = 0;
193 
194  if( isSourceEnabled() && isOpen() && isValidRLevel(resLevel) )
195  {
196  if ( m_tile.valid() == false )
197  {
198  allocate(); // First time though.
199  }
200 
201  // Rectangle must be set prior to getOverviewTile call.
202  m_tile->setImageRectangle(rect);
203 
204  // tmp drb...
205  m_tile->makeBlank();
206 
207  if ( getOverviewTile( resLevel, m_tile.get() ) )
208  {
209  result = m_tile.get();
210  }
211  }
212 
213  return result;
214 }
virtual bool isSourceEnabled() const
Definition: ossimSource.cpp:79
void allocate()
Initializes tiles.
virtual void setImageRectangle(const ossimIrect &rect)
bool valid() const
Definition: ossimRefPtr.h:75
ossimRefPtr< ossimImageData > m_tile
virtual bool isValidRLevel(ossim_uint32 resLevel) const
Determines if the passed in reslution level is valid.
virtual void makeBlank()
Initializes data to null pixel values.
virtual bool isOpen() const
Derived classes must implement this method to be concrete.
virtual bool getOverviewTile(ossim_uint32 resLevel, ossimImageData *result)
Gets an overview tile.

◆ initCodRecord()

bool ossimOpjJp2Reader::initCodRecord ( std::istream *  str,
ossimJ2kCodRecord sizRecord 
) const
private

Definition at line 558 of file ossimOpjJp2Reader.cpp.

References ossimJ2kCodRecord::parseStream().

560 {
561  bool result = false;
562 
563  if ( str )
564  {
565  if ( str->good() )
566  {
567  // Looking for COD marker: 0xff, 0x51
568  const ossim_uint8 AFF = 0xff;
569  const ossim_uint8 A52 = 0x52;
570 
571  union
572  {
573  char c;
574  ossim_uint8 uc;
575  } ct;
576 
577  // Read in the box.
578  while ( str->get( ct.c ) )
579  {
580  if ( ct.uc == AFF ) // Found FF byte.
581  {
582  if ( str->get( ct.c ) )
583  {
584  if ( ct.uc == A52 ) // Found 52 byte.
585  {
586  codRecord.parseStream( *str );
587  result = true;
588  break;
589  }
590  }
591  }
592  }
593  }
594  }
595 
596  return result;
597 }
unsigned char ossim_uint8

◆ initSizRecord()

bool ossimOpjJp2Reader::initSizRecord ( std::istream *  str,
ossimJ2kSizRecord sizRecord 
) const
private

Definition at line 504 of file ossimOpjJp2Reader.cpp.

References ossimJ2kSizRecord::parseStream().

506 {
507  bool result = false;
508 
509  if ( str )
510  {
511  if ( str->good() )
512  {
513  // Looking for SOC, SIZ markers: 0xff, 0x4f, 0xff, 0x51
514  const ossim_uint8 AFF = 0xff;
515  const ossim_uint8 A4F = 0x4f;
516  const ossim_uint8 A51 = 0x51;
517 
518  union
519  {
520  char c;
521  ossim_uint8 uc;
522  } ct;
523 
524  // Read in the box.
525  while ( str->get( ct.c ) )
526  {
527  if ( ct.uc == AFF ) // Found FF byte.
528  {
529  if ( str->get( ct.c ) )
530  {
531  if ( ct.uc == A4F ) // Found 4F byte.
532  {
533  if ( str->get( ct.c ) )
534  {
535  if ( ct.uc == AFF ) // Found FF byte.
536  {
537  if ( str->get( ct.c ) )
538  {
539  if ( ct.uc == A51 ) // Found 51 byte.
540  {
541  sizRecord.parseStream( *str );
542  result = true;
543  break;
544  }
545  }
546  }
547  }
548  }
549  }
550  }
551  }
552  }
553  }
554 
555  return result;
556 }
unsigned char ossim_uint8
void parseStream(ossim::istream &in)
Parse method.

◆ isOpen()

bool ossimOpjJp2Reader::isOpen ( ) const
virtual

Derived classes must implement this method to be concrete.

Returns
true if open, false if not.

Implements ossimImageHandler.

Definition at line 489 of file ossimOpjJp2Reader.cpp.

References m_str.

Referenced by getTile().

490 {
491  return m_str ? m_str->is_open() : false;
492 }
std::ifstream * m_str

◆ loadState()

bool ossimOpjJp2Reader::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 356 of file ossimOpjJp2Reader.cpp.

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

358 {
359  if (ossimImageHandler::loadState(kwl, prefix))
360  {
361  return open();
362  }
363 
364  return false;
365 }
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 ossimOpjJp2Reader::open ( )
virtual

open method.

Returns
true on success, false on error.

Implements ossimImageHandler.

Definition at line 100 of file ossimOpjJp2Reader.cpp.

Referenced by loadState().

101 {
102  static const char MODULE[] = "ossimOpjJp2Reader::open";
103 
104  if (traceDebug())
105  {
107  << MODULE << " entered..."
108  << "\nFile: " << theImageFile.c_str()
109  << std::endl;
110  }
111 
112  bool status = false;
113 
114  close();
115 
116  if ( theImageFile.size() )
117  {
118  m_str = new std::ifstream();
119  m_str->open( theImageFile.string().c_str(), std::ios_base::in | std::ios_base::binary);
120 
121  if ( m_str->good() )
122  {
124 
125  if ( m_format != OPJ_CODEC_UNKNOWN )
126  {
127  m_str->seekg(0, ios_base::beg);
128  if ( initSizRecord( m_str, m_sizRecord ) )
129  {
130  ossimJ2kCodRecord codRecord;
131  status = initCodRecord( m_str, codRecord );
132 
133  if ( status )
134  {
135  // Number of built in reduced res sets.
137 
138  // Put the stream back:
139  m_str->seekg(0, ios_base::beg);
140 
141  if ( traceDebug() )
142  {
144  << " DEBUG: J2K COD RECORD:\n"
145  << codRecord
146  << "\n";
147  }
148  }
149  }
150  }
151 
152  if ( status && traceDebug() )
153  {
155  << " DEBUG: J2K SIZ RECORD:\n"
156  << m_sizRecord
157  << "\n";
158  }
159  }
160  else if ( traceDebug() )
161  {
163  << "Cannot open: " << theImageFile.c_str() << "\n";
164  }
165 
166  }
167 
168  if ( !status )
169  {
170  m_str->close();
171  delete m_str;
172  m_str = 0;
173  }
174 
175  if (traceDebug())
176  {
178  << MODULE << " exit status " << (status?"true\n":"false\n");
179  }
180  return status;
181 }
ossimFilename theImageFile
std::basic_ifstream< char > ifstream
Class for char input file streams.
Definition: ossimIosFwd.h:44
virtual void close()
close method
bool initSizRecord(std::istream *str, ossimJ2kSizRecord &sizRecord) const
bool initCodRecord(std::istream *str, ossimJ2kCodRecord &sizRecord) const
std::string::size_type size() const
Definition: ossimString.h:405
ossim_uint32 m_minDwtLevels
ossim_uint8 m_numberOfDecompositionLevels
SPcod - Number of decomposition levels.
return status
ossimJ2kSizRecord m_sizRecord
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
ossim_int32 getCodecFormat(std::istream *str)
Gets codec format from magic number.
std::ifstream * m_str
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
const std::string & string() const
Definition: ossimString.h:414

◆ saveState()

bool ossimOpjJp2Reader::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 350 of file ossimOpjJp2Reader.cpp.

References ossimImageHandler::saveState().

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

Member Data Documentation

◆ m_cacheTile

ossimRefPtr<ossimImageData> ossimOpjJp2Reader::m_cacheTile
private

Definition at line 224 of file ossimOpjJp2Reader.h.

Referenced by allocate(), and destroy().

◆ m_format

ossim_int32 ossimOpjJp2Reader::m_format
private

Definition at line 227 of file ossimOpjJp2Reader.h.

◆ m_minDwtLevels

ossim_uint32 ossimOpjJp2Reader::m_minDwtLevels
private

◆ m_sizRecord

ossimJ2kSizRecord ossimOpjJp2Reader::m_sizRecord
private

◆ m_str

std::ifstream* ossimOpjJp2Reader::m_str
private

Definition at line 225 of file ossimOpjJp2Reader.h.

Referenced by destroy(), and isOpen().

◆ m_tile

ossimRefPtr<ossimImageData> ossimOpjJp2Reader::m_tile
private

Definition at line 223 of file ossimOpjJp2Reader.h.

Referenced by allocate(), destroy(), getMaxPixelValue(), and getTile().


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