OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimImageUtil.h
Go to the documentation of this file.
1 //----------------------------------------------------------------------------
2 // File: ossimImageUtil.h
3 //
4 // License: MIT
5 //
6 // See LICENSE.txt file in the top level directory for more details.
7 //
8 // Author: David Burken
9 //
10 // Description: ossimImageUtil
11 //
12 // See class descriptions below for more.
13 //
14 //----------------------------------------------------------------------------
15 // $Id$
16 
17 #ifndef ossimImageUtil_HEADER
18 #define ossimImageUtil_HEADER 1
19 
24 #include <ossim/base/ossimRefPtr.h>
27 #include <ostream>
28 #include <vector>
29 #include <mutex>
30 
32 class ossimFileWalker;
33 class ossimGpt;
36 class ossimImageHandler;
46 {
47 public:
48 
51 
53  virtual ~ossimImageUtil();
54 
55  void addOptions(ossimApplicationUsage* au);
60  void addArguments(ossimArgumentParser& ap);
61 
72  bool initialize(ossimArgumentParser& ap);
73 
85  ossim_int32 execute();
86 
99  virtual void processFile(const ossimFilename& file);
100 
111  void setCreateOverviewsFlag(bool flag);
112 
114  bool createOverviews() const;
115 
124  void setCreateThumbnailsFlag(bool flag);
125 
129  void setThumbnailType(const std::string& value);
130 
134  void setThumbnailStretchType(const std::string& value);
135 
137  bool createThumbnails() const;
138 
149  void setRebuildOverviewsFlag( bool flag );
150 
152  bool rebuildOverviews() const;
153 
160  void setRebuildHistogramFlag( bool flag );
161 
163  bool rebuildHistogram() const;
164 
179  void setOverviewType( const std::string& type );
180 
191  void setOverviewStopDimension( ossim_uint32 dimension );
192  void setOverviewStopDimension( const std::string& dimension );
193 
201  void setTileSize( ossim_uint32 tileSize );
202 
208  bool getTileSize( ossimIpt& tileSize ) const;
209 
214  ossim_uint32 getOverviewStopDimension() const;
215 
222  void setCreateHistogramFlag( bool flag );
223 
225  bool createHistogram() const;
226 
233  void setCreateHistogramFastFlag( bool flag );
234 
236  bool createHistogramFast() const;
237 
244  void setCreateHistogramR0Flag( bool flag );
245 
247  bool createHistogramR0() const;
248 
250  bool hasHistogramOption() const;
251 
253  ossimHistogramMode getHistogramMode() const;
254 
262  void setScanForMinMax( bool flag );
263 
265  bool scanForMinMax() const;
266 
274  void setScanForMinMaxNull( bool flag );
275 
277  bool scanForMinMaxNull() const;
278 
286  void setCompressionQuality( const std::string& quality );
287 
298  void setCompressionType( const std::string& type );
299 
304  void setCopyAllFlag( bool flag );
305 
310  bool getCopyAllFlag() const;
311 
316  void setDumpFilteredImageListFlag( bool flag );
317 
324  bool getDumpFilterImagesFlag() const;
325 
330  void setInternalOverviewsFlag( bool flag );
331 
336  bool getInternalOverviewsFlag() const;
337 
344  void setOutputDirectory( const std::string& directory );
345 
353  void setOutputFileNamesFlag( bool flag );
354 
359  bool getOutputFileNamesFlag() const;
360 
365  void setOverrideFilteredImagesFlag( bool flag );
366 
373  bool getOverrideFilteredImagesFlag() const;
374 
383  void setNumberOfThreads( ossim_uint32 threads );
384  void setNumberOfThreads( const std::string& threads );
385 
387  const std::vector<std::string>& getFilteredImages() const;
388 
396  std::vector<std::string>& getFilteredImages();
397 
398 private:
399 
401  bool keyIsTrue( const std::string& key ) const;
402 
411  bool isFiltered(const ossimFilename& f) const;
412 
417  void initializeDefaultFilterList();
418 
420  void dumpFilteredImageList() const;
421 
422  void createOverview(ossimRefPtr<ossimImageHandler>& ih,
423  bool& consumedHistogramOptions,
424  bool& consumedCmmOptions);
425 
426  void createOverview(ossimRefPtr<ossimImageHandler>& ih,
428  ossim_uint32 entry,
429  bool useEntryIndex,
430  bool& consumedHistogramOptions);
431 
432  void createThumbnail(ossimRefPtr<ossimImageHandler> &ih);
433 
435  bool hasRequiredOverview( ossimRefPtr<ossimImageHandler>& ih,
437 
439  bool hasCmmOption() const;
440 
441  void createHistogram(ossimRefPtr<ossimImageHandler>& ih);
442 
443  void createHistogram(ossimRefPtr<ossimImageHandler>& ih,
444  ossim_uint32 entry,
445  bool useEntryIndex);
446 
447  void computeMinMax(ossimRefPtr<ossimImageHandler>& ih);
448 
449  void computeMinMax(ossimRefPtr<ossimImageHandler>& ih,
450  ossim_uint32 entry,
451  bool useEntryIndex);
452 
454  void usage(ossimArgumentParser& ap);
455 
456  void outputOverviewWriterTypes() const;
457 
462  bool isDirectoryBasedImage(const ossimImageHandler* ih) const;
463 
468  void getOverviewType(std::string& type) const;
469 
471  void setProps(ossimPropertyInterface* pi) const;
472 
477 
479  ossim_uint32 getNextWriterPropIndex() const;
480 
482  ossim_uint32 getNextReaderPropIndex() const;
483 
485  ossim_uint32 getThumbnailSize() const;
486 
487  int getThumbnailStretchType()const;
488  std::string getThumbnailType()const;
489  std::string getThumbnailFilename(ossimImageHandler *ih) const;
495  void addOption(const std::string &key, ossim_uint32 value);
496  void addOption( const std::string& key, const std::string& value );
497 
501  void setErrorStatus( ossim_int32 status );
502 
504  void executePrepCommands() const;
505 
507  void executeFileCommands( const ossimFilename& file ) const;
508 
510  void executePostCommands() const;
511 
513  void executeCommands( const std::string& prefix,
514  const ossimFilename& file ) const;
515 
517  void substituteCommandString( const ossimFilename& file,
518  const std::string& prefix,
519  const std::string& commandKey,
520  ossimString& command ) const;
521 
523  void substituteFileStrings( const ossimFilename& file,
524  ossimString& command ) const;
525 
527  void gsubDate( const std::string& commandPrefix,
528  ossimString& command ) const;
529 
532 
534  std::mutex m_mutex;
535 
537 
539  std::vector<std::string> m_filteredImages;
540 };
541 
542 #endif /* #ifndef ossimImageUtil_HEADER */
void usage()
ossimHistogramMode
std::vector< std::string > m_filteredImages
Hold images we never want to process.
ossimReferenced allows for shared object ref counting if the reference count ever gets to 0 or less i...
ossimFileWalker * m_fileWalker
Utility class to walk through directories and get a list of files to process.
OSSIM_DLL ossim_uint32 getNumberOfThreads()
Get the number threads to use from ossimPreferences or ossim::Thread.
unsigned int ossim_uint32
ossim_int32 m_errorStatus
std::mutex m_mutex
return status
This class defines an abstract Handler which all image handlers(loaders) should derive from...
ossimRefPtr< ossimKeywordlist > m_kwl
Holds all options passed into intialize except writer props.
#define OSSIM_DLL
ossimImageUtil class.
virtual void processFile(const ossimFilename &file)=0
Pure virtual processFile method.
int ossim_int32