OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimTiffTileSource.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: David Burken
8 // Frank Warmerdam (warmerdam@pobox.com)
9 //
10 // Description:
11 //
12 // Contains class declaration for ossimTiffTileSource.
13 // ossimTiffTileSource is derived from ImageHandler which is derived from
14 // TileSource.
15 //*******************************************************************
16 // $Id$
17 
18 #ifndef ossimTiffTileSource_HEADER
19 #define ossimTiffTileSource_HEADER 1
20 
22 #include <ossim/base/ossimIrect.h>
23 #include <vector>
26 /*
27  * TIFF is defined as an incomplete type to hide the tiff library's internal
28  * data structures from clients.
29  */
30 typedef struct tiff TIFF;
31 
32 class ossimImageData;
33 class ossimTiffOverviewTileSource;
34 class TiffStreamAdaptor;
36 {
37 public:
38  friend class TiffStreamAdaptor;
40  {
47  READ_U16_STRIP
48  };
49 
51 
52  virtual ossimString getLongName() const;
53  virtual ossimString getShortName() const;
54 
58  virtual bool open(const ossimFilename& image_file);
59 
67  bool open( std::shared_ptr<ossim::istream>& str,
68  const std::string& connectionString );
69 
70  virtual void close();
71 
78  ossim_uint32 resLevel=0);
79 
92  virtual bool getTile(ossimImageData* result, ossim_uint32 resLevel=0);
93 
98  virtual ossim_uint32 getNumberOfInputBands() const;
99  virtual ossim_uint32 getNumberOfOutputBands () const;
100 
109  virtual bool isBandSelector() const;
110 
119  virtual bool setOutputBandList(const std::vector<ossim_uint32>& band_list);
120 
122  virtual void getOutputBandList(std::vector<ossim_uint32>& bandList) const;
123 
128  virtual ossim_uint32 getNumberOfLines(ossim_uint32 resLevel = 0) const;
129 
134  virtual ossim_uint32 getNumberOfSamples(ossim_uint32 resLevel = 0) const;
135 
139  virtual ossim_uint32 getNumberOfDirectories() const;
140 
152 
157  virtual bool saveState(ossimKeywordlist& kwl,
158  const char* prefix=0)const;
159 
164  virtual bool loadState(const ossimKeywordlist& kwl,
165  const char* prefix=0);
166 
167  virtual bool isOpen()const;
168 
172  virtual ossimScalarType getOutputScalarType() const;
173 
177  virtual ossim_uint32 getTileWidth() const;
178 
182  virtual ossim_uint32 getTileHeight() const;
183 
188  bool hasR0() const;
189 
190  virtual ossim_float64 getMinPixelValue(ossim_uint32 band=0)const;
191  virtual ossim_float64 getMaxPixelValue(ossim_uint32 band=0)const;
192  virtual ossim_float64 getNullPixelValue(ossim_uint32 band=0)const;
193 
194  virtual bool isValidRLevel(ossim_uint32 resLevel) const;
195 
202  virtual ossim_uint32 getImageTileWidth() const;
203 
210  virtual ossim_uint32 getImageTileHeight() const;
211 
212  void setApplyColorPaletteFlag(bool flag);
213  bool getApplyColorPaletteFlag()const;
214 
215  virtual void setProperty(ossimRefPtr<ossimProperty> property);
216  virtual ossimRefPtr<ossimProperty> getProperty(const ossimString& name)const;
217  virtual void getPropertyNames(std::vector<ossimString>& propertyNames)const;
218  bool isColorMapped() const;
219 
220  virtual std::ostream& print(std::ostream& os) const;
221 
223  {
224  return theTiffPtr;
225  }
226 #if 0
227 
237 #endif
238 protected:
239  virtual ~ossimTiffTileSource();
249  bool open();
250 
251  // Must be protected for derived ossimTerraSarTiffReader.
253 
254 
255 private:
256 
261  void adjustToStartOfTile(ossimIpt& pt) const;
262 
268  ossim_uint32 getCurrentTiffRLevel() const;
269 
270  ossimString getReadMethod(ossim_uint32 directory) const;
271 
272  bool loadTile(const ossimIrect& tile_rect,
273  const ossimIrect& clip_rect,
274  ossimImageData* result);
275 
276  bool loadFromRgbaU8Tile(const ossimIrect& tile_rect,
277  const ossimIrect& clip_rect,
278  ossimImageData* result);
279 
280  bool loadFromRgbaU8Strip(const ossimIrect& tile_rect,
281  const ossimIrect& clip_rect,
282  ossimImageData* result);
283 
284  bool loadFromRgbaU8aStrip(const ossimIrect& tile_rect,
285  const ossimIrect& clip_rect,
286  ossimImageData* result);
287 
288  bool loadFromU16Strip(const ossimIrect& clip_rect,
289  ossimImageData* result);
290 
291  bool loadFromScanLine(const ossimIrect& clip_rect,
292  ossimImageData* result);
293 
294  bool loadFromTile(const ossimIrect& clip_rect,
295  ossimImageData* result);
296 
297  void setReadMethod();
298 
304  bool setTiffDirectory(ossim_uint16 directory);
305 
306  void populateLut();
307 
312  void validateMinMaxNull();
313 
329  bool isPowerOfTwoDecimation(ossim_uint32 dir) const;
330 
332  void allocateTile();
333 
338  bool allocateBuffer();
339 
341 
348 
352 
356 
363 
364  // Things we need from each directory as they can be different.
365  std::vector<ossim_uint32> theImageWidth;
366  std::vector<ossim_uint32> theImageLength;
367  std::vector<ReadMethod> theReadMethod;
368  std::vector<ossim_uint16> thePlanarConfig;
369  std::vector<ossim_uint16> thePhotometric;
370  std::vector<ossim_uint32> theRowsPerStrip;
371  std::vector<ossim_uint32> theImageTileWidth;
372  std::vector<ossim_uint32> theImageTileLength;
373  std::vector<ossim_uint32> theImageDirectoryList;
374 
377  std::vector<ossim_uint32> theOutputBandList;
378  std::shared_ptr<ossim::TiffIStreamAdaptor> m_streamAdaptor;
379 
380 TYPE_DATA
381 };
382 
383 #endif /* #ifndef ossimTiffTileSource_HEADER */
virtual bool open()=0
Pure virtual open.
std::vector< ossim_uint32 > theImageTileWidth
std::vector< ossim_uint32 > theOutputBandList
ossim_float64 theMaxSampleValue
ossim_uint32 theCurrentTiffRlevel
ossim_uint32 theCurrentTileWidth
#define OSSIMDLLEXPORT
Represents serializable keyword/value map.
virtual ossim_uint32 getNumberOfOutputBands() const
Returns the number of bands in a tile returned from this TileSource.
std::shared_ptr< ossim::TiffIStreamAdaptor > m_streamAdaptor
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 ossim_uint32 getNumberOfLines(ossim_uint32 resLevel=0) const =0
Pure virtual, derived classes must implement.
std::vector< ossim_uint32 > theRowsPerStrip
virtual ossim_uint32 getTileHeight() const
Returns the default processing tile height.
unsigned short ossim_uint16
virtual void setProperty(ossimRefPtr< ossimProperty > property)
ossim_uint32 theCurrentTileHeight
virtual ossimString getShortName() const
Definition: ossimObject.cpp:48
ossim_uint16 theSamplesPerPixel
virtual ossim_uint32 getTileWidth() const
Returns the default processing tile width.
ossim_uint16 theNumberOfDirectories
std::vector< ossim_uint32 > theImageDirectoryList
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.
virtual bool isOpen() const =0
Derived classes must implement this method to be concrete.
virtual double getMinPixelValue(ossim_uint32 band=0) const
Retuns the min pixel value.
virtual void getPropertyNames(std::vector< ossimString > &propertyNames) const
double ossim_float64
virtual std::ostream & print(std::ostream &out) const
Outputs theErrorStatus as an ossimErrorCode and an ossimString.
virtual void getOutputBandList(std::vector< ossim_uint32 > &bandList) const
Initializes bandList.
ossim_float64 theNullSampleValue
virtual ossimRefPtr< ossimImageGeometry > getImageGeometry()
Returns the image geometry object associated with this tile source or NULL if non defined...
#define TYPE_DATA
Definition: ossimRtti.h:339
virtual ossim_uint32 getImageTileHeight() const =0
Returns the tile width of the image or 0 if the image is not tiled.
unsigned int ossim_uint32
struct tiff TIFF
virtual ossimString getLongName() const
Definition: ossimObject.cpp:53
virtual void close()
Deletes the overview and clears the valid image vertices.
ossim_float64 theMinSampleValue
virtual bool isBandSelector() const
Indicates whether or not the image handler can control output band selection via the setOutputBandLis...
std::vector< ossim_uint32 > theImageLength
Container class that holds both 2D transform and 3D projection information for an image Only one inst...
ossimScalarType
virtual ossimRefPtr< ossimProperty > getProperty(const ossimString &name) const
virtual ossim_uint32 getImageTileWidth() const =0
Returns the tile width of the image or 0 if the image is not tiled.
ossimScalarType theScalarType
std::vector< ossim_uint16 > thePhotometric
ossimRefPtr< ossimImageData > theTile
std::vector< ossim_uint16 > thePlanarConfig
virtual ossimScalarType getOutputScalarType() const
This will be used to query the output pixel type of the tile source.
This class defines an abstract Handler which all image handlers(loaders) should derive from...
std::vector< ossim_uint32 > theImageTileLength
ossim_uint16 theCurrentDirectory
ossim_uint16 theSampleFormatUnit
std::vector< ReadMethod > theReadMethod
virtual ossim_uint32 getNumberOfSamples(ossim_uint32 resLevel=0) const =0
Pure virtual, derived classes must implement.
std::vector< ossim_uint32 > theImageWidth
virtual double getMaxPixelValue(ossim_uint32 band=0) const
Returns the max pixel of the band.
virtual ossim_uint32 getNumberOfInputBands() const =0
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...
virtual double getNullPixelValue(ossim_uint32 band=0) const
Each band has a null pixel associated with it.
unsigned char ossim_uint8
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
Method to save the state of an object to a keyword list.
std::basic_ostream< char > ostream
Base class for char output streams.
Definition: ossimIosFwd.h:23
int ossim_int32
virtual ossimRefPtr< ossimImageData > getTile(const ossimIpt &origin, ossim_uint32 resLevel=0)