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

#include <ossimJpegTileSource.h>

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

Classes

class  PrivateData
 

Public Member Functions

 ossimJpegTileSource ()
 
 ossimJpegTileSource (const ossimKeywordlist &kwl, const char *prefix=0)
 
 ossimJpegTileSource (const char *jpeg_file)
 
virtual ossimString getShortName () const
 
virtual ossimString getLongName () 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 getTileWidth () const
 Returns the width of the output tile. More...
 
virtual ossim_uint32 getTileHeight () const
 Returns the height of the output tile. 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 isValidRLevel (ossim_uint32 reduced_res_level) const
 Determines if the passed in reslution level is valid. More...
 
bool isOpen () const
 Derived classes must implement this method to be concrete. More...
 
bool open (const ossimFilename &jpeg_file)
 Returns true if the image_file can be opened and is a valid tiff file. More...
 
virtual void close ()
 Deletes the overview and clears the valid image vertices. More...
 
virtual ossimRefPtr< ossimPropertygetProperty (const ossimString &name) const
 Gets a property for matching name. More...
 
virtual void getPropertyNames (std::vector< ossimString > &propertyNames) const
 Gets a list of property names available. 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 (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...
 
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 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)
 
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 void getBoundingRect (ossimIrect &rect, ossim_uint32 resLevel=0) const
 Gets the bounding rectangle of the source. More...
 
virtual void getValidImageVertices (std::vector< ossimIpt > &validVertices, ossimVertexOrdering ordering=OSSIM_CLOCKWISE_ORDER, ossim_uint32 resLevel=0) const
 ordering specifies how the vertices should be arranged. More...
 
virtual void setImageGeometry (const ossimImageGeometry *geom)
 Default implementation sets geometry of the first input to the geometry specified. More...
 
virtual bool isIndexedData () const
 
- Public Member Functions inherited from ossimSource
 ossimSource (ossimObject *owner=0)
 
 ossimSource (ossimObject *owner, ossim_uint32 inputListSize, ossim_uint32 outputListSize, bool inputListIsFixedFlag=true, bool outputListIsFixedFlag=true)
 
virtual ~ossimSource ()
 
virtual bool isSourceEnabled () const
 
virtual void enableSource ()
 
virtual void disableSource ()
 
virtual bool getEnableFlag () const
 
virtual void setEnableFlag (bool flag)
 
virtual bool isInitialized () const
 
virtual void setInitializedFlag (bool flag)
 
virtual std::ostream & print (std::ostream &out) const
 Outputs theErrorStatus as an ossimErrorCode and an ossimString. More...
 
- Public Member Functions inherited from ossimConnectableObject
 ossimConnectableObject (ossimObject *owner=0)
 Base constructor of this object. More...
 
 ossimConnectableObject (ossimObject *owner, ossim_int32 inputListSize, ossim_int32 outputListSize, bool inputListIsFixedFlag=true, bool outputListIsFixedFlag=true)
 
virtual ~ossimConnectableObject ()
 
void setId (const ossimId &id)
 All connectable objects will have id's. More...
 
const ossimIdgetId () const
 Will allow us to get this object's id. More...
 
const ossimObjectgetOwner () const
 Fetches the current owner, most likely a container but not limited to one. More...
 
virtual void changeOwner (ossimObject *owner)
 Permits changing the object's owner. More...
 
virtual void setDescription (const ossimString &description)
 
virtual ossimString getDescription () const
 
virtual bool isConnected (ossimConnectableObjectDirectionType direction=CONNECTABLE_DIRECTION_INPUT) const
 will check the direction specified to see if all slots are full. More...
 
 OSSIM_DEPRECATE_METHOD (virtual ossimConnectableObject *findConnectableObject(const ossimId &id))
 
 OSSIM_DEPRECATE_METHOD (virtual ossimConnectableObject *findObjectOfType(RTTItypeid typeId, ossimConnectableObjectDirectionType directionType, bool recurse=true))
 
 OSSIM_DEPRECATE_METHOD (virtual ossimConnectableObject *findObjectOfType(const ossimString &obj, ossimConnectableObjectDirectionType directionType, bool recurse=true))
 
 OSSIM_DEPRECATE_METHOD (virtual ossimConnectableObject *findInputObjectOfType(const ossimString &className))
 
virtual ossim_int32 findInputIndex (const ossimConnectableObject *object)
 Return a valid index of the input list if the passed in object is found else return -1. More...
 
virtual ossim_int32 findInputIndex (const ossimId &id)
 Return a valid index of the input list if the passed id is found else return -1. More...
 
virtual ossim_int32 findOutputIndex (const ossimConnectableObject *object)
 Return a valid index of the output list if the passed in object is found else return -1. More...
 
virtual ossim_int32 findOutputIndex (const ossimId &id)
 Return a valid index of the output list if the passed in object is found else return -1. More...
 
virtual ossim_int32 getMyInputIndexToConnectTo (ossimConnectableObject *object) const
 Should return the first available index to connect to. More...
 
virtual ossim_int32 getMyOutputIndexToConnectTo (ossimConnectableObject *object) const
 Should return the first available index to connect to. More...
 
virtual bool canConnectMyOutputTo (ossim_int32 myOutputIndex, const ossimConnectableObject *object) const
 default implementation is to allow anyone to connect to us. More...
 
virtual void disconnect (ossimConnectableObject *object=0)
 Will disconnect the object passed in. More...
 
virtual void disconnect (const ossimId &id)
 Will disconnect the object passed in. More...
 
virtual ossimRefPtr< ossimConnectableObjectdisconnectMyInput (ossim_int32 inputIndex, bool disconnectOutputFlag=true, bool createEventFlag=true)
 Will disconnect the object at the given input index and generate a connection event. More...
 
virtual void disconnectMyInput (ossimConnectableObject *input, bool disconnectOutputFlag=true, bool createEventFlag=true)
 Finds the index of the passed in input and calls disconnectMyInput(inputIndex, disconnectOutputFlag, createEventFlag);. More...
 
virtual void disconnectMyInputs (ConnectableObjectList &inputList, bool disconnectOutputFlag=true, bool createEventFlag=true)
 
virtual ossimRefPtr< ossimConnectableObjectdisconnectMyOutput (ossim_int32 outputIndex, bool disconnectInputFlag=true, bool createEventFlag=true)
 Will disconnect the object at the given output index and generate a connection event. More...
 
