OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimTiffOverviewBuilder.cpp
Go to the documentation of this file.
1 //---
2 //
3 // License: MIT
4 //
5 // Author: David Burken
6 //
7 // Description:
8 //
9 // Contains class definition for TiffOverviewBuilder
10 //
11 //---
12 // $Id$
13 
18 #include <ossim/base/ossimCommon.h>
21 #include <ossim/base/ossimNotify.h>
23 #include <ossim/base/ossimIpt.h>
24 #include <ossim/base/ossimIrect.h>
27 #include <ossim/base/ossimTrace.h>
38 
39 #include <xtiffio.h>
40 #include <algorithm> /* for std::fill */
41 #include <sstream>
42 using namespace std;
43 
45  "ossimTiffOverviewBuilder",
47 
48 static ossimTrace traceDebug("ossimTiffOverviewBuilder:debug");
49 
50 // Property keywords.
51 static const char COPY_ALL_KW[] = "copy_all_flag";
52 static const char TEMP_EXTENSION[] = "temp_extension";
53 static const char INTERNAL_OVERVIEWS_KW[] = "internal_overviews_flag";
54 
55 #ifdef OSSIM_ID_ENABLED
56 static const char OSSIM_ID[] = "$Id: ossimTiffOverviewBuilder.cpp 22362 2013-08-07 20:23:22Z dburken $";
57 #endif
58 
59 
60 //*******************************************************************
61 // Public Constructor:
62 //*******************************************************************
64  :
66  m_nullDataBuffer(0),
67  m_bytesPerPixel(1),
68  m_bitsPerSample(8),
69  m_tileWidth(0),
70  m_tileHeight(0),
71  m_tileSizeInBytes(0),
72  m_sampleFormat(0),
73  m_currentTiffDir(0),
74  m_tiffCompressType(COMPRESSION_NONE),
75  m_jpegCompressQuality(DEFAULT_COMPRESS_QUALITY),
76  m_resampleType(ossimFilterResampler::ossimFilterResampler_BOX),
77  m_nullPixelValues(),
78  m_copyAllFlag(false),
79  m_outputTileSizeSetFlag(false),
80  m_internalOverviewsFlag(false)
81 {
82  if (traceDebug())
83  {
85  << "ossimTiffOverviewBuilder::ossimTiffOverviewBuilder DEBUG:\n";
86 #ifdef OSSIM_ID_ENABLED
88  << "OSSIM_ID: "
89  << OSSIM_ID
90  << "\n";
91 #endif
93  << "overview stop dimension: " << m_overviewStopDimension
94  << std::endl;
95  }
96 }
97 
99 {
100 }
101 
104 {
105  m_resampleType = resampleType;
106 }
107 
108 bool ossimTiffOverviewBuilder::buildOverview(const ossimFilename& overview_file, bool copy_all)
109 {
110  if (traceDebug())
111  {
113  << "ossimTiffOverviewBuilder::buildOverview DEBUG:"
114  << "\noverview file: " << overview_file.c_str()
115  << "\ncopy_all flag: " << (copy_all?"true":"false")
116  << std::endl;
117  }
118 
119 
120  m_outputFile = overview_file;
121  m_copyAllFlag = copy_all;
122 
123  return execute();
124 }
125 
126 
128 {
129  static const char MODULE[] = "ossimTiffOverviewBuilder::execute";
130 
132  {
134  << MODULE << " ERROR:"
135  << "\nError status has been previously set! Returning..."
136  << std::endl;
137  return false;
138  }
139 
141  {
142  setErrorStatus();
143  return false;
144  }
145 
148  {
149  return false;
150  }
151 
152  // Check the file. Disallow same file overview building.
154  {
156  << "Source image file and overview file cannot be the same!"
157  << std::endl;
158  return false;
159  }
160 
161  // RP - allow user to set extension with hidden option. Used to add unique suffix to prevent duplicate requests from stomping each other
162  ossimFilename outputFileTemp;
163  if ( !buildInternalOverviews() )
164  {
165  outputFileTemp = m_outputFile;
166  if ( m_tempExtension.size() )
167  {
168  outputFileTemp += "." + m_tempExtension;
169  }
170 
171  // Add .tmp in case process gets aborted to avoid leaving bad .ovr file.
172  outputFileTemp += ".tmp";
173  }
174 
175  // Required number of levels needed including r0.
176  ossim_uint32 requiedResLevels = getRequiredResLevels(m_imageHandler.get());
177 
178  // Zero based starting resLevel.
179  ossim_uint32 startingResLevel = 0;
180  if ( !copyR0() )
181  {
182  startingResLevel = m_imageHandler->getNumberOfDecimationLevels();
183  }
184 
185  if (traceDebug())
186  {
188  << MODULE
189  << "\nCurrent number of reduced res sets: "
191  << "\nNumber of required reduced res sets: " << requiedResLevels
192  << "\nStarting reduced res set: " << startingResLevel
193  << "\nResampling type: " << getOverviewType().c_str()
194  << std::endl;
195  }
196 
197  if ( startingResLevel >= requiedResLevels )
198  {
200  << MODULE << " NOTICE:"
201  << "\nImage has required reduced resolution data sets.\nReturning..."
202  << std::endl;
203  return true;
204  }
205 
206  //---
207  // If image handler is band selector, start with all bands.
208  // Some sources, e.g. ossimEnviTileSource can pick up default
209  // bands and filter out all other bands.
210  //---
212 
213  //---
214  // If alpha bit mask generation was requested, then need to instantiate the mask writer object.
215  // This is simply a "transparent" tile source placed after to the right of the image handler
216  // that scans the pixels being pulled and accumulates alpha bit mask for writing at the end.
217  //---
218  if (m_bitMaskSpec.getSize() > 0)
219  {
228  }
229 
230  ossimStdOutProgress* progressListener = 0; // Only used on master.
231  TIFF* tif = 0; // Only used on master.
232 
234  setPercentComplete(0.0);
235 
236  if (ossimMpi::instance()->getRank() == 0 )
237  {
238  //---
239  // See if the file can be opened for writing.
240  // Note: If this file existed previously it will be overwritten.
241  //---
242  tif = openTiff(outputFileTemp);
243  if (!tif)
244  {
245  // Set the error...
246  setErrorStatus();
248  << __FILE__ << " " << __LINE__ << " " << MODULE
249  << "\nCannot open file: " << outputFileTemp << std::endl;
250  return false;
251  }
252 
253  //---
254  // Check for a listeners. If the list is empty, add a standard out
255  // listener so that command line apps like img2rr will get some progress.
256  //---
257  ossimStdOutProgress* progressListener = 0;
258  if (theListenerList.empty())
259  {
260  progressListener = new ossimStdOutProgress(0, true);
261  addListener(progressListener);
262  }
263 
264  if (startingResLevel == 0)
265  {
266  if (!writeR0(tif))
267  {
268  // Set the error...
269  setErrorStatus();
271  << __FILE__ << " " << __LINE__
272  << "\nError copying image!" << std::endl;
273 
274  closeTiff(tif);
275  if (progressListener)
276  {
277  removeListener(progressListener);
278  delete progressListener;
279  progressListener = 0;
280  }
281 
282  if ( outputFileTemp.exists() && !buildInternalOverviews() )
283  {
284  ossimFilename::remove( outputFileTemp );
285  }
286  return false;
287  }
288 
289  ++startingResLevel; // Go to r1.
290  }
291 
292  if (needsAborting())
293  {
294  closeTiff(tif);
295  if (progressListener)
296  {
297  removeListener(progressListener);
298  delete progressListener;
299  progressListener = 0;
300  }
301  return false;
302  }
303 
304  TIFFFlush(tif);
305 
306  } // End of master only write of r0.
307 
308  for (ossim_uint32 i = startingResLevel; i < requiedResLevels; ++i)
309  {
310  if (ossimMpi::instance()->getRank() == 0 )
311  {
312  TIFFFlush(tif);
313  }
314 
315  // Sync all processes...
317 
319 
320  //---
321  // If we copied r0 to the overview file use it instead of the
322  // original image handler as it is probably faster.
323  //---
324  if ( !copyR0() && (i <= m_imageHandler->getNumberOfDecimationLevels()) )
325  {
326  ih = m_imageHandler;
327  }
328  else
329  {
330  // We know we're a tiff so don't use the factory.
331  ih = new ossimTiffTileSource;
332  if ( ih->open(outputFileTemp) == false )
333  {
334  ih = 0;
335 
336  // Set the error...
337  setErrorStatus();
339  << __FILE__ << " " << __LINE__ << " " << MODULE
340  << "\nCannot open file: " << outputFileTemp << std::endl;
341 
342  return false;
343  }
344 
345  //---
346  // Since the overview file is being opened here, need to set its handler's starting res
347  // level where the original image file left off. This is usually R1 since the original
348  // file only has R0, but the original file may have more than R0:
349  //---
350  if ( !copyR0() && !buildInternalOverviews() )
351  {
353  }
354  }
355 
356  // If mask is to be generated, need to notify both the writer and the reader of new
357  // input source:
358  if (m_bitMaskSpec.getSize() > 0)
359  {
362  }
363 
364  if ( !writeRn( ih.get(), tif, i, (i==startingResLevel) && !copyR0() ) )
365  {
366  // Set the error...
367  setErrorStatus();
369  << __FILE__ << " " << __LINE__ << " " << MODULE
370  << "\nError creating reduced res set: " << i << std::endl;
371 
372  ih->disconnect();
373  ih = 0;
374  if (tif)
375  {
376  closeTiff(tif);
377  tif = 0;
378  }
379 
380  if (progressListener)
381  {
382  removeListener(progressListener);
383  delete progressListener;
384  progressListener = 0;
385  }
386 
387  if ( outputFileTemp.exists() && !buildInternalOverviews() )
388  {
389  ossimFilename::remove( outputFileTemp );
390  }
391 
392  return false;
393  }
394 
395  if (needsAborting())
396  {
397  ih->disconnect();
398  ih = 0;
399  if (tif)
400  {
401  closeTiff(tif);
402  tif = 0;
403  }
404  if (progressListener)
405  {
406  removeListener(progressListener);
407  delete progressListener;
408  progressListener = 0;
409  }
410  return false;
411  }
412 
413  if (m_bitMaskSpec.getSize() > 0)
414  {
417  }
418  ih = 0;
419  }
420 
421  if (ossimMpi::instance()->getRank() == 0 )
422  {
423  if (tif)
424  {
425  closeTiff(tif);
426  tif = 0;
427  }
428 
429  // Write out the alpha bit mask if one was enabled:
430  if (m_maskWriter.valid())
431  {
432  ossimNotify(ossimNotifyLevel_INFO) << "Writing alpha bit mask file..." << std::endl;
433  m_maskWriter->close();
434  }
435 
436  // Remove the listener if we had one.
437  if (progressListener)
438  {
439  removeListener(progressListener);
440  delete progressListener;
441  progressListener = 0;
442  }
443 
444  if ( !buildInternalOverviews() )
445  {
446  outputFileTemp.rename(m_outputFile);
447  }
448 
449  if(traceDebug())
450  {
452  << "Wrote file: " << m_outputFile.c_str() << std::endl;
453  }
454 
455  setCurrentMessage(ossimString("Finished..."));
456  }
457 
458  finalize(); // Reset band list if a band selector.
459 
460  return true;
461 }
462 
464 {
465  static const char MODULE[] = "ossimTiffOverviewBuilder::writeR0";
466 
468 
469  if (!setTags(tif, rect, 0))
470  {
471  closeTiff(tif);
472  ossimNotify(ossimNotifyLevel_WARN) << MODULE << " Error writing tags!" << std::endl;
473  return false;
474  }
475 
476  // Set the geotiff tags.
479  0,
480  tif) == false )
481  {
482  if (traceDebug())
483  {
485  << MODULE << " NOTICE: geotiff tags not set." << std::endl;
486  }
487  }
488 
491  ossim_int32 tilesWide = samples % m_tileWidth ?
492  samples / m_tileWidth + 1 : samples / m_tileWidth;
493  ossim_int32 tilesHigh = lines % m_tileHeight ?
494  lines / m_tileHeight + 1 : lines / m_tileHeight;
495  ossim_int32 numberOfTiles = tilesWide * tilesHigh;
496 
497  int tileNumber = 0;
498 
499  if (traceDebug())
500  {
502  << "ossimTiffOverviewBuilder::writeR0 DEBUG:"
503  << "\nsamples: " << samples
504  << "\nlines: " << lines
505  << "\ntilesWide: " << tilesWide
506  << "\ntilesHigh: " << tilesHigh
507  << "\nnumberOfTiles: " << numberOfTiles
508  << std::endl;
509  }
510 
511  setCurrentMessage(ossimString("Copying r0..."));
512 
513  //***
514  // Tile loop in the line direction.
515  //***
516  for(int i = 0; i < tilesHigh; ++i)
517  {
518  ossimIpt origin(0, 0);
519  origin.y = i * m_tileHeight;
520 
521  //***
522  // Tile loop in the sample (width) direction.
523  //***
524  for(int j = 0; (j < tilesWide)&&(!needsAborting()); ++j)
525  {
526  origin.x = j * m_tileWidth;
527 
530  origin.y,
531  origin.x +(m_tileWidth-1),
532  origin.y +(m_tileHeight-1)));
533 
534  // Check for errors reading tile:
535  if ( m_imageHandler->hasError() )
536  {
538  << MODULE << " ERROR: reading tile: " << i << std::endl;
539  return false;
540  }
541 
542  // If masking was enabled, pass the tile onto that object for processing:
543  if (m_maskWriter.valid())
544  m_maskWriter->generateMask(t, 0);
545 
546  //***
547  // Band loop.
548  //***
549  for (uint32 band=0;
551  ++band)
552  {
553  tdata_t data;
554 
555  if ( t.valid() && (t->getDataObjectStatus() != OSSIM_NULL) )
556  {
557  // Grab a pointer to the tile for the band.
558  data = static_cast<tdata_t>(t->getBuf(band));
559  }
560  else
561  {
562  data = static_cast<tdata_t>(&(m_nullDataBuffer.front()));
563  }
564 
565  // Write the tile.
566  int bytesWritten = 0;
567  bytesWritten = TIFFWriteTile(tif,
568  data,
569  origin.x,
570  origin.y,
571  0, // z
572  band); // sample
573 
574  if (bytesWritten != m_tileSizeInBytes)
575  {
577  << MODULE << " ERROR:"
578  << "Error returned writing tiff tile: " << i
579  << "\nExpected bytes written: " << m_tileSizeInBytes
580  << "\nBytes written: " << bytesWritten
581  << std::endl;
583  return false;
584  }
585 
586  } // End of band loop.
587 
588  ++tileNumber;
589 
590  } // End of tile loop in the sample (width) direction.
591 
592  if (needsAborting())
593  {
594  setPercentComplete(100.0);
595  break;
596  }
597  else
598  {
599  double tile = tileNumber;
600  double numTiles = numberOfTiles;
601  setPercentComplete(tile / numTiles * 100.0);
602  }
603 
604  } // End of tile loop in the line (height) direction.
605 
606  //***
607  // Write the current dirctory.
608  //***
609  if (!TIFFWriteDirectory(tif))
610  {
612  << MODULE << " Error writing directory!" << std::endl;
613  return false;
614  }
615 
617 
618  return true;
619 }
620 
622  TIFF* tif,
623  ossim_uint32 resLevel,
624  bool firstResLevel )
625 {
626  if ( ossimMpi::instance()->getRank() == 0 )
627  {
628  if ( tif ) // && buildInternalOverviews() )
629  {
630  // Create an empty directory to start with.
631  TIFFCreateDirectory( tif );
632  }
633  else
634  {
635  return false;
636  }
637  }
638  //---
639  // Set up the sequencer. This will be one of three depending on if we're
640  // running mpi and if we are a master process or a slave process.
641  //---
643 
644  if(ossimMpi::instance()->getNumberOfProcessors() > 1)
645  {
646  if ( ossimMpi::instance()->getRank() == 0 )
647  {
648  sequencer = new ossimMpiMasterOverviewSequencer();
649  }
650  else
651  {
652  sequencer = new ossimMpiSlaveOverviewSequencer();
653  }
654  }
655  else
656  {
657  sequencer = new ossimOverviewSequencer();
658  }
659 
660  sequencer->setImageHandler(imageHandler);
661 
663  {
665  }
666 
667  // sourceResLevel: This is the res level to pull data from:
668  ossim_uint32 sourceResLevel = imageHandler->getNumberOfDecimationLevels() +
669  imageHandler->getStartingResLevel() - 1;
670 
671  sequencer->setSourceLevel(sourceResLevel);
672  sequencer->setResampleType(m_resampleType);
674 
675  if ( firstResLevel )
676  {
677  // Set up things that are only performed on first scan through tiles.
678 
680  {
681  // Accumulate a histogram. Can't do with mpi/multi-process.
682  if(ossimMpi::instance()->getNumberOfProcessors() == 1)
683  {
684  sequencer->setHistogramMode(getHistogramMode());
685  }
686  //---
687  // else{} Not sure if we want an error thrown here. For now will handle at the
688  // application level.
689  //---
690  }
691  if ( getScanForMinMaxNull() == true )
692  {
693  sequencer->setScanForMinMaxNull(true);
694  }
695  else if ( getScanForMinMax() == true )
696  {
697  sequencer->setScanForMinMax(true);
698  }
699  }
700 
701  // Note sequence setup must be performed before intialize.
702  sequencer->initialize();
703 
704  // If we are a slave process start the resampling of tiles.
705  if (ossimMpi::instance()->getRank() != 0 )
706  {
707  sequencer->slaveProcessTiles();
708  return true;
709  }
710 
711  //---
712  // The rest of the method on master node only.
713  //---
714  static const char MODULE[] = "ossimTiffOverviewBuilder::writeRn";
715 
716  ostringstream os;
717  os << "creating r" << resLevel << "...";
718  setCurrentMessage(os.str());
719 
720  if (resLevel == 0)
721  {
722  return false;
723  }
724 
725  ossimIrect rect;
726  sequencer->getOutputImageRectangle(rect);
727 
728  if (!setTags(tif, rect, resLevel))
729  {
730  setErrorStatus();
731  closeTiff(tif);
732  tif = 0;
733  ossimNotify(ossimNotifyLevel_WARN) << MODULE << " Error writing tags!" << std::endl;
734  return false;
735  }
736 
737  if ( !buildInternalOverviews() && !copyR0() && (resLevel == 1) )
738  {
739  //---
740  // Set the geotif tags for the first layer.
741  // Note this is done in writeR0 method if m_copyAllFlag is set.
742  //---
744  ossimDrect(rect),
745  resLevel,
746  tif) == false )
747  {
748  if (traceDebug())
749  {
751  << MODULE << " NOTICE: geotiff tags not set." << std::endl;
752  }
753  }
754  }
755 
756  ossim_uint32 outputTilesWide = sequencer->getNumberOfTilesHorizontal();
757  ossim_uint32 outputTilesHigh = sequencer->getNumberOfTilesVertical();
758  ossim_uint32 numberOfTiles = sequencer->getNumberOfTiles();
760 
761  if (traceDebug())
762  {
764  << "ossimTiffOverviewBuilder::writeRn DEBUG:"
765  << "\noutputTilesWide: " << outputTilesWide
766  << "\noutputTilesHigh: " << outputTilesHigh
767  << "\nnumberOfTiles: " << numberOfTiles
768  << std::endl;
769  }
770 
771  // Tile loop in the line direction.
772  ossim_uint32 y = 0;
773 
774  for(ossim_uint32 i = 0; i < outputTilesHigh; ++i)
775  {
776  // Tile loop in the sample (width) direction.
777  ossim_uint32 x = 0;
778  for(ossim_uint32 j = 0; (j < outputTilesWide)&&!needsAborting(); ++j)
779  {
780  // Grab the resampled tile.
781  ossimRefPtr<ossimImageData> t = sequencer->getNextTile();
782 
783  // Check for errors reading tile:
784  if ( sequencer->hasError() )
785  {
786  setErrorStatus();
788  << MODULE << " ERROR: reading tile: " << i << std::endl;
789  return false;
790  }
791 
792  if ( t.valid() && ( t->getDataObjectStatus() != OSSIM_NULL ) )
793  {
794  // Write it to the tiff.
795  for (ossim_uint32 band = 0; (band < t->getNumberOfBands())&&!needsAborting(); ++band)
796  {
797  // Write the tile.
798  int bytesWritten = 0;
799  bytesWritten = TIFFWriteTile(tif,
800  t->getBuf(band),
801  x,
802  y,
803  0, // z
804  band); // sample
805 
806  if (bytesWritten != m_tileSizeInBytes)
807  {
809  << MODULE << " ERROR:"
810  << "Error returned writing tiff tile: " << i
811  << "\nExpected bytes written: " << m_tileSizeInBytes
812  << "\nBytes written: " << bytesWritten
813  << std::endl;
815 
816  return false;
817  }
818  }
819  }
820  x += m_tileWidth; // Increment x for next TIFFWriteTile.
821  ++tileNumber; // Increment tile number for percent complete.
822 
823  } // End of tile loop in the sample (width) direction.
824 
825  if (needsAborting())
826  {
827  setPercentComplete(100.0);
828  break;
829  }
830  else
831  {
832  double tile = tileNumber;
833  double numTiles = numberOfTiles;
834  setPercentComplete(tile / numTiles * 100.0);
835  }
836 
837  y += m_tileHeight; // Increment y for next TIFFWriteTile.
838 
839  } // End of tile loop in the line (height) direction.
840 
841  //---
842  // Write the current dirctory.
843  //---
844  if (!TIFFFlush(tif))
845  {
846  setErrorStatus();
848  << MODULE << " Error writing to TIF file!" << std::endl;
849  return false;
850  }
851 
852  if ( firstResLevel )
853  {
854  if ( ossimMpi::instance()->getNumberOfProcessors() == 1 )
855  {
857  {
858  // Write the histogram.
859  ossimFilename histoFilename = getOutputFile();
860  histoFilename.setExtension("his");
861  sequencer->writeHistogram(histoFilename);
862  }
863 
864  if ( ( getScanForMinMaxNull() == true ) || ( getScanForMinMax() == true ) )
865  {
866  // Write the omd file:
867  ossimFilename file = getOutputFile();
868  file = file.setExtension("omd");
869  sequencer->writeOmdFile(file);
870  }
871  }
872  }
873 
875 
876  return true;
877 }
878 
879 //*******************************************************************
880 // Private Method:
881 //*******************************************************************
883  const ossimIrect& outputRect,
884  ossim_int32 resLevel) const
885 {
886  if (outputRect.hasNans())
887  {
888  return false;
889  }
890 
891  ossim_int32 imageWidth = outputRect.width();
892  ossim_int32 imageHeight = outputRect.height();
893  int16 samplesPerPixel = m_imageHandler->getNumberOfOutputBands();
894  ossim_float64 minSampleValue = m_imageHandler->getMinPixelValue();
895  ossim_float64 maxSampleValue = m_imageHandler->getMaxPixelValue();
896 
897  if (resLevel)
898  {
899  TIFFSetField( tif, TIFFTAG_SUBFILETYPE, FILETYPE_REDUCEDIMAGE );
900  }
901 
902  if (traceDebug())
903  {
905  << "ossimTiffOverviewBuilder::setTags DEBUG:"
906  << "\nrrds_level: " << resLevel
907  << "\nimageWidth: " << imageWidth
908  << "\nimageHeight: " << imageHeight
909  << "\nminSampleValue: " << minSampleValue
910  << "\nmaxSampleValue: " << maxSampleValue
911  << "\ncompression: " << m_tiffCompressType
912  << std::endl;
913  }
914  TIFFSetField( tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_SEPARATE );
915  TIFFSetField( tif, TIFFTAG_IMAGEWIDTH, imageWidth);
916  TIFFSetField( tif, TIFFTAG_IMAGELENGTH, imageHeight);
917  TIFFSetField( tif, TIFFTAG_BITSPERSAMPLE, m_bitsPerSample );
918  TIFFSetField( tif, TIFFTAG_SAMPLEFORMAT, m_sampleFormat );
919  TIFFSetField( tif, TIFFTAG_SAMPLESPERPIXEL, samplesPerPixel );
920 
922  TIFFSetField( tif, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB );
923  else
924  TIFFSetField( tif, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISBLACK );
925 
926  TIFFSetField( tif, TIFFTAG_TILEWIDTH, m_tileWidth );
927  TIFFSetField( tif, TIFFTAG_TILELENGTH, m_tileHeight );
928 
929  // Set the compression related tags...
930  if (m_tiffCompressType != COMPRESSION_JPEG)
931  {
932  TIFFSetField( tif, TIFFTAG_COMPRESSION, m_tiffCompressType );
933  }
934  //---
935  // If jpeg only turn on compression for 8 bit, one or three band data. Not
936  // sure what compression types can handle what but this was crashing
937  // ossim-prepoc on a directory walk with jpeg compression.
938  //---
939  else if ( (m_tiffCompressType == COMPRESSION_JPEG) &&
941  ( ( m_imageHandler->getNumberOfInputBands() == 3 ) ||
942  ( m_imageHandler->getNumberOfInputBands() == 1 ) ) )
943  {
944  TIFFSetField( tif, TIFFTAG_COMPRESSION, m_tiffCompressType );
945  TIFFSetField( tif, TIFFTAG_JPEGQUALITY, m_jpegCompressQuality);
946  }
947  else
948  {
949  if ( traceDebug() && (m_tiffCompressType != COMPRESSION_NONE ) )
950  {
952  << "ossimTiffOverviewBuilder::setTags WARNING:\n"
953  << "Compression not set for this data type:\n"
954  << "scalar type: "
957  << "\nband count: " << m_imageHandler->getNumberOfInputBands()
958  << std::endl;
959  }
960  TIFFSetField( tif, TIFFTAG_COMPRESSION, COMPRESSION_NONE );
961  }
962 
963  // Set the min/max values.
965  {
966  case OSSIM_SINT16:
967  case OSSIM_FLOAT32:
968  case OSSIM_FLOAT64:
970  TIFFSetField( tif, TIFFTAG_SMINSAMPLEVALUE, minSampleValue );
971  TIFFSetField( tif, TIFFTAG_SMAXSAMPLEVALUE, maxSampleValue );
972  break;
973 
974  case OSSIM_UINT8:
975  case OSSIM_USHORT11:
976  case OSSIM_USHORT12:
977  case OSSIM_USHORT13:
978  case OSSIM_USHORT14:
979  case OSSIM_USHORT15:
980  case OSSIM_UINT16:
981  case OSSIM_UINT32:
982  default:
983  TIFFSetField( tif, TIFFTAG_MINSAMPLEVALUE,
984  static_cast<int>(minSampleValue) );
985  TIFFSetField( tif, TIFFTAG_MAXSAMPLEVALUE,
986  static_cast<int>(maxSampleValue) );
987  break;
988  }
989 
990  return true;
991 }
992 
994  const ossimDrect& boundingRect,
995  ossim_uint32 resLevel,
996  TIFF* tif)
997 {
998  bool result = false;
999 
1000  if ( geom && tif )
1001  {
1002  const ossimProjection* proj = geom->getProjection();
1003  if (proj)
1004  {
1005  // Must duplicate if changing scale.
1006  ossimObject* obj = proj->dup();
1008  if ( mapProj )
1009  {
1010  if ( mapProj->hasModelTransform() == false )
1011  {
1012  if (resLevel)
1013  {
1014  ossim_float64 factor = (ossim_float64)(1 << resLevel);
1015  mapProj->applyScale(ossimDpt(factor, factor), true);
1016  }
1018  new ossimMapProjectionInfo(mapProj, boundingRect);
1019  result = ossimGeoTiff::writeTags(tif, projInfo);
1020  }
1021  }
1022  delete obj; // Cleanup from dup.
1023  obj = 0;
1024  }
1025  }
1026 
1027  return result;
1028 }
1029 
1030 TIFF* ossimTiffOverviewBuilder::openTiff(const ossimString& filename) const
1031 {
1032  ossimString openMode;
1033  if ( !buildInternalOverviews() )
1034  {
1035  openMode = "w";
1036 
1037  ossim_uint64 fourGigs = (static_cast<ossim_uint64>(1024)*
1038  static_cast<ossim_uint64>(1024)*
1039  static_cast<ossim_uint64>(1024)*
1040  static_cast<ossim_uint64>(4));
1042  ossim_uint64 byteCheck =
1043  (static_cast<ossim_uint64>(bounds.width())*
1044  static_cast<ossim_uint64>(bounds.height())*
1045  static_cast<ossim_uint64>(m_imageHandler->getNumberOfOutputBands())*
1046  static_cast<ossim_uint64>(ossim::scalarSizeInBytes(m_imageHandler->
1047  getOutputScalarType())));
1048 
1049  if((byteCheck*static_cast<ossim_uint64>(2))>fourGigs)
1050  {
1051  if(traceDebug())
1052  {
1053  ossimNotify(ossimNotifyLevel_DEBUG) << " Big tiff activated\n";
1054  }
1055  openMode += "8";
1056  }
1057  else
1058  {
1059  if(traceDebug())
1060  {
1061  ossimNotify(ossimNotifyLevel_DEBUG) << " No big tiff activated\n";
1062  }
1063  }
1064  }
1065  else
1066  {
1067  openMode = "r+"; // Append to existing file...
1068  }
1069 
1070  // Open:
1071  return XTIFFOpen( filename.c_str(), openMode.c_str() );
1072 }
1073 
1075 {
1076  XTIFFClose( tif );
1077 }
1078 
1080 {
1081  switch (compression_type)
1082  {
1083  case COMPRESSION_JPEG:
1084  case COMPRESSION_LZW:
1085  case COMPRESSION_DEFLATE:
1086  case COMPRESSION_PACKBITS:
1087  m_tiffCompressType = compression_type;
1088  break;
1089  default:
1091  if (traceDebug())
1092  {
1094  << __FILE__ << " " << __LINE__
1095  << "\nossimTiffOverviewBuilder::setCompressionType Unsupported compression type: "
1096  << compression_type << "\nDefaulting to none."
1097  << std::endl;
1098  }
1099  break;
1100  }
1101 }
1102 
1104 {
1105  if (quality > 1 && quality < 101)
1106  {
1107  m_jpegCompressQuality = quality;
1108  }
1109  else
1110  {
1112 
1114  << "ossimTiffOverviewBuilder::setJpegCompressionQuality\n"
1115  << "\nCompression quality of " << quality << " is out of range!"
1116  << "\nRange is 100 to 1. Current quality set to default of 75."
1117  << std::endl;
1118  }
1119 }
1120 
1122 {
1123  return m_copyAllFlag;
1124 }
1125 
1127 {
1128  m_copyAllFlag = flag;
1129 }
1130 
1132 {
1133  m_internalOverviewsFlag = flag;
1134 }
1135 
1137 {
1138  return m_internalOverviewsFlag;
1139 }
1140 
1142 {
1143  return this;
1144 }
1145 
1147 {
1148  return this;
1149 }
1150 
1152 {
1153  m_outputFile = file;
1154 }
1155 
1157 {
1158  ossimFilename result;
1159 
1160  if ( buildInternalOverviews() )
1161  {
1162  // m_imageHandler pointer good if buildInternalOverviews() returns true.
1163  result = m_imageHandler->getFilename();
1164  }
1165  else
1166  {
1167  result = m_outputFile;
1168  }
1169 
1171  {
1172  if ( m_imageHandler.valid() )
1173  {
1174  bool usePrefix = (m_imageHandler->getNumberOfEntries()>1?true:false);
1175  result = m_imageHandler->
1176  getFilenameWithThisExtension(ossimString("ovr"), usePrefix);
1177  }
1178  }
1179 
1180  return result;
1181 }
1182 
1184 {
1185  m_tileWidth = tileSize.x;
1186  m_tileHeight = tileSize.y;
1187  m_outputTileSizeSetFlag = true;
1188 }
1189 
1191 {
1192  static const char MODULE[] = "ossimTiffOverviewBuilder::initializeFromHandler";
1193 
1194  bool result = ossimOverviewBuilderBase::setInputSource( imageSource );
1195 
1196  if ( result )
1197  {
1199  {
1200  ossimIpt tileSize;
1201  ossim::defaultTileSize(tileSize);
1202  m_tileWidth = tileSize.x;
1203  m_tileHeight = tileSize.y;
1204  }
1205 
1206  if (traceDebug())
1207  {
1208  CLOG << "DEBUG:"
1209  << "\nm_tileWidth: " << m_tileWidth
1210  << "\nm_tileHeight: " << m_tileHeight
1211  << "\nSource image is tiled: "
1212  << (m_imageHandler->isImageTiled()?"true":"false")
1213  << "\nm_imageHandler->getTileWidth(): "
1215  << "\nm_imageHandler->getTileHeight(): "
1217  << "\nm_imageHandler->getImageTileWidth(): "
1219  << "\nm_imageHandler->getImageTileHeight(): "
1221  << std::endl;
1222  }
1223 
1225  {
1226  case OSSIM_UINT8:
1227  m_bitsPerSample = 8;
1228  m_bytesPerPixel = 1;
1229  m_sampleFormat = SAMPLEFORMAT_UINT;
1230  break;
1231 
1232  case OSSIM_USHORT11:
1233  case OSSIM_USHORT12:
1234  case OSSIM_USHORT13:
1235  case OSSIM_USHORT14:
1236  case OSSIM_USHORT15:
1237  case OSSIM_UINT16:
1238  m_bitsPerSample = 16;
1239  m_bytesPerPixel = 2;
1240  m_sampleFormat = SAMPLEFORMAT_UINT;
1241  break;
1242 
1243  case OSSIM_SINT16:
1244  m_bitsPerSample = 16;
1245  m_bytesPerPixel = 2;
1246  m_sampleFormat = SAMPLEFORMAT_INT;
1247  break;
1248 
1249  case OSSIM_SINT32:
1250  m_bitsPerSample = 32;
1251  m_bytesPerPixel = 4;
1252  m_sampleFormat = SAMPLEFORMAT_INT;
1253  break;
1254 
1255  case OSSIM_UINT32:
1256  m_bitsPerSample = 32;
1257  m_bytesPerPixel = 4;
1258  m_sampleFormat = SAMPLEFORMAT_UINT;
1259  break;
1260 
1261  case OSSIM_FLOAT32:
1262  m_bitsPerSample = 32;
1263  m_bytesPerPixel = 4;
1264  m_sampleFormat = SAMPLEFORMAT_IEEEFP;
1265  break;
1266 
1268  case OSSIM_FLOAT64:
1269  m_bitsPerSample = 64;
1270  m_bytesPerPixel = 8;
1271  m_sampleFormat = SAMPLEFORMAT_IEEEFP;
1272  break;
1273 
1274  default:
1275  // Set the error...
1276  setErrorStatus();
1278  << MODULE << " ERROR:"
1279  << "\nUnknow pixel type: "
1281  getEntryString(m_imageHandler->getOutputScalarType()))
1282  << std::endl;
1283  result = false;
1284  }
1285 
1286  if ( result )
1287  {
1289 
1290  //---
1291  // Make a buffer to pass to pass to the write tile methods when an image
1292  // handler returns a null tile.
1293  //---
1295 
1296  // Fill it with zeroes.
1297  std::fill(m_nullDataBuffer.begin(), m_nullDataBuffer.end(), 0);
1298  }
1299  }
1300  else
1301  {
1302  // Set the error...
1303  setErrorStatus();
1305  << MODULE << " ERROR:"
1306  << "\nSetting image handler as input failed!"
1307  << std::endl;
1308  }
1309 
1310  return result;
1311 
1312 } // End: ossimTiffOverviewBuilder::setInputSource(ossimImageHandler* imageSource)
1313 
1315 {
1316  bool result = true;
1317  if (type == "ossim_tiff_nearest")
1318  {
1319  m_resampleType =
1321  }
1322  else if (type == "ossim_tiff_box")
1323  {
1325  }
1326  else
1327  {
1328  result = false;
1329  }
1330  return result;
1331 }
1332 
1334 {
1335  ossimString type;
1337  {
1338  type = "ossim_tiff_nearest";
1339  }
1340  else
1341  {
1342  type = "ossim_tiff_box"; // This is default...
1343  }
1344  return type;
1345 }
1346 
1348  std::vector<ossimString>& typeList)const
1349 {
1350  typeList.push_back(ossimString("ossim_tiff_box"));
1351  typeList.push_back(ossimString("ossim_tiff_nearest"));
1352 }
1353 
1355 {
1356  if ( property.valid() )
1357  {
1359  {
1360  m_jpegCompressQuality = property->valueToString().toInt32();
1361  }
1362  else if(property->getName() == ossimKeywordNames::COMPRESSION_TYPE_KW)
1363  {
1364  ossimString value = property->valueToString();
1365  value = value.downcase();
1366  if(value == "jpeg")
1367  {
1368  m_tiffCompressType = COMPRESSION_JPEG;
1369  }
1370  else if(value == "lzw")
1371  {
1372  m_tiffCompressType = COMPRESSION_LZW;
1373 
1374  }
1375  else if(value == "deflate")
1376  {
1377  m_tiffCompressType = COMPRESSION_DEFLATE;
1378  }
1379  else if(value == "packbits")
1380  {
1381  m_tiffCompressType = COMPRESSION_PACKBITS;
1382  }
1383  else
1384  {
1386  }
1387  }
1388  else if(property->getName() == COPY_ALL_KW)
1389  {
1390  m_copyAllFlag = property->valueToString().toBool();
1391  }
1392  else if(property->getName() == TEMP_EXTENSION)
1393  {
1394  m_tempExtension = property->valueToString();
1395  }
1396  else if( property->getName() == INTERNAL_OVERVIEWS_KW )
1397  {
1398  m_internalOverviewsFlag = property->valueToString().toBool();
1399  }
1401  {
1402  m_overviewStopDimension = property->valueToString().toUInt32();
1403  }
1404  else if(property->getName() == ossimKeywordNames::OUTPUT_TILE_SIZE_KW)
1405  {
1406  ossimIpt ipt;
1407 
1408  ipt.toPoint(property->valueToString());
1409 
1410  setOutputTileSize(ipt);
1411  }
1412  }
1413 }
1414 
1415 void ossimTiffOverviewBuilder::getPropertyNames(std::vector<ossimString>& propertyNames)const
1416 {
1417  propertyNames.push_back(ossimKeywordNames::COMPRESSION_QUALITY_KW);
1418  propertyNames.push_back(ossimKeywordNames::COMPRESSION_TYPE_KW);
1419  propertyNames.push_back(COPY_ALL_KW);
1420  propertyNames.push_back(INTERNAL_OVERVIEWS_KW);
1421  propertyNames.push_back(ossimKeywordNames::OVERVIEW_STOP_DIMENSION_KW);
1422  propertyNames.push_back(TEMP_EXTENSION);
1423 }
1424 
1426  ossim_int32 index,
1427  const ossimConnectableObject* obj) const
1428 {
1429  if ( (index == 0) &&
1430  PTR_CAST(ossimImageHandler, obj) )
1431  {
1432  return true;
1433  }
1434 
1435  return false;
1436 }
1437 
1439 {
1440  bool result = false;
1442  {
1443  if ( m_imageHandler->getClassName() == "ossimTiffTileSource" )
1444  {
1445  result = true;
1446  }
1447  else
1448  {
1450  << "Internal overviews opton not supported for class: "
1452  << std::endl;
1453  }
1454  }
1455  return result;
1456 }
1457 
1459 {
1460  return ( m_copyAllFlag && !buildInternalOverviews());
1461 }
16 bit unsigned integer (15 bits used)
virtual bool open()=0
Pure virtual open.
virtual void valueToString(ossimString &valueResult) const =0
ossim_uint32 x
virtual ossimRefPtr< ossimConnectableObject > disconnectMyInput(ossim_int32 inputIndex, bool disconnectOutputFlag=true, bool createEventFlag=true)
Will disconnect the object at the given input index and generate a connection event.
virtual bool addListener(ossimListener *listener)
virtual ossimObject * dup() const =0
void setScanForMinMaxNull(bool flag)
Turn on/off scan for min, max, null flag.
ossim_uint32 getRequiredResLevels(const ossimImageHandler *ih) const
Gets the required number of res levels.
ossim_uint32 getNumberOfTilesHorizontal() const
std::basic_ostringstream< char > ostringstream
Class for char output memory streams.
Definition: ossimIosFwd.h:35
virtual ossim_uint32 getNumberOfBands() const
64 bit floating point
#define CLOG
Definition: ossimTrace.h:23
virtual bool execute()
Calls buildOverview.
static const ossimFilename NIL
This was taken from Wx widgets for performing touch and access date stamps.
Definition: ossimFilename.h:40
16 bit unsigned integer
bool getCopyAllFlag() const
Method to return copy all flag.
virtual void getTypeNameList(std::vector< ossimString > &typeList) const
Method to populate class supported types.
virtual void disconnect(ossimConnectableObject *object=0)
Will disconnect the object passed in.
ossim_uint32 tileNumber
void barrier()
MPI Barrier method.
Definition: ossimMpi.cpp:42
virtual ossim_uint32 getNumberOfOutputBands() const
Returns the number of bands in a tile returned from this TileSource.
ossim_uint32 y
static const char * OUTPUT_TILE_SIZE_KW
bool valid() const
Definition: ossimRefPtr.h:75
virtual ~ossimTiffOverviewBuilder()
virtual destructor
std::list< ossimListener * > theListenerList
virtual ossimString getEntryString(ossim_int32 entry_number) const
virtual bool setInputSource(ossimImageHandler *imageSource)
Sets the input to the builder.
virtual ossim_uint32 getNumberOfLines(ossim_uint32 resLevel=0) const =0
Pure virtual, derived classes must implement.
bool writeR0(TIFF *tif)
Copy the full resolution image data to the output tif image.
ossim_uint32 height() const
Definition: ossimIrect.h:487
bool buildInternalOverviews() const
void setOutputTileSize(const ossimIpt &tileSize)
virtual ossim_uint32 getTileHeight() const
Returns the default processing tile height.
void setCopyAllFlag(bool flag)
Sets theCopyAllFlag.
virtual void getOutputImageRectangle(ossimIrect &rect) const
Gets the zero-based image rectangle for the output reduced resolution data set (rrds).
OSSIM_DLL void defaultTileSize(ossimIpt &tileSize)
16 bit signed integer
virtual void setPercentComplete(double percentComplete)
bool writeRn(ossimImageHandler *imageHandler, TIFF *tif, ossim_uint32 resLevel, bool firstResLevel)
Write reduced resolution data set to the tif file.
virtual ossimDataObjectStatus getDataObjectStatus() const
ossim_uint32 getNumberOfTilesVertical() const
16 bit unsigned integer (14 bits used)
static const ossimErrorCode OSSIM_ERROR
ossim_uint32 getNumberOfTiles() const
virtual ossimString getClassName() const
Definition: ossimObject.cpp:64
16 bit unsigned integer (13 bits used)
32 bit floating point
virtual ossimString getOverviewType() const
Gets the overview type.
unsigned short ossim_uint16
virtual bool loadState(const ossimKeywordlist &spec, const char *prefix=0)
Computes and writes the mask file according to the specification in the KWL.
32 bit unsigned integer
virtual void setProcessStatus(ossimProcessStatus processStatus)
virtual void applyScale(const ossimDpt &scale, bool recenterTiePoint)
Applies scale to theDeltaLonPerPixel, theDeltaLatPerPixel and theMetersPerPixel data members (eg: the...
virtual ossim_uint32 getTileWidth() const
Returns the default processing tile width.
virtual ossim_uint32 getNumberOfDecimationLevels() const
This returns the total number of decimation levels.
virtual double getMinPixelValue(ossim_uint32 band=0) const
Retuns the min pixel value.
double ossim_float64
void setJpegCompressionQuality(ossim_int32 quality)
Sets the compression quality for use when using a compression type of COMPRESSION_JPEG.
static ossimScalarTypeLut * instance()
Returns the static instance of an ossimScalarTypeLut object.
void writeHistogram()
Write histogram method.
bool hasModelTransform() const
bool exists() const
virtual bool setInputSource(ossimImageHandler *imageSource)
Sets the input to the builder.
virtual ossimRefPtr< ossimImageGeometry > getImageGeometry()
Returns the image geometry object associated with this tile source or NULL if non defined...
void setTileSize(const ossimIpt &pt)
updated the tile size.
virtual const ossimFilename & getFilename() const
Returns the filename.
std::string::size_type size() const
Definition: ossimString.h:405
TIFF * openTiff(const ossimString &filename) const
32 bit signed integer
static const char * COMPRESSION_TYPE_KW
virtual ossim_uint32 getImageTileHeight() const =0
Returns the tile width of the image or 0 if the image is not tiled.
virtual bool setOutputToInputBandList()
If the image handler "isBandSeletor()" then the band selection of the output are set to input or iden...
unsigned long long ossim_uint64
ossimRefPtr< ossimBitMaskWriter > m_maskWriter
unsigned int ossim_uint32
virtual bool setOverviewType(const ossimString &type)
Sets the overview output type.
#define PTR_CAST(T, p)
Definition: ossimRtti.h:321
bool getInternalOverviewsFlag() const
This is the image handler for providing mask pixels to an ossimMaskFilter object. ...
void setAssociatedMaskWriter(ossimBitMaskWriter *maskWriter)
This class can be used during overview generation, in which case there will be a simultaneous mask wr...
ossimFilterResampler::ossimFilterResamplerType m_resampleType
OSSIM_DLL ossim_uint32 scalarSizeInBytes(ossimScalarType scalarType)
ossimHistogramMode getHistogramMode() const
Gets the histogram accumulation mode.
virtual ossimRefPtr< ossimImageData > getNextTile()
Will allow you to get the next tile in the sequence.
struct tiff TIFF
virtual void setProperty(ossimRefPtr< ossimProperty > property)
Method to set properties.
static ossimString downcase(const ossimString &aString)
Definition: ossimString.cpp:48
Class for computing a mask from an input image source and writing the mask file to disk...
virtual ossimIrect getImageRectangle(ossim_uint32 resLevel=0) const
Returns zero-based bounding rectangle of the image.
void setCompressionType(ossim_uint16 compression_type)
Sets the compression type to use when building overviews.
virtual ossim_int32 connectMyInputTo(ossimConnectableObject *inputObject, bool makeOutputConnection=true, bool createEventFlag=true)
Will try to connect this objects input to the passed in object.
virtual ossim_uint32 getNumberOfEntries() const
ossim_uint32 width() const
Definition: ossimIrect.h:500
void toPoint(const std::string &s)
Initializes this point from string.
Definition: ossimIpt.cpp:170
Container class that holds both 2D transform and 3D projection information for an image Only one inst...
ossimRefPtr< ossimImageHandler > m_imageHandler
void closeTiff(TIFF *tif)
void setImageHandler(ossimImageHandler *input)
Sets the input source or connection.
virtual bool canConnectMyInputTo(ossim_int32 index, const ossimConnectableObject *obj) const
void generateMask(ossimRefPtr< ossimImageData > tile, ossim_uint32 rLevel)
Given a source&#39;s tile, derives the alpha mask and saves it in buffer for later writing to disk...
void setInternalOverviewsFlag(bool flag)
Sets internal overviews flag.
virtual void setOutputFile(const ossimFilename &file)
Sets the output filename.
virtual ossim_uint32 getImageTileWidth() const =0
Returns the tile width of the image or 0 if the image is not tiled.
64 bit normalized floating point
const ossimProjection * getProjection() const
Access methods for projection (may be NULL pointer).
16 bit unsigned integer (11 bits used)
virtual void finalize()
Finalize method.
bool setTags(TIFF *tif, const ossimIrect &outputRect, ossim_int32 resLevel) const
Set the tiff tags for the appropriate resLevel.
virtual bool isImageTiled() const
Indicates whether or not the image is tiled internally.
ossimRefPtr< ossimMaskFilter > m_maskFilter
void setStartingResLevel(ossim_uint32 level)
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_uint8 > m_nullDataBuffer
bool remove() const
void setCurrentMessage(const ossimString &message)
ossim_uint32 getStartingResLevel() const
virtual ossim_int32 connectMyInputTo(ossimConnectableObject *inputObject, bool makeOutputConnection=true, bool createEventFlag=true)
Will try to connect this objects input to the passed in object.
ossim_int32 y
Definition: ossimIpt.h:142
virtual const void * getBuf() const
void setScanForMinMax(bool flag)
Turn on/off scan for min max flag.
static const char * COMPRESSION_QUALITY_KW
virtual ossimObject * getObject()
void setSourceLevel(ossim_uint32 level)
Sets the input source resolution to decimate from.
virtual void slaveProcessTiles()
This implementation does nothing.
ossim_uint32 getSize() const
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
virtual void close()
Writes the mask file to path specified. Returns TRUE if successful.
bool hasNans() const
Definition: ossimIrect.h:337
bool setGeotiffTags(const ossimImageGeometry *geom, const ossimDrect &boundingRect, ossim_uint32 resLevel, TIFF *tif)
Writes geotiff tags.
virtual ossim_uint32 getNumberOfSamples(ossim_uint32 resLevel=0) const =0
Pure virtual, derived classes must implement.
void setHistogramMode(ossimHistogramMode mode)
Sets the histogram accumulation mode.
virtual ossimIrect getBoundingRect(ossim_uint32 resLevel=0) const
Returns zero-based bounding rectangle of the image.
ossim_int32 x
Definition: ossimIpt.h:141
virtual double getMaxPixelValue(ossim_uint32 band=0) const
Returns the max pixel of the band.
8 bit unsigned integer
#define RTTI_DEF1(cls, name, b1)
Definition: ossimRtti.h:485
bool writeOmdFile(const std::string &file)
Writes an ossim metadata(omd) file with min, max, null values.
bool buildOverview(const ossimFilename &overview_file, bool copy_all=false)
Builds overview file and sets "theOutputFile" to that of the overview_file.
virtual void disconnectAllInputs()
Will disconnect all of the input objects.
void setBitMaskObjects(ossimBitMaskWriter *mask_writer, ossimMaskFilter *mask_filter)
Enabled the generation of an alpha (bit) mask such that any full or partial null pixels will be maske...
virtual ossim_uint32 getNumberOfInputBands() const =0
static const char * OVERVIEW_STOP_DIMENSION_KW
void setResampleType(ossimFilterResampler::ossimFilterResamplerType resampleType)
Supports BOX or NEAREST NEIGHBOR.
ossimFilename & setExtension(const ossimString &e)
Sets the extension of a file name.
static bool writeTags(TIFF *tiffOut, const ossimRefPtr< ossimMapProjectionInfo > projectionInfo, bool imagineNad27Flag=false)
virtual void getPropertyNames(std::vector< ossimString > &propertyNames) const
Method to populate the list of property names.
void setStartingResLevel(ossim_uint32 res_level)
Sets the starting resolution level for the mask.
virtual ossimFilename getOutputFile() const
Gets the output file name.
static ossimMpi * instance()
Definition: ossimMpi.cpp:27
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
void setResampleType(ossimFilterResampler::ossimFilterResamplerType resampleType)
Sets the resampling type.
virtual void initialize()
This must be called.
bool rename(const ossimFilename &destFile, bool overwriteDestinationFlag=true) const
const ossimString & getName() const
int ossim_int32
virtual ossimRefPtr< ossimImageData > getTile(const ossimIpt &origin, ossim_uint32 resLevel=0)
void setMaskSource(ossimImageSource *maskSource)
This set method is necessary when this object is being added to an ossimImageChain because ossimImage...
16 bit unsigned integer (12 bits used)
ossimTiffOverviewBuilder()
default constructor
virtual bool removeListener(ossimListener *listener)