OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimImageHandler.h
Go to the documentation of this file.
1 //*******************************************************************
2 //
3 // License: MIT
4 //
5 // See LICENSE.txt file in the top level directory for more details.
6 //
7 // Author: Garrett Potts
8 //
9 // Description:
10 //
11 // This class defines an abstract image handler which all loaders should
12 // derive from.
13 //
14 //********************************************************************
15 // $Id: ossimImageHandler.h 22960 2014-11-06 15:42:13Z okramer $
16 #ifndef ossimImageHandler_HEADER
17 #define ossimImageHandler_HEADER 1
18 
22 #include <ossim/base/ossimIrect.h>
24 #include <ossim/base/ossimRefPtr.h>
28 
30 
36 {
37 public:
38 
40  {
41  OSSIM_OVERVIEW_COMPRESSION_NONE= 0,
45  OSSIM_OVERVIEW_COMPRESSION_PACKBITS
46  };
47 
50 
55  virtual ~ossimImageHandler();
56 
61  virtual void initialize();
62 
71  virtual bool openOverview();
72 
82  virtual bool openOverview(const ossimFilename& overview_file);
83 
89  virtual void closeOverview();
90 
95  virtual const ossimImageHandler* getOverview() const;
96 
101  virtual bool hasOverviews() const;
102 
106  virtual ossimFilename createDefaultOverviewFilename() const;
107 
111  virtual ossimFilename createDefaultGeometryFilename() const;
112 
116  virtual ossimFilename createDefaultMetadataFilename() const;
117 
121  virtual ossimFilename createDefaultHistogramFilename() const;
122 
126  virtual ossimFilename createDefaultValidVerticesFilename() const;
127 
137  virtual bool writeValidImageVertices(const std::vector<ossimIpt>& vertices,
138  const ossimFilename& file=ossimFilename(""));
139 
146  virtual bool openValidVertices(const ossimFilename& vertices_file);
147 
153  virtual bool openValidVertices();
154 
165  virtual bool open() = 0;
166 
175  virtual bool open(const ossimFilename& imageFile,
176  ossim_uint32 entryIndex);
177 
178  virtual bool open(const ossimFilename& imageFile);
179 
180  virtual bool open(std::shared_ptr<ossim::ImageHandlerState> state);
185  virtual void close();
186 
192  virtual bool isOpen()const=0;
193 
204  virtual bool buildHistogram(
205  int numberOfRLevels=0, ossimHistogramMode mode=OSSIM_HISTO_MODE_NORMAL );
206 
217  virtual bool buildAllHistograms(
218  int numberOfRLevels=0, ossimHistogramMode mode=OSSIM_HISTO_MODE_NORMAL );
219 
226  virtual bool buildOverview(ossimImageHandlerOverviewCompressionType compressionType = OSSIM_OVERVIEW_COMPRESSION_NONE,
227  ossim_uint32 quality = 75,
229  bool includeFullResFlag=false);
230 
237  virtual bool buildAllOverviews(ossimImageHandlerOverviewCompressionType compressionType = OSSIM_OVERVIEW_COMPRESSION_NONE,
238  ossim_uint32 quality = 75,
240  bool includeFullResFlag=false);
241 
249  virtual bool buildOverview(const ossimFilename& filename,
250  ossimImageHandlerOverviewCompressionType compressionType = OSSIM_OVERVIEW_COMPRESSION_NONE,
251  ossim_uint32 quality = 75,
253  bool includeFullResFlag=false);
254 
273  ossimRefPtr<ossimMultiResLevelHistogram> getImageHistogram() const;
274 
281 
291  virtual void setImageGeometry(ossimImageGeometry* geom);
292 
297  virtual void saveImageGeometry() const;
298 
303  virtual void saveImageGeometry(const ossimFilename& geometry_file) const;
304 
313  virtual ossim_uint32 getNumberOfLines(ossim_uint32 resLevel = 0) const = 0;
314 
323  virtual ossim_uint32 getNumberOfSamples(ossim_uint32 resLevel = 0) const = 0;
324 
333  virtual ossimIrect getImageRectangle(ossim_uint32 resLevel = 0) const;
334 
344  virtual ossimIrect getBoundingRect(ossim_uint32 resLevel = 0) const;
345 
363  virtual void getDecimationFactor(ossim_uint32 resLevel, ossimDpt& result) const;
364 
368  virtual void getDecimationFactors(vector<ossimDpt>& decimations) const;
369 
376 
382  virtual ossim_uint32 getNumberOfReducedResSets()const;
383 
387  virtual void setFilename(const ossimFilename& filename);
388 
392  virtual const ossimFilename& getFilename()const;
393 
398  virtual bool saveState(ossimKeywordlist& kwl,
399  const char* prefix=0)const;
400 
405  virtual bool loadState(const ossimKeywordlist& kwl,
406  const char* prefix=0);
407 
417  virtual bool isValidRLevel(ossim_uint32 resLevel) const;
418 
424  bool canConnectMyInputTo(ossim_int32 inputIndex,
425  const ossimConnectableObject* object) const;
426 
436  virtual void getValidImageVertices(vector<ossimIpt>& validVertices,
438  ossim_uint32 resLevel=0)const;
439 
445  virtual bool isBandSelector() const;
446 
458  virtual bool setOutputBandList(const std::vector<ossim_uint32>& band_list);
459 
468  virtual bool setOutputToInputBandList();
469 
475  virtual bool isIdentityBandList( const std::vector<ossim_uint32>& bandList ) const;
476 
484  virtual bool isImageTiled() const;
485 
492  virtual ossim_uint32 getImageTileWidth() const = 0;
493 
500  virtual ossim_uint32 getImageTileHeight() const = 0;
501 
502  virtual bool hasMetaData() const;
503 
504  virtual ossimRefPtr<ossimNBandLutDataObject> getLut()const;
505 
506  virtual bool hasLut() const;
507 
514  virtual void loadMetaData();
515 
521  virtual double getMinPixelValue(ossim_uint32 band=0)const;
522  virtual double getMaxPixelValue(ossim_uint32 band=0)const;
523  virtual double getNullPixelValue(ossim_uint32 band=0)const;
524 
535  virtual void setMinPixelValue(ossim_uint32 band, const ossim_float64& pix);
536 
547  virtual void setMaxPixelValue(ossim_uint32 band, const ossim_float64& pix);
548 
559  virtual void setNullPixelValue(ossim_uint32 band, const ossim_float64& pix);
560 
567  virtual ossim_uint32 getCurrentEntry()const;
568 
572  virtual ossim_uint32 getNumberOfEntries()const;
573 
588  virtual void getEntryName( ossim_uint32 entryIdx,
589  std::string& name ) const;
590 
596  virtual void getEntryList(std::vector<ossim_uint32>& entryList) const;
597 
606  virtual void getEntryNames(std::vector<ossimString>& entryNames) const;
607 
619  bool useEntryIndex() const;
620 
621  ossimFilename getOverviewFile()const;
622 
631  virtual bool setCurrentEntry(ossim_uint32 entryIdx);
632 
633  virtual void setProperty(ossimRefPtr<ossimProperty> property);
634  virtual ossimRefPtr<ossimProperty> getProperty(const ossimString& name)const;
635  virtual void getPropertyNames(std::vector<ossimString>& propertyNames)const;
636 
665  ossimFilename getFilenameWithThisExtension(const ossimString& ext,
666  bool set_e0_prefix=false) const;
667 
684  void getFilenameWithThisExt( const ossimString& ext,
685  ossimFilename& f ) const;
686 
687  ossim_uint32 getStartingResLevel() const;
688 
689  void setStartingResLevel(ossim_uint32 level);
690 
692  bool getOpenOverviewFlag() const;
693 
701  void setOpenOverviewFlag(bool flag);
702 
706  virtual void setSupplementaryDirectory(const ossimFilename& dir);
707 
711  virtual const ossimFilename& getSupplementaryDirectory()const;
712 
715  const ossimString& getImageID() const { return theImageID; }
716 
718  void setImageID(const ossimString& id) { theImageID = id; }
719 
722  ossimPixelType getPixelType() const { return thePixelType; }
723 
733  virtual bool getRgbBandList(std::vector<ossim_uint32>& bandList) const;
734 
735 
736  template <class T>
737  std::shared_ptr<T> getStateAs(){return dynamic_pointer_cast<T> (m_state);}
738  template <class T>
739  std::shared_ptr<const T> getStateAs()const{return dynamic_pointer_cast<const T> (m_state);}
740  std::shared_ptr<ossim::ImageHandlerState> getState(){return m_state;}
741  std::shared_ptr<const ossim::ImageHandlerState> getState()const{return m_state;}
742  void setState(std::shared_ptr<ossim::ImageHandlerState> state){m_state = state;}
743 protected:
744 
753  virtual ossimRefPtr<ossimImageGeometry> getExternalImageGeometry() const;
754 
755  virtual ossimRefPtr<ossimImageGeometry> getInternalImageGeometry() const;
756 
775  virtual bool getOverviewTile(ossim_uint32 resLevel, ossimImageData* result);
776 
781  bool initVertices(const char* file);
782 
789  virtual void completeOpen();
790 
796  void initImageParameters(ossimImageGeometry* geom) const;
797 
805  virtual void establishDecimationFactors();
806 
817  virtual bool setOutputBandList(const std::vector<ossim_uint32>& inBandList,
818  std::vector<ossim_uint32>& outBandList);
819 
820 
830  void getFilenameWithNoExtension( ossimFilename& f ) const;
831 
836  vector<ossimIpt> theValidImageVertices;
840  std::vector<ossimDpt> theDecimationFactors;
842 
847  ossim_uint32 theStartingResLevel; // 0 being full or highest res.
848 
854  mutable ossimPixelType thePixelType; // pixel-is-point or pixel-is-area
855 
856  std::shared_ptr<ossim::ImageHandlerState> m_state;
857 TYPE_DATA
858 };
859 
860 #endif /* #ifndef ossimImageHandler_HEADER */
virtual ossimIrect getBoundingRect(ossim_uint32 resLevel=0) const
This will return the bounding rect of the source.
ossimRefPtr< ossimImageGeometry > theGeometry
ossimHistogramMode
#define OSSIMDLLEXPORT
ossimFilename theImageFile
Represents serializable keyword/value map.
void setState(std::shared_ptr< ossim::ImageHandlerState > state)
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
Method to the load (recreate) the state of an object from a keyword list.
std::vector< ossimDpt > theDecimationFactors
std::shared_ptr< ossim::ImageHandlerState > m_state
bool theOpenOverviewFlag
If true opening of overviews will be attempted.
std::shared_ptr< ossim::ImageHandlerState > getState()
virtual ossim_uint32 getNumberOfDecimationLevels() const
Will return the number of resolution levels.
std::shared_ptr< const ossim::ImageHandlerState > getState() const
ossimFilename theSupplementaryDirectory
ossimPixelType thePixelType
std::shared_ptr< T > getStateAs()
virtual double getMinPixelValue(ossim_uint32 band=0) const
Returns the min pixel of the band.
double ossim_float64
virtual void setProperty(ossimRefPtr< ossimProperty > property)
virtual void setImageGeometry(const ossimImageGeometry *geom)
Default implementation sets geometry of the first input to the geometry specified.
virtual void getPropertyNames(std::vector< ossimString > &propertyNames) const
virtual void saveImageGeometry() const
Default method to call input&#39;s saveImageGeometry.
ossimVertexOrdering
#define TYPE_DATA
Definition: ossimRtti.h:339
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.
unsigned int ossim_uint32
ossimPixelType getPixelType() const
Returns the raster pixel alignment type.
vector< ossimIpt > theValidImageVertices
virtual ossimRefPtr< ossimImageGeometry > getImageGeometry()
Returns the image geometry object associated with this tile source or NULL if not defined...
Container class that holds both 2D transform and 3D projection information for an image Only one inst...
ossimPixelType
ossimImageMetaData theMetaData
ossimRefPtr< ossimImageHandler > theOverview
This class defines an abstract Handler which all image handlers(loaders) should derive from...
virtual double getMaxPixelValue(ossim_uint32 band=0) const
Returns the max pixel of the band.
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
Method to save the state of an object to a keyword list.
void setImageID(const ossimString &id)
Sets the image ID in case it is externally generated.
virtual ossimRefPtr< ossimProperty > getProperty(const ossimString &name) const
ossimFilename theOverviewFile
virtual void initialize()=0
ossimRefPtr< ossimNBandLutDataObject > theLut
virtual bool canConnectMyInputTo(ossim_int32 myInputIndex, const ossimConnectableObject *object) const =0
required to be overriden by derived classes
virtual void getDecimationFactor(ossim_uint32 resLevel, ossimDpt &result) const
Will return the decimation factor for the given resolution level.
const ossimString & getImageID() const
Fetches the image ID.
virtual double getNullPixelValue(ossim_uint32 band=0) const
Each band has a null pixel associated with it.
std::shared_ptr< const T > getStateAs() const
virtual void getDecimationFactors(std::vector< ossimDpt > &decimations) const
Will return an array of all decimations for each resolution level.
int ossim_int32
ossim_uint32 theStartingResLevel
theStartingResLevel If set to something other than zero(default) this is indicative that the reader i...