virtual void disconnectMyOutput (ossimConnectableObject *output, bool disconnectInputFlag=true, bool createEventFlag=true)
 Will disconnect the output object. More...
 
virtual void disconnectMyOutputs (ConnectableObjectList &outputList, bool disconnectOutputFlag=true, bool createEventFlag=true)
 
virtual void disconnectAllInputs ()
 Will disconnect all of the input objects. More...
 
virtual void disconnectAllOutputs ()
 Will disconnect all of the output objects. More...
 
virtual ossim_int32 connectMyInputTo (ossimConnectableObject *inputObject, bool makeOutputConnection=true, bool createEventFlag=true)
 Will try to connect this objects input to the passed in object. More...
 
virtual ossim_int32 connectMyInputTo (ossim_int32 inputIndex, ossimConnectableObject *inputObject, bool makeOutputConnection=true, bool createEventFlag=true)
 Will connect the specified input to the passed in object. More...
 
virtual bool connectMyInputTo (ConnectableObjectList &inputList, bool makeOutputConnection=true, bool createEventFlag=true)
 
virtual ossim_int32 connectMyOutputTo (ossimConnectableObject *outputObject, bool makeInputConnection=true, bool createEventFlag=true)
 Will try to connect this objects output to the passed in object. More...
 
virtual bool connectMyOutputTo (ConnectableObjectList &outputList, bool makeInputConnection=true, bool createEventFlag=true)
 
virtual bool connectInputList (ConnectableObjectList &inputList)
 Will disconnect itself from all inputs and reset to the passed in input list. More...
 
virtual bool connectOutputList (ConnectableObjectList &outputList)
 Will disconnect itself from all outputs and reset to the passed in output list. More...
 
virtual ossim_uint32 getNumberOfInputs () const
 Returns the number of input objects. More...
 
virtual ossim_uint32 getNumberOfOutputs () const
 Return the number of output objects. More...
 
ossimConnectableObjectgetInput (ossim_uint32 index=0)
 returns the object at the specified index. More...
 
const ossimConnectableObjectgetInput (ossim_uint32 index=0) const
 returns the object at the specified index. More...
 
ossimConnectableObjectgetOutput (ossim_uint32 index=0)
 returns the object at the specified index. More...
 
const ossimConnectableObjectgetOutput (ossim_uint32 index=0) const
 returns the object at the specified index. More...
 
virtual void setNumberOfInputs (ossim_int32 numberOfInputs)
 Will set the number of inputs. More...
 
virtual bool getInputListIsFixedFlag () const
 
virtual bool getOutputListIsFixedFlag () const
 
virtual void setNumberOfOutputs (ossim_int32 numberOfInputs)
 Will set the number of outputs. More...
 
const ConnectableObjectListgetInputList () const
 
const ConnectableObjectListgetOutputList () const
 
ConnectableObjectListgetInputList ()
 
ConnectableObjectListgetOutputList ()
 
 OSSIM_DEPRECATE_METHOD (virtual void findAllObjectsOfType(ConnectableObjectList &result, const RTTItypeid &typeInfo, bool recurse=true))
 
 OSSIM_DEPRECATE_METHOD (virtual void findAllObjectsOfType(ConnectableObjectList &result, const ossimString &className, bool recurse=true))
 
virtual void propagateEventToOutputs (ossimEvent &event)
 
virtual void propagateEventToInputs (ossimEvent &event)
 
virtual void setProperty (const ossimString &name, const ossimString &value)
 
virtual ossim_uint32 saveStateOfAllInputs (ossimKeywordlist &kwl, bool saveThisStateFlag=true, ossim_uint32 objectIndex=1, const char *prefix=0) const
 Save the state of all inputs to a keyword list. More...
 
virtual bool fillContainer (ossimConnectableContainer &container)
 Inserts this object and all of its children and inputs into the container provided. More...
 
bool moveInputUp (const ossimId &id)
 Moves the input connection matching id up one in the connection list. More...
 
bool moveInputDown (const ossimId &id)
 Moves the input connection matching id down one in the connection list. More...
 
bool moveInputToTop (const ossimId &id)
 Moves the input connection matching id to the top of the connection list. More...
 
bool moveInputToBottom (const ossimId &id)
 Moves the input connection matching id to the bottom of the connection list. More...
 
virtual void accept (ossimVisitor &visitor)
 We will add a visitor interface for all connectable objects. More...
 
- Public Member Functions inherited from ossimObject
 ossimObject ()
 
virtual ~ossimObject ()
 
virtual ossimObjectdup () const
 
virtual ossimString getClassName () const
 
virtual RTTItypeid getType () const
 
virtual bool canCastTo (ossimObject *obj) const
 
virtual bool canCastTo (const RTTItypeid &id) const
 
virtual bool canCastTo (const ossimString &parentClassName) const
 
virtual bool isEqualTo (const ossimObject &obj, ossimCompareType compareType=OSSIM_COMPARE_FULL) const
 
- Public Member Functions inherited from ossimReferenced
 ossimReferenced ()
 
 ossimReferenced (const ossimReferenced &)
 
ossimReferencedoperator= (const ossimReferenced &)
 
void ref () const
 increment the reference count by one, indicating that this object has another pointer which is referencing it. More...
 
void unref () const
 decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 
void unref_nodelete () const
 decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 
int referenceCount () const
 
- Public Member Functions inherited from ossimListenerManager
 ossimListenerManager ()
 
virtual ~ossimListenerManager ()
 
virtual void fireEvent (ossimEvent &event)
 
virtual bool addListener (ossimListener *listener)
 
virtual bool removeListener (ossimListener *listener)
 
virtual bool findListener (ossimListener *listener)
 
- Public Member Functions inherited from ossimPropertyInterface
 ossimPropertyInterface ()
 
virtual ~ossimPropertyInterface ()
 
virtual ossimString getPropertyValueAsString (const ossimString &name) const
 
void getPropertyList (std::vector< ossimRefPtr< ossimProperty > > &propertyList) const
 
void setProperties (std::vector< ossimRefPtr< ossimProperty > > &propertyList)
 
- Public Member Functions inherited from ossimErrorStatusInterface
 ossimErrorStatusInterface ()
 
virtual ~ossimErrorStatusInterface ()
 
virtual ossimErrorCode getErrorStatus () const
 
virtual ossimString getErrorStatusString () const
 
virtual void setErrorStatus (ossimErrorCode error_status) const
 
virtual void setErrorStatus () const
 
virtual void clearErrorStatus () const
 
bool hasError () const
 

Protected Member Functions

virtual ossimRefPtr< ossimImageGeometrygetInternalImageGeometry () const
 
virtual ~ossimJpegTileSource ()
 
virtual bool open ()
 Returns true if no errors initializing object. More...
 
void allocate ()
 
void destroy ()
 
void restart ()
 
void fillTile (const ossimIrect &clip_rect, ossimImageData *tile)
 
- 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 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

ossimRefPtr< ossimImageDatatheTile
 
ossimRefPtr< ossimImageDatatheCacheTile
 
ossim_uint8theLineBuffer
 
FILE * theFilePtr
 
ossimIrect theBufferRect
 
ossimIrect theImageRect
 
ossim_uint32 theNumberOfBands
 
ossimIpt theCacheSize
 
PrivateDatathePrivateData
 
ossimAppFixedTileCache::ossimAppFixedCacheId theCacheId
 
- 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 25 of file ossimJpegTileSource.h.

Constructor & Destructor Documentation

◆ ossimJpegTileSource() [1/3]

ossimJpegTileSource::ossimJpegTileSource ( )

Definition at line 82 of file ossimJpegTileSource.cpp.

83  :
85  theTile(0),
86  theCacheTile(0),
87  theLineBuffer(0),
88  theFilePtr(0),
89  theBufferRect(0, 0, 0, 0),
90  theImageRect(0, 0, 0, 0),
92  theCacheSize (0),
93  thePrivateData(0),
94  theCacheId(-1)
95 {
96 }
ossimRefPtr< ossimImageData > theTile
ossimAppFixedTileCache::ossimAppFixedCacheId theCacheId
PrivateData * thePrivateData
ossimRefPtr< ossimImageData > theCacheTile
ossimImageHandler()
Constructor (default):

◆ ossimJpegTileSource() [2/3]

ossimJpegTileSource::ossimJpegTileSource ( const ossimKeywordlist kwl,
const char *  prefix = 0 
)

Definition at line 101 of file ossimJpegTileSource.cpp.

References loadState(), ossimErrorCodes::OSSIM_ERROR, and ossimErrorStatusInterface::theErrorStatus.

103  :
105  theTile(0),
106  theCacheTile(0),
107  theLineBuffer(0),
108  theFilePtr(0),
109  theBufferRect(0, 0, 0, 0),
110  theImageRect(0, 0, 0, 0),
111  theNumberOfBands(0),
112  theCacheSize (0),
113  thePrivateData(0),
114  theCacheId(-1)
115 {
116  if (loadState(kwl, prefix) == false)
117  {
119  }
120 }
ossimRefPtr< ossimImageData > theTile
static const ossimErrorCode OSSIM_ERROR
ossimAppFixedTileCache::ossimAppFixedCacheId theCacheId
PrivateData * thePrivateData
ossimRefPtr< ossimImageData > theCacheTile
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
Method to the load (recreate) the state of an object from a keyword list.
ossimImageHandler()
Constructor (default):

◆ ossimJpegTileSource() [3/3]

ossimJpegTileSource::ossimJpegTileSource ( const char *  jpeg_file)

Definition at line 125 of file ossimJpegTileSource.cpp.

References open(), ossimErrorCodes::OSSIM_ERROR, ossimNotify(), ossimNotifyLevel_WARN, and ossimErrorStatusInterface::theErrorStatus.

126  :
128  theTile(0),
129  theCacheTile(0),
130  theLineBuffer(0),
131  theFilePtr(0),
132  theBufferRect(0, 0, 0, 0),
133  theImageRect(0, 0, 0, 0),
134  theNumberOfBands(0),
135  theCacheSize(0),
136  thePrivateData(0),
137  theCacheId(-1)
138 {
139  static const char MODULE[]
140  = "ossimJpegTileSource::ossimJpegTileSource";
141 
142  if (!open())
143  {
144 
147  << MODULE
148  << "\nCannot open: " << jpeg_file
149  << endl;
150  }
151 }
ossimRefPtr< ossimImageData > theTile
static const ossimErrorCode OSSIM_ERROR
ossimAppFixedTileCache::ossimAppFixedCacheId theCacheId
PrivateData * thePrivateData
virtual bool open()
Returns true if no errors initializing object.
ossimRefPtr< ossimImageData > theCacheTile
ossimImageHandler()
Constructor (default):
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ ~ossimJpegTileSource()

ossimJpegTileSource::~ossimJpegTileSource ( )
protectedvirtual

Definition at line 156 of file ossimJpegTileSource.cpp.

References destroy().

157 {
158  destroy();
159 }

Member Function Documentation

◆ allocate()

void ossimJpegTileSource::allocate ( )
protected

Definition at line 185 of file ossimJpegTileSource.cpp.

References ossimImageDataFactory::create(), ossim::defaultTileSize(), ossimAppFixedTileCache::deleteCache(), ossimImageData::dup(), ossimImageData::initialize(), ossimImageDataFactory::instance(), ossimAppFixedTileCache::instance(), ossimAppFixedTileCache::newTileCache(), ossimImageData::setImageRectangle(), theCacheId, theCacheSize, theCacheTile, theImageRect, theLineBuffer, theNumberOfBands, theTile, ossimIrect::ul(), ossimIrect::width(), ossimIpt::x, and ossimIpt::y.

186 {
187  if(theLineBuffer)
188  {
189  delete [] theLineBuffer;
190  theLineBuffer = 0;
191  }
192  // Make the cache tile the height of one tile by the image width.
195 
198 
201  theTile->initialize();
202 
203  ossimIrect cache_rect(theImageRect.ul().x,
204  theImageRect.ul().y,
205  theImageRect.ul().x + (theCacheSize.x-1),
206  theImageRect.ul().y + (theCacheSize.y-1));
207 
208  theCacheTile->setImageRectangle(cache_rect);
210 
212 
213  if (traceDebug())
214  {
216  << "ossimJpegTileSource::allocate DEBUG:"
217  << "\ncache tile size: " << theCacheSize
218  << "\nimage width: " << theImageRect.width()
219  << "\nimage height: " << theImageRect.height()
220  << "\nnumber of bands: " << theNumberOfBands
221  << endl;
222  }
223 }
virtual void deleteCache(ossimAppFixedCacheId cacheId)
virtual void setImageRectangle(const ossimIrect &rect)
ossimRefPtr< ossimImageData > theTile
ossim_uint32 height() const
Definition: ossimIrect.h:487
OSSIM_DLL void defaultTileSize(ossimIpt &tileSize)
const ossimIpt & ul() const
Definition: ossimIrect.h:274
virtual void initialize()
Initialize the data buffer.
static ossimAppFixedTileCache * instance(ossim_uint32 maxSize=0)
virtual ossimObject * dup() const
static ossimImageDataFactory * instance()
ossimAppFixedTileCache::ossimAppFixedCacheId theCacheId
virtual ossimRefPtr< ossimImageData > create(ossimSource *owner, ossimScalarType scalar, ossim_uint32 bands=1) const
ossim_uint32 width() const
Definition: ossimIrect.h:500
ossim_int32 y
Definition: ossimIpt.h:142
ossimRefPtr< ossimImageData > theCacheTile
ossim_int32 x
Definition: ossimIpt.h:141
ossimAppFixedCacheId newTileCache(const ossimIrect &tileBoundaryRect, const ossimIpt &tileSize=ossimIpt(0, 0))
unsigned char ossim_uint8
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ close()

void ossimJpegTileSource::close ( )
virtual

Deletes the overview and clears the valid image vertices.

Derived classes should implement.

Reimplemented from ossimImageHandler.

Definition at line 449 of file ossimJpegTileSource.cpp.

References destroy().

450 {
451  destroy();
452 }

◆ destroy()

void ossimJpegTileSource::destroy ( )
protected

Definition at line 161 of file ossimJpegTileSource.cpp.

References ossimAppFixedTileCache::deleteCache(), ossimAppFixedTileCache::instance(), theCacheId, theCacheTile, theFilePtr, theLineBuffer, thePrivateData, and theTile.

Referenced by close(), open(), and ~ossimJpegTileSource().

162 {
164 
165  theTile = 0;
166  theCacheTile = 0;
167 
168  if (theLineBuffer)
169  {
170  delete [] theLineBuffer;
171  theLineBuffer = 0;
172  }
173  if (theFilePtr)
174  {
175  fclose(theFilePtr);
176  theFilePtr = NULL;
177  }
178  if(thePrivateData)
179  {
180  delete thePrivateData;
181  thePrivateData = 0;
182  }
183 }
virtual void deleteCache(ossimAppFixedCacheId cacheId)
ossimRefPtr< ossimImageData > theTile
static ossimAppFixedTileCache * instance(ossim_uint32 maxSize=0)
ossimAppFixedTileCache::ossimAppFixedCacheId theCacheId
PrivateData * thePrivateData
ossimRefPtr< ossimImageData > theCacheTile

◆ fillTile()

void ossimJpegTileSource::fillTile ( const ossimIrect clip_rect,
ossimImageData tile 
)
protected
Note
this method assumes that setImageRectangle has been called on theTile.

Definition at line 291 of file ossimJpegTileSource.cpp.

References ossimIrect::completely_within(), getImageRectangle(), ossimImageData::getImageRectangle(), ossimIrect::height(), ossimImageData::makeBlank(), ossimIrect::set_lrx(), ossimIrect::set_ulx(), ossimIrect::stretchToTileBoundary(), theCacheSize, theFilePtr, x, and ossimIpt::y.

Referenced by getTile().

293 {
294  if (!theFilePtr) return;
295 
296  ossimIrect buffer_rect = clip_rect;
297  buffer_rect.stretchToTileBoundary(theCacheSize);
298  buffer_rect.set_ulx(0);
299  buffer_rect.set_lrx(getImageRectangle(0).lr().x);
300 
301  // Check for a partial tile.
302  if ( ! tile->getImageRectangle().completely_within(buffer_rect) )
303  {
304  tile->makeBlank();
305  }
306 
307  ossim_int32 number_of_cache_tiles = buffer_rect.height()/theCacheSize.y;
308 
309 #if 0
310  if (traceDebug())
311  {
313  << "tiles high: " << number_of_cache_tiles
314  << endl;
315  }
316 #endif
317 
318  ossimIpt origin = buffer_rect.ul();
319 
320  for (int tileIdx = 0; tileIdx < number_of_cache_tiles; ++tileIdx)
321  {
322  // See if it's in the cache already.
324  tempTile = ossimAppFixedTileCache::instance()->
325  getTile(theCacheId, origin);
326  if (tempTile.valid())
327  {
328  tile->loadTile(tempTile.get());
329  }
330  else
331  {
332  // Have to read from the jpeg file.
333  ossim_uint32 start_line = static_cast<ossim_uint32>(origin.y);
334  ossim_uint32 stop_line =
335  static_cast<ossim_uint32>( min(origin.y+theCacheSize.y-1,
336  getImageRectangle().lr().y) );
337  ossimIrect cache_rect(origin.x,
338  origin.y,
339  origin.x+theCacheSize.x-1,
340  origin.y+theCacheSize.y-1);
341 
342  theCacheTile->setImageRectangle(cache_rect);
343 
346  {
348  }
349 
350  if (start_line < thePrivateData->theCinfo.output_scanline)
351  {
352  // Must restart the compression process again.
353  restart();
354  }
355 
356  // Get pointers to the cache tile buffers.
357  JSAMPROW jbuf[1];
358  std::vector<ossim_uint8*> buf(theNumberOfBands);
359  ossim_uint32 band = 0;
360  for (band = 0; band < theNumberOfBands; ++band)
361  {
362  buf[band] = theCacheTile->getUcharBuf(band);
363  }
364 
365  const ossim_uint32 SAMPLES = getNumberOfSamples();
366  jbuf[0] = (JSAMPROW) theLineBuffer;
367 
368  // Gobble any not needed lines.
369  while (thePrivateData->theCinfo.output_scanline < start_line)
370  {
371  jpeg_read_scanlines(&thePrivateData->theCinfo, jbuf, 1);
372  }
373 
374  while (thePrivateData->theCinfo.output_scanline <= stop_line)
375  {
376  // Read a line from the jpeg file.
377  jpeg_read_scanlines(&thePrivateData->theCinfo, jbuf, 1);
378 
379  //---
380  // Copy the line which if band interleaved by pixel the the band
381  // separate buffers.
382  //---
383  ossim_uint32 index = 0;
384  for (ossim_uint32 sample = 0; sample < SAMPLES; ++sample)
385  {
386  for (band = 0; band < theNumberOfBands; ++band)
387  {
388  buf[band][sample] = theLineBuffer[index];
389  ++index;
390  }
391  }
392 
393  for (band = 0; band < theNumberOfBands; ++band)
394  {
395  buf[band] += SAMPLES;
396  }
397  }
399 
400  tile->loadTile(theCacheTile.get());
401 
402  // Add it to the cache for the next time.
404 
405  } // End of reading for jpeg file.
406 
407  origin.y += theCacheSize.y;
408 
409  } // for (int tile = 0; tile < number_of_cache_tiles; ++tile)
410 
411  tile->validate();
412 }
ossim_uint32 x
virtual void setImageRectangle(const ossimIrect &rect)
virtual const ossim_uint8 * getUcharBuf() const
ossim_uint32 y
bool valid() const
Definition: ossimRefPtr.h:75
ossim_uint32 height() const
Definition: ossimIrect.h:487
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...
const ossimIpt & ul() const
Definition: ossimIrect.h:274
static ossimAppFixedTileCache * instance(ossim_uint32 maxSize=0)
bool completely_within(const ossimIrect &rect) const
Definition: ossimIrect.cpp:425
virtual void loadTile(const void *src, const ossimIrect &src_rect, ossimInterleaveType il_type)
virtual ossimDataObjectStatus validate() const
ossimAppFixedTileCache::ossimAppFixedCacheId theCacheId
unsigned int ossim_uint32
virtual ossimIrect getImageRectangle() const
void set_lrx(ossim_int32 x)
Definition: ossimIrect.h:693
virtual void makeBlank()
Initializes data to null pixel values.
PrivateData * thePrivateData
ossim_int32 y
Definition: ossimIpt.h:142
ossimRefPtr< ossimImageData > theCacheTile
void stretchToTileBoundary(const ossimIpt &tileWidthHeight)
Definition: ossimIrect.cpp:212
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...
ossim_int32 x
Definition: ossimIpt.h:141
struct jpeg_decompress_struct theCinfo
int completely_within(extent_type extent1, extent_type extent2)
ossimRefPtr< ossimImageData > addTile(ossimAppFixedCacheId cacheId, ossimRefPtr< ossimImageData > data, bool duplicateData=true)
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.
#define min(a, b)
Definition: auxiliary.h:75
int ossim_int32
void set_ulx(ossim_int32 x)
Definition: ossimIrect.h:657

◆ getImageGeometry()

ossimRefPtr< ossimImageGeometry > ossimJpegTileSource::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 702 of file ossimJpegTileSource.cpp.

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

703 {
704  if ( !theGeometry )
705  {
706  // Check for external geom:
708 
709  if ( !theGeometry )
710  {
711  // Check the internal geometry first to avoid a factory call.
713 
714  // At this point it is assured theGeometry is set.
715 
716  //---
717  // WARNING:
718  // Must create/set theGeometry at this point or the next call to
719  // ossimImageGeometryRegistry::extendGeometry will put us in an infinite loop
720  // as it does a recursive call back to ossimImageHandler::getImageGeometry().
721  //---
722 
723  // Check for set projection.
724  if ( !theGeometry->getProjection() )
725  {
726  // Try factories for projection.
728  }
729  }
730 
731  // Set image things the geometry object should know about.
733  }
734 
735  return theGeometry;
736 }
static ossimImageGeometryRegistry * instance()
ossimRefPtr< ossimImageGeometry > theGeometry
virtual ossimRefPtr< ossimImageGeometry > getInternalImageGeometry() const
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).

◆ getImageRectangle()

ossimIrect ossimJpegTileSource::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 418 of file ossimJpegTileSource.cpp.

References getNumberOfLines(), and getNumberOfSamples().

Referenced by fillTile(), getInternalImageGeometry(), and getTile().

419 {
420  return ossimIrect(0,
421  0,
422  getNumberOfSamples(reduced_res_level) - 1,
423  getNumberOfLines(reduced_res_level) - 1);
424 }
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 ossimJpegTileSource::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 647 of file ossimJpegTileSource.cpp.

648 {
649  return 0;
650 }

◆ getImageTileWidth()

ossim_uint32 ossimJpegTileSource::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 642 of file ossimJpegTileSource.cpp.

643 {
644  return 0;
645 }

◆ getInternalImageGeometry()

ossimRefPtr< ossimImageGeometry > ossimJpegTileSource::getInternalImageGeometry ( ) const
protectedvirtual
Parameters
Methodto get geometry from the xml file or internal geotiff tags.

Reimplemented from ossimImageHandler.

Definition at line 738 of file ossimJpegTileSource.cpp.

References ossimRefPtr< T >::get(), ossimImageHandler::getFilename(), getImageRectangle(), ossimXmpInfo::getProjection(), ossimXmpInfo::open(), ossimImageGeometry::setProjection(), and ossimRefPtr< T >::valid().

Referenced by getImageGeometry().

739 {
741 
742  // See if we can pull a projection from the XMP APP1 XML block if present:
743  ossimXmpInfo info;
744  if ( info.open( getFilename() ) )
745  {
746  ossimDrect imageRect = getImageRectangle( 0 );
747  ossimRefPtr<ossimProjection> proj = info.getProjection( imageRect );
748  if ( proj.valid() )
749  {
750  geom->setProjection( proj.get() );
751  }
752  }
753 
754  return geom;
755 }
void setProjection(ossimProjection *projection)
Sets the projection to be used for local-to-world coordinate transformation.
bool valid() const
Definition: ossimRefPtr.h:75
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 bool open(const ossimFilename &file)
open method.
virtual const ossimFilename & getFilename() const
Returns the filename.
Container class that holds both 2D transform and 3D projection information for an image Only one inst...
ossimRefPtr< ossimProjection > getProjection(const ossimDrect &imageRect) const
Method to get a projection if possible.

◆ getLongName()

ossimString ossimJpegTileSource::getLongName ( ) const
virtual

Reimplemented from ossimObject.

Definition at line 657 of file ossimJpegTileSource.cpp.

658 {
659  return ossimString("jpg reader");
660 }

◆ getNumberOfInputBands()

ossim_uint32 ossimJpegTileSource::getNumberOfInputBands ( ) const
virtual

Returns the number of bands in the image.

Satisfies pure virtual from ImageHandler class.

Implements ossimImageSource.

Definition at line 662 of file ossimJpegTileSource.cpp.

References theNumberOfBands.

Referenced by getNumberOfOutputBands().

663 {
664  return theNumberOfBands;
665 }

◆ getNumberOfLines()

ossim_uint32 ossimJpegTileSource::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 611 of file ossimJpegTileSource.cpp.

References ossimImageHandler::getNumberOfLines(), ossimIrect::lr(), theImageRect, ossimImageHandler::theOverview, ossimIrect::ul(), ossimRefPtr< T >::valid(), and ossimIpt::y.

Referenced by getImageRectangle().

612 {
613  if (reduced_res_level == 0)
614  {
615  return theImageRect.lr().y - theImageRect.ul().y + 1;
616  }
617  else if (theOverview.valid())
618  {
619  return theOverview->getNumberOfLines(reduced_res_level);
620  }
621 
622  return 0;
623 }
bool valid() const
Definition: ossimRefPtr.h:75
virtual ossim_uint32 getNumberOfLines(ossim_uint32 resLevel=0) const =0
Pure virtual, derived classes must implement.
const ossimIpt & ul() const
Definition: ossimIrect.h:274
const ossimIpt & lr() const
Definition: ossimIrect.h:276
ossimRefPtr< ossimImageHandler > theOverview
ossim_int32 y
Definition: ossimIpt.h:142

◆ getNumberOfOutputBands()

ossim_uint32 ossimJpegTileSource::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 667 of file ossimJpegTileSource.cpp.

References getNumberOfInputBands().

Referenced by getTile().

668 {
669  return getNumberOfInputBands();
670 }
virtual ossim_uint32 getNumberOfInputBands() const
Returns the number of bands in the image.

◆ getNumberOfSamples()

ossim_uint32 ossimJpegTileSource::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 628 of file ossimJpegTileSource.cpp.

References ossimImageHandler::getNumberOfSamples(), ossimIrect::lr(), theImageRect, ossimImageHandler::theOverview, ossimIrect::ul(), ossimRefPtr< T >::valid(), and ossimIpt::x.

Referenced by getImageRectangle().

629 {
630  if (reduced_res_level == 0)
631  {
632  return theImageRect.lr().x - theImageRect.ul().x + 1;;
633  }
634  else if (theOverview.valid())
635  {
636  return theOverview->getNumberOfSamples(reduced_res_level);
637  }
638 
639  return 0;
640 }
bool valid() const
Definition: ossimRefPtr.h:75
const ossimIpt & ul() const
Definition: ossimIrect.h:274
const ossimIpt & lr() const
Definition: ossimIrect.h:276
ossimRefPtr< ossimImageHandler > theOverview
virtual ossim_uint32 getNumberOfSamples(ossim_uint32 resLevel=0) const =0
Pure virtual, derived classes must implement.
ossim_int32 x
Definition: ossimIpt.h:141

◆ getOutputScalarType()

ossimScalarType ossimJpegTileSource::getOutputScalarType ( ) const
virtual

Returns the output pixel type of the tile source.

Reimplemented from ossimImageSource.

Definition at line 672 of file ossimJpegTileSource.cpp.

References OSSIM_UCHAR.

673 {
674  return OSSIM_UCHAR;
675 }
8 bit unsigned iteger

◆ getProperty()

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

Gets a property for matching name.

Parameters
nameThe name of the property to get.
Returns
Returns property matching "name".

Reimplemented from ossimImageHandler.

Definition at line 553 of file ossimJpegTileSource.cpp.

References ossimImageHandler::getProperty().

554 {
555  if(name == "file_type")
556  {
557  return new ossimStringProperty("file_type", "JPEG");
558  }
559  return ossimImageHandler::getProperty(name);
560 }
virtual ossimRefPtr< ossimProperty > getProperty(const ossimString &name) const

◆ getPropertyNames()

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

Gets a list of property names available.

Parameters
propertyNamesThe list to push back names to.

Reimplemented from ossimImageHandler.

Definition at line 562 of file ossimJpegTileSource.cpp.

References ossimImageHandler::getPropertyNames().

563 {
565  propertyNames.push_back("file_type");
566 }
virtual void getPropertyNames(std::vector< ossimString > &propertyNames) const

◆ getShortName()

ossimString ossimJpegTileSource::getShortName ( ) const
virtual

Reimplemented from ossimObject.

Definition at line 652 of file ossimJpegTileSource.cpp.

653 {
654  return ossimString("jpg");
655 }

◆ getTile() [1/2]

ossimRefPtr< ossimImageData > ossimJpegTileSource::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 225 of file ossimJpegTileSource.cpp.

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

227 {
228  if (theTile.valid())
229  {
230  // Image rectangle must be set prior to calling getTile.
231  theTile->setImageRectangle(rect);
232 
233  if ( getTile( theTile.get(), resLevel ) == false )
234  {
236  {
237  theTile->makeBlank();
238  }
239  }
240  }
241 
242  return theTile;
243 }
virtual void setImageRectangle(const ossimIrect &rect)
bool valid() const
Definition: ossimRefPtr.h:75
ossimRefPtr< ossimImageData > theTile
virtual ossimDataObjectStatus getDataObjectStatus() const
virtual void makeBlank()
Initializes data to null pixel values.
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...

◆ getTile() [2/2]

bool ossimJpegTileSource::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 245 of file ossimJpegTileSource.cpp.

References ossimIrect::clipToRect(), fillTile(), getImageRectangle(), ossimImageData::getImageRectangle(), ossimImageData::getNumberOfBands(), getNumberOfOutputBands(), ossimImageHandler::getOverviewTile(), isOpen(), ossimSource::isSourceEnabled(), isValidRLevel(), ossimImageData::makeBlank(), ossimReferenced::ref(), status, and ossimReferenced::unref().

247 {
248  bool status = false;
249 
250  //---
251  // Not open, this tile source bypassed, or invalid res level,
252  // return a blank tile.
253  //---
254  if( isOpen() && isSourceEnabled() && isValidRLevel(resLevel) &&
255  result && (result->getNumberOfBands() == getNumberOfOutputBands()) )
256  {
257  result->ref(); // Increment ref count.
258 
259  //---
260  // Check for overview tile. Some overviews can contain r0 so always
261  // call even if resLevel is 0. Method returns true on success, false
262  // on error.
263  //---
264  status = getOverviewTile(resLevel, result);
265 
266  if (!status) // Did not get an overview tile.
267  {
268  status = true;
269 
270  ossimIrect tile_rect = result->getImageRectangle();
271 
272  if (getImageRectangle(0).intersects(tile_rect))
273  {
274  // Make a clip rect.
275  ossimIrect clip_rect = tile_rect.clipToRect(getImageRectangle(0));
276 
277  fillTile(clip_rect, result);
278  }
279  else // No intersection...
280  {
281  result->makeBlank();
282  }
283  }
284 
285  result->unref(); // Decrement ref count.
286  }
287 
288  return status;
289 }
virtual bool isSourceEnabled() const
Definition: ossimSource.cpp:79
virtual ossim_uint32 getNumberOfBands() const
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...
void ref() const
increment the reference count by one, indicating that this object has another pointer which is refere...
virtual bool getOverviewTile(ossim_uint32 resLevel, ossimImageData *result)
Method to get an overview tile.
virtual ossim_uint32 getNumberOfOutputBands() const
Returns the number of bands in a tile returned from this TileSource.
virtual ossimIrect getImageRectangle() const
void fillTile(const ossimIrect &clip_rect, ossimImageData *tile)
bool isOpen() const
Derived classes must implement this method to be concrete.
ossimIrect clipToRect(const ossimIrect &rect) const
Definition: ossimIrect.cpp:501
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 isValidRLevel(ossim_uint32 reduced_res_level) const
Determines if the passed in reslution level is valid.

◆ getTileHeight()

ossim_uint32 ossimJpegTileSource::getTileHeight ( ) const
virtual

Returns the height of the output tile.

Reimplemented from ossimImageSource.

Definition at line 579 of file ossimJpegTileSource.cpp.

References ossimImageData::getHeight(), theTile, and ossimRefPtr< T >::valid().

580 {
581  return ( theTile.valid() ? theTile->getHeight() : 0 );
582 }
bool valid() const
Definition: ossimRefPtr.h:75
ossimRefPtr< ossimImageData > theTile
virtual ossim_uint32 getHeight() const

◆ getTileWidth()

ossim_uint32 ossimJpegTileSource::getTileWidth ( ) const
virtual

Returns the width of the output tile.

Reimplemented from ossimImageSource.

Definition at line 571 of file ossimJpegTileSource.cpp.

References ossimImageData::getWidth(), theTile, and ossimRefPtr< T >::valid().

572 {
573  return ( theTile.valid() ? theTile->getWidth() : 0 );
574 }
virtual ossim_uint32 getWidth() const
bool valid() const
Definition: ossimRefPtr.h:75
ossimRefPtr< ossimImageData > theTile

◆ isOpen()

bool ossimJpegTileSource::isOpen ( ) const
virtual

Derived classes must implement this method to be concrete.

Returns
true if open, false if not.

Implements ossimImageHandler.

Definition at line 677 of file ossimJpegTileSource.cpp.

References theFilePtr.

Referenced by getTile().

678 {
679  return (theFilePtr != NULL);
680 }

◆ isValidRLevel()

bool ossimJpegTileSource::isValidRLevel ( ossim_uint32  resLevel) const
virtual

Determines if the passed in reslution level is valid.

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

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

Reimplemented from ossimImageHandler.

Definition at line 587 of file ossimJpegTileSource.cpp.

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

Referenced by getTile().

588 {
589  static const char MODULE[] = "ossimJpegTileSource::isValidRLevel";
590 
591  if (reduced_res_level == 0)
592  {
593  return true;
594  }
595  else if (theOverview.valid())
596  {
597  return theOverview->isValidRLevel(reduced_res_level);
598  }
599  else
600  {
601  cerr << MODULE << " Invalid reduced_res_level: " << reduced_res_level
602  << "\nHighest available: " << (getNumberOfDecimationLevels() - 1)
603  << endl;
604  }
605  return false;
606 }
bool valid() const
Definition: ossimRefPtr.h:75
virtual ossim_uint32 getNumberOfDecimationLevels() const
This returns the total number of decimation levels.
virtual bool isValidRLevel(ossim_uint32 resLevel) const
Determines if the passed in reslution level is valid.
ossimRefPtr< ossimImageHandler > theOverview

◆ loadState()

bool ossimJpegTileSource::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 438 of file ossimJpegTileSource.cpp.

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

Referenced by ossimJpegTileSource().

440 {
441  if (ossimImageHandler::loadState(kwl, prefix))
442  {
443  return open();
444  }
445 
446  return false;
447 }
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()
Returns true if no errors initializing object.

◆ open() [1/2]

bool ossimJpegTileSource::open ( const ossimFilename jpeg_file)
virtual

Returns true if the image_file can be opened and is a valid tiff file.

Reimplemented from ossimImageHandler.

Definition at line 457 of file ossimJpegTileSource.cpp.

References open(), and ossimImageHandler::theImageFile.

458 {
459  theImageFile = jpeg_file;
460 
461  return open();
462 }
ossimFilename theImageFile
virtual bool open()
Returns true if no errors initializing object.

◆ open() [2/2]

bool ossimJpegTileSource::open ( )
protectedvirtual

Returns true if no errors initializing object.

Notes:

  • Callers of this method must ensure "theTiffPtr" data member is initialized.
  • This method was added to consolidate object initialization code between constructor and public open method.

Implements ossimImageHandler.

Definition at line 468 of file ossimJpegTileSource.cpp.

References ossimString::c_str(), destroy(), ossimString::empty(), ossimErrorCodes::OSSIM_ERROR, ossimErrorStatusInterface::theErrorStatus, theFilePtr, and ossimImageHandler::theImageFile.

Referenced by loadState(), open(), and ossimJpegTileSource().

469 {
470  static const char MODULE[] = "ossimJpegTileSource::open";
471 
472  // Start with a clean slate.
473  destroy();
474  // Check for empty filename.
475  if (theImageFile.empty())
476  {
477  return false;
478  }
479 
480  // Open Jpeg file.
481  if((theFilePtr = fopen(theImageFile.c_str(), "rb")) == NULL)
482  {
484 
485  if (traceDebug())
486  {
488  << MODULE << "\nERROR:\n"
489  << "Could not open: " << theImageFile.c_str()
490  << endl;
491  }
492 
493  return false;
494  }
495 
496  //***
497  // Verify the file is a jpeg by checking the first two bytes.
498  //***
499  ossim_uint8 c[2];
500  fread(c, 2, 1, theFilePtr);
501  if( c[0] != 0xFF || c[1] != 0xD8 )
502  {
503  if (traceDebug())
504  {
506  << MODULE << " NOTICE:\n"
507  << "Not a jpeg file..." << endl;
508  }
509 
510  fclose(theFilePtr);
511  theFilePtr = NULL;
512  return false;
513  }
514 
515  thePrivateData = new PrivateData();
516  rewind(theFilePtr);
517 
518  //---
519  // Step 1: allocate and initialize JPEG decompression object
520  // We set up the normal JPEG error routines, then override error_exit.
521  //---
522  thePrivateData->theCinfo.err = jpeg_std_error(&thePrivateData->theJerr);
523 
524  // Initialize the JPEG decompression object.
525  jpeg_create_decompress(&thePrivateData->theCinfo);
526 
527  // Specify data source.
528  //jpeg_stdio_src(&thePrivateData->theCinfo, theFilePtr);
530 
531  // Read the file parameters with jpeg_read_header.
532  jpeg_read_header(&thePrivateData->theCinfo, TRUE);
533 
534  jpeg_start_decompress(&thePrivateData->theCinfo);
535 
536  theNumberOfBands = thePrivateData->theCinfo.output_components;
537 
539  0,
540  thePrivateData->theCinfo.output_width - 1,
541  thePrivateData->theCinfo.output_height - 1);
542 
543  theBufferRect.set_lrx(thePrivateData->theCinfo.output_width - 1);
544 
545  completeOpen();
546 
547  // Allocate memory...
548  allocate();
549 
550  return true;
551 }
OSSIM_DLL void ossimJpegStdIOSrc(jpeg_decompress_struct *cinfo, FILE *infile)
Method which uses memory instead of a FILE* to read from.
ossimFilename theImageFile
static const ossimErrorCode OSSIM_ERROR
void set_lrx(ossim_int32 x)
Definition: ossimIrect.h:693
virtual void completeOpen()
Will complete the opening process.
PrivateData * thePrivateData
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
bool empty() const
Definition: ossimString.h:411
struct jpeg_decompress_struct theCinfo
unsigned char ossim_uint8
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ restart()

void ossimJpegTileSource::restart ( )
protected

Definition at line 682 of file ossimJpegTileSource.cpp.

References ossimJpegStdIOSrc(), ossimJpegTileSource::PrivateData::theCinfo, theFilePtr, thePrivateData, and TRUE.

683 {
684  jpeg_abort_decompress( &thePrivateData->theCinfo );
685  jpeg_destroy_decompress( &thePrivateData->theCinfo );
686 
687  // Put the theFilePtr back to the start...
688  rewind(theFilePtr);
689 
690  // Initialize the JPEG decompression object.
691  jpeg_create_decompress(&thePrivateData->theCinfo);
692 
693  // Specify data source.
695 
696  // Read the file parameters with jpeg_read_header.
697  jpeg_read_header(&thePrivateData->theCinfo, TRUE);
698 
699  jpeg_start_decompress(&thePrivateData->theCinfo);
700 }
OSSIM_DLL void ossimJpegStdIOSrc(jpeg_decompress_struct *cinfo, FILE *infile)
Method which uses memory instead of a FILE* to read from.
PrivateData * thePrivateData
struct jpeg_decompress_struct theCinfo

◆ saveState()

bool ossimJpegTileSource::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 429 of file ossimJpegTileSource.cpp.

References ossimImageHandler::saveState().

431 {
432  return ossimImageHandler::saveState(kwl, prefix);
433 }
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

◆ theBufferRect

ossimIrect ossimJpegTileSource::theBufferRect
protected

Definition at line 203 of file ossimJpegTileSource.h.

◆ theCacheId

ossimAppFixedTileCache::ossimAppFixedCacheId ossimJpegTileSource::theCacheId
protected

Definition at line 210 of file ossimJpegTileSource.h.

Referenced by allocate(), and destroy().

◆ theCacheSize

ossimIpt ossimJpegTileSource::theCacheSize
protected

Definition at line 206 of file ossimJpegTileSource.h.

Referenced by allocate(), and fillTile().

◆ theCacheTile

ossimRefPtr<ossimImageData> ossimJpegTileSource::theCacheTile
protected

Definition at line 200 of file ossimJpegTileSource.h.

Referenced by allocate(), and destroy().

◆ theFilePtr

FILE* ossimJpegTileSource::theFilePtr
protected

Definition at line 202 of file ossimJpegTileSource.h.

Referenced by destroy(), fillTile(), isOpen(), open(), and restart().

◆ theImageRect

ossimIrect ossimJpegTileSource::theImageRect
protected

Definition at line 204 of file ossimJpegTileSource.h.

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

◆ theLineBuffer

ossim_uint8* ossimJpegTileSource::theLineBuffer
protected

Definition at line 201 of file ossimJpegTileSource.h.

Referenced by allocate(), and destroy().

◆ theNumberOfBands

ossim_uint32 ossimJpegTileSource::theNumberOfBands
protected

Definition at line 205 of file ossimJpegTileSource.h.

Referenced by allocate(), and getNumberOfInputBands().

◆ thePrivateData

PrivateData* ossimJpegTileSource::thePrivateData
protected

Definition at line 208 of file ossimJpegTileSource.h.

Referenced by destroy(), and restart().

◆ theTile

ossimRefPtr<ossimImageData> ossimJpegTileSource::theTile
protected

Definition at line 199 of file ossimJpegTileSource.h.

Referenced by allocate(), destroy(), getTile(), getTileHeight(), and getTileWidth().


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