OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimKakaduNitfOverviewBuilder.cpp
Go to the documentation of this file.
1 //----------------------------------------------------------------------------
2 //
3 // License: LGPL
4 //
5 // See LICENSE.txt file in the top level directory for more details.
6 //
7 // Author: David Burken
8 //
9 // Description: OSSIM wrapper for building nitf, j2k compressed overviews
10 // using kakadu from an ossim image source.
11 //
12 //----------------------------------------------------------------------------
13 // $Id: ossimKakaduNitfOverviewBuilder.cpp 22363 2013-08-07 20:28:54Z dburken $
14 
16 #include "ossimKakaduCommon.h"
17 #include "ossimKakaduCompressor.h"
18 #include "ossimKakaduKeywords.h"
19 
20 #include <ossim/base/ossimDate.h>
25 #include <ossim/base/ossimIpt.h>
26 #include <ossim/base/ossimNotify.h>
28 #include <ossim/base/ossimTrace.h>
29 
33 
37 
46 
47 #include <fstream>
48 #include <sstream>
49 
50 static const ossimString OVERVIEW_TYPE = "ossim_kakadu_nitf_j2k";
51 static const ossimString OVERVIEW_TYPE_ALIAS = "j2k";
52 
53 static const ossimIpt DEFAULT_TILE_SIZE(1024, 1024);
54 
56  "ossimKakaduNitfOverviewBuilder",
58 
59 static const ossimTrace traceDebug(
60  ossimString("ossimKakaduNitfOverviewBuilder:debug"));
61 
62 #ifdef OSSIM_ID_ENABLED
63 static const char OSSIM_ID[] = "$Id: ossimKakaduNitfOverviewBuilder.cpp 22363 2013-08-07 20:28:54Z dburken $";
64 #endif
65 
67  :
69  m_outputFile(ossimFilename::NIL),
70  m_outputFileTmp(ossimFilename::NIL),
71  m_compressor(new ossimKakaduCompressor())
72 {
73  if (traceDebug())
74  {
76  << "ossimKakaduNitfOverviewBuilder::ossimKakaduNitfOverviewBuilder"
77  << " DEBUG:\n";
78 #ifdef OSSIM_ID_ENABLED
80  << "OSSIM_ID: "
81  << OSSIM_ID
82  << "\n";
83 #endif
85  << "overview stop dimension: " << m_overviewStopDimension
86  << std::endl;
87  }
88 }
89 
91 {
92  m_imageHandler = 0;
93 
94  if (m_compressor)
95  {
96  delete m_compressor;
97  m_compressor = 0;
98  }
99 }
100 
102 {
103  m_outputFile = file;
104 }
105 
107 {
108  ossimFilename result = m_outputFile;
110  {
111  if ( m_imageHandler.valid() )
112  {
113  bool usePrefix = (m_imageHandler->getNumberOfEntries()>1?true:false);
114  result = m_imageHandler->
115  getFilenameWithThisExtension(ossimString("ovr"), usePrefix);
116  }
117  }
118  return result;
119 }
120 
122 {
123  bool result = false;
124 
125  //---
126  // Only have one type right now. These are the same:
127  // "ossim_kakadu_nitf_j2k" or "j2k"
128  //---
129  if ( (type == OVERVIEW_TYPE) || (type == OVERVIEW_TYPE_ALIAS) )
130  {
131  result = true;
132  }
133 
134  return result;
135 }
136 
138 {
139  return OVERVIEW_TYPE;
140 }
141 
143  std::vector<ossimString>& typeList)const
144 {
145  typeList.push_back(OVERVIEW_TYPE);
146  typeList.push_back(OVERVIEW_TYPE_ALIAS);
147 }
148 
150 {
151  static const char MODULE[] = "ossimKakaduNitfOverviewBuilder::execute";
152 
153  if (traceDebug())
154  {
155  ossimNotify(ossimNotifyLevel_DEBUG) << MODULE << " entered...\n";
156  }
157 
158  bool result = false;
159 
160  if ( m_imageHandler.valid() ) // Make sure there is a source.
161  {
162  // Get the output filename.
163  ossimFilename outputFile = getOutputFile();
164 
165  if (outputFile != m_imageHandler->getFilename())
166  {
167  //---
168  // Add .tmp in case process gets aborted to avoid leaving bad .ovr
169  // file.
170  //---
171  ossimFilename outputFileTemp = outputFile + ".tmp";
172 
173  // Required number of levels needed including r0.
174  ossim_uint32 requiedResLevels =
176 
177  // Zero based starting resLevel.
178  ossim_uint32 startingResLevel =
180 
181  if (traceDebug())
182  {
184  << MODULE
185  << "\nCurrent number of reduced res sets: "
187  << "\nNumber of required reduced res sets: "
188  << requiedResLevels
189  << "\nStarting reduced res set: " << startingResLevel
190  << "\nHistogram mode: " << getHistogramMode()
191  << std::endl;
192  }
193 
194  if ( startingResLevel < requiedResLevels )
195  {
196  //---
197  // If image handler is band selector, start with all bands.
198  // Some sources, e.g. ossimEnviTileSource can pick up default
199  // bands and filter out all other bands.
200  //---
202 
203  // If alpha bit mask generation was requested, then need to instantiate the mask writer
204  // object. This is simply a "transparent" tile source placed after to the right of the
205  // image handler that scans the pixels being pulled and accumulates alpha bit mask for
206  // writing at the end:
207  if (m_bitMaskSpec.getSize() > 0)
208  {
216  }
217 
218  //---
219  // Set up the sequencer. This will be one of three depending
220  // on if we're running mpi and if we are a master process or
221  // a slave process.
222  //---
224 
226  {
227  if ( ossimMpi::instance()->getRank() == 0 )
228  {
229  sequencer = new ossimMpiMasterOverviewSequencer();
230  }
231  else
232  {
233  sequencer = new ossimMpiSlaveOverviewSequencer();
234  }
235  }
236  else
237  {
238  sequencer = new ossimOverviewSequencer();
239  }
240 
241  if( ossimMpi::instance()->getNumberOfProcessors() == 1)
242  {
243  //---
244  // Pass the histogram mode to the sequencer.
245  // Can't do with mpi/multi-process.
246  //---
247  sequencer->setHistogramMode( getHistogramMode() );
248 
249  if ( getScanForMinMaxNull() == true )
250  {
251  sequencer->setScanForMinMaxNull(true);
252  }
253  else if ( getScanForMinMax() == true )
254  {
255  sequencer->setScanForMinMax(true);
256  }
257  }
258 
259  sequencer->setImageHandler( m_imageHandler.get() );
260 
261  ossim_uint32 sourceResLevel = 0;
262  if ( startingResLevel > 1)
263  {
264  sourceResLevel = startingResLevel - 1;
265  }
266 
267  if (traceDebug())
268  {
270  << MODULE
271  << "\nSource starting reduced res set: " << sourceResLevel
272  << std::endl;
273  }
274 
275  sequencer->setSourceLevel(sourceResLevel);
276 
277  // Tmp hard coded to BOX:
278  sequencer->setResampleType(
280 
281  sequencer->setTileSize( DEFAULT_TILE_SIZE );
282 
283  sequencer->initialize();
284 
285  //---
286  // If we are a slave process start the resampling of tiles.
287  //---
288  if (ossimMpi::instance()->getRank() != 0 )
289  {
290  sequencer->slaveProcessTiles();
291  return true; // End of slave process.
292  }
293 
294  ossim_uint32 outputTilesWide =
295  sequencer->getNumberOfTilesHorizontal();
296  ossim_uint32 outputTilesHigh =
297  sequencer->getNumberOfTilesVertical();
298  ossim_uint32 numberOfTiles =
299  sequencer->getNumberOfTiles();
301  ossimIrect imageRect;
302  sequencer->getOutputImageRectangle(imageRect);
303 
304  //---
305  // From here on out master process only.
306  //---
307  ossimNitfFileHeaderV2_1* fHdr = 0;
308  ossimNitfImageHeaderV2_1* iHdr = 0;
309  ossimStdOutProgress* progressListener = 0;
310  std::ofstream* os = 0;
311  std::streampos endOfFileHdrPos;
312  std::streampos endOfImgHdrPos;
313  std::streampos endOfFilePos;
314  ossimNitfImageInfoRecordV2_1 imageInfoRecord;
315 
316  // Open the output file.
317  os = new std::ofstream;
318  os->open(outputFileTemp.chars(), std::ios_base::out|std::ios_base::binary);
319  if ( os->good() )
320  {
321  result = true; // Assuming we are good from this point.
322 
323  // Get an info dump to a keyword list.
324  ossimKeywordlist kwl;
325  std::shared_ptr<ossimInfoBase> info =
327  create(m_imageHandler->getFilename());
328  if ( info )
329  {
330  info->getKeywordlist(kwl);
331  info.reset();
332  }
333 
334  fHdr = new ossimNitfFileHeaderV2_1();
335 
336  fHdr->addImageInfoRecord(imageInfoRecord);
337 
338  fHdr->setDate(ossimDate());
339  fHdr->setTitle(ossimString("ossim_nitf_j2k_overview"));
340 
341  const char* lookup = kwl.find("nitf.FSCLAS");
342  if (lookup)
343  {
345  }
346  fHdr->writeStream(*os);
347  endOfFileHdrPos = os->tellp();
348 
349  iHdr = new ossimNitfImageHeaderV2_1();
350 
351  // Set the compression type:
352  iHdr->setCompression(ossimString("C8"));
353 
354  // Set the Image Magnification (IMAG) field.
355  setImagField(iHdr, startingResLevel);
356 
358 
359  // Set the pixel type (PVTYPE field).
360  iHdr->setPixelType(
362 
363  // Set the actual bits per pixel (ABPP field).
364  iHdr->setActualBitsPerPixel(
365  ossim::getActualBitsPerPixel(scalarType));
366  iHdr->setBitsPerPixel(ossim::getBitsPerPixel(scalarType));
367 
368  const ossim_uint64 BANDS =
370 
371  iHdr->setNumberOfBands(BANDS);
372  iHdr->setImageMode('B');// blocked
373 
374  if((BANDS == 3)&&
375  (scalarType == OSSIM_UCHAR))
376  {
377  iHdr->setRepresentation("RGB");
378  iHdr->setCategory("VIS");
379  }
380  else if(BANDS == 1)
381  {
382  iHdr->setRepresentation("MONO");
383  iHdr->setCategory("MS");
384  }
385  else
386  {
387  iHdr->setRepresentation("MULTI");
388  iHdr->setCategory("MS");
389  }
390 
391  iHdr->setBlocksPerRow(outputTilesWide);
392  iHdr->setBlocksPerCol(outputTilesHigh);
393  iHdr->setNumberOfPixelsPerBlockRow(DEFAULT_TILE_SIZE.y);
394  iHdr->setNumberOfPixelsPerBlockCol(DEFAULT_TILE_SIZE.x);
395  iHdr->setNumberOfRows(imageRect.height());
396  iHdr->setNumberOfCols(imageRect.width());
397 
398  ossimNitfImageBandV2_1 bandInfo;
399  for(ossim_uint32 band = 0; band < BANDS; ++band)
400  {
401  std::ostringstream out;
402 
403  out << std::setfill('0')
404  << std::setw(2)
405  << band;
406 
407  bandInfo.setBandRepresentation(out.str().c_str());
408  iHdr->setBandInfo(band, bandInfo);
409  }
410 
411  iHdr->writeStream(*os);
412  endOfImgHdrPos = os->tellp();
413 
414  //---
415  // Check for a listeners. If the list is empty, add a
416  // standard out listener so that command line apps like
417  // img2rr will get some progress.
418  //---
419  ossimStdOutProgress* progressListener = 0;
420  if (theListenerList.empty())
421  {
422  progressListener = new ossimStdOutProgress(0, true);
423  addListener(progressListener);
424  }
427  setPercentComplete(0.0);
428 
429  if (traceDebug())
430  {
432  << MODULE << " DEBUG:"
433  << "\noutputTilesWide: " << outputTilesWide
434  << "\noutputTilesHigh: " << outputTilesHigh
435  << "\nnumberOfTiles: " << numberOfTiles
436  << "\nimageRect: " << imageRect
437  << std::endl;
438  }
439 
441  {
442  //---
443  // Someone can set this through the generic setProperty
444  // interface. Unset, currently only supported in jp2 writer.
445  // Could be used here but I think we would have to update the
446  // nitf tags.
447  //---
449  }
450 
451  if ( ossim::getActualBitsPerPixel(scalarType) > 31 )
452  {
454  }
455 
456  try
457  {
458  // Make a compressor
459  m_compressor->create(os,
460  scalarType,
461  BANDS,
462  imageRect,
463  DEFAULT_TILE_SIZE,
464  numberOfTiles,
465  false);
466 
468  << "Generating " << (m_compressor->getLevels()+1)
469  << " levels..." << endl;
470  }
471  catch (const ossimException& e)
472  {
473  setErrorStatus();
474  ossimNotify(ossimNotifyLevel_WARN) << e.what() << std::endl;
475  result = false;
476  }
477 
478  if ( result )
479  {
480  // Tile loop in the line direction.
481  for(ossim_uint32 y = 0; y < outputTilesHigh; ++y)
482  {
483  // Tile loop in the sample (width) direction.
484  for(ossim_uint32 x = 0; x < outputTilesWide; ++x)
485  {
486  // Grab the resampled tile.
487  ossimRefPtr<ossimImageData> t = sequencer->getNextTile();
488 
489  // Check for errors reading tile:
490  if ( sequencer->hasError() )
491  {
492  setErrorStatus();
494  << MODULE << " ERROR: reading tile: "
495  << tileNumber << std::endl;
496  result = false;
497  }
498 
499  if ( result && t.valid() )
500  {
501  //---
502  // If masking was enabled, pass the tile onto that object for
503  // processing:
504  //---
505  if ( m_maskWriter.valid())
506  {
507  m_maskWriter->generateMask(t, 0);
508  }
509 
510  if ( t->getDataObjectStatus() != OSSIM_NULL )
511  {
512  if ( ! m_compressor->writeTile( *(t.get()) ) )
513  {
514  setErrorStatus();
516  << MODULE << " ERROR:\nWriting tile: "
517  << tileNumber << std::endl;
518  result = false;
519  }
520  }
521  else
522  {
523  setErrorStatus();
525  << MODULE << " ERROR:\nNull tile returned: " << tileNumber
526  << std::endl;
527  result = false;
528  }
529  }
530 
531  if ( !result )
532  {
533  // Bust out of sample loop.
534  break;
535  }
536 
537  // Increment tile number for percent complete.
538  ++tileNumber;
539 
540  } // End of tile loop in the sample (width) direction.
541 
542  if ( !result )
543  {
544  // Bust out of line loop.
545  break;
546  }
547 
548  if ( needsAborting() )
549  {
550  setPercentComplete(100.0);
551  break;
552  }
553  else
554  {
555  double tile = tileNumber;
556  double numTiles = numberOfTiles;
557  setPercentComplete(tile / numTiles * 100.0);
558  }
559 
560  } // End of tile loop in the line (height) direction.
561 
562  if ( result )
563  {
564  m_compressor->finish();
565 
566  // Get the file length.
567  endOfFilePos = os->tellp();
568 
569  //---
570  // Seek back to set some things that were not know until now and
571  // rewrite the nitf file and image header.
572  //---
573  os->seekp(0, std::ios_base::beg);
574 
575  // Set the file length.
576  std::streamoff length = endOfFilePos;
577  fHdr->setFileLength(static_cast<ossim_uint64>(length));
578 
579  // Set the file header length.
580  length = endOfFileHdrPos;
581  fHdr->setHeaderLength(static_cast<ossim_uint64>(length));
582  // Set the image sub header length.
583  length = endOfImgHdrPos - endOfFileHdrPos;
584 
585  imageInfoRecord.setSubheaderLength(
586  static_cast<ossim_uint64>(length));
587 
588  // Set the image length.
589  length = endOfFilePos - endOfImgHdrPos;
590  imageInfoRecord.setImageLength(
591  static_cast<ossim_uint64>(length));
592 
593  fHdr->replaceImageInfoRecord(0, imageInfoRecord);
594 
595  // Rewrite the header.
596  fHdr->writeStream(*os);
597 
598  // Set the compression rate now that the image size is known.
600  imageRect,
601  BANDS,
602  scalarType,
603  static_cast<ossim_uint64>(length));
604  iHdr->setCompressionRateCode(comrat);
605 
606  // Rewrite the image header.
607  iHdr->writeStream(*os);
608 
609  if (progressListener)
610  {
611  removeListener(progressListener);
612  delete progressListener;
613  progressListener = 0;
614  }
615 
616  if ( ossimMpi::instance()->getNumberOfProcessors() == 1 )
617  {
619  {
620  // Write the histogram.
621  ossimFilename histoFilename = getOutputFile();
622  histoFilename.setExtension("his");
623  sequencer->writeHistogram(histoFilename);
624  }
625 
626  if ( ( getScanForMinMaxNull() == true ) || ( getScanForMinMax() == true ) )
627  {
628  // Write the omd file:
630  file = file.setExtension("omd");
631  sequencer->writeOmdFile(file);
632  }
633  }
634 
635  // If masking was enabled, then only R0 was processed, need to process
636  // remaining levels:
637  if (m_maskWriter.valid())
638  {
639  ossim_uint32 num_rlevels = m_compressor->getLevels() + 1;
640  m_maskWriter->buildOverviews(num_rlevels);
644  << MODULE << "Writing alpha bit mask file..." << std::endl;
645  m_maskWriter->close();
646  }
647 
648  } // if ( result ) *** after end of tile loop ***
649 
650  } // End: if ( result ) from m_compressor->create
651 
652  } // End: if (os->good())
653 
654  if (fHdr)
655  {
656  delete fHdr;
657  fHdr = 0;
658  }
659 
660  if (iHdr)
661  {
662  delete iHdr;
663  iHdr = 0;
664  }
665 
666  if (progressListener)
667  {
668  delete progressListener;
669  progressListener = 0;
670  }
671 
672  if (os->is_open())
673  {
674  os->close();
675  if ( result )
676  {
677  outputFileTemp.rename(outputFile);
678  }
679  else
680  {
681  ossimFilename::remove( outputFileTemp );
682  }
683  }
684  delete os;
685  os = 0;
686 
687  }
688  else
689  {
690  ossimNotify(ossimNotifyLevel_INFO)<< MODULE << " NOTICE:"
691  <<" Image has required reduced resolution data sets.\n"<< std::endl;
692  }
693  }
694  else
695  {
697  << "Source image file and overview file cannot be the same!"
698  << std::endl;
699  }
700 
701  } // matches: if (m_imageHandler)
702 
703  if (traceDebug())
704  {
706  << MODULE << " exit status = " << (result?"true":"false\n")
707  << std::endl;
708  }
709 
710  finalize(); // Reset band list if a band selector.
711 
712  return result;
713 
714 } // End: ossimKakaduNitfOverviewBuilder::execute()
715 
718 {
719  if ( property.valid() )
720  {
721  m_compressor->setProperty(property);
722  }
723 }
724 
726  std::vector<ossimString>& propertyNames)const
727 {
728  m_compressor->getPropertyNames(propertyNames);
729 }
730 
732 {
733  out << "ossimKakaduNitfOverviewBuilder::print"
734  << std::endl;
735  return out;
736 }
737 
739 {
740  return this;
741 }
742 
744 {
745  return this;
746 }
747 
749  ossim_int32 index,
750  const ossimConnectableObject* obj) const
751 {
752  if ( (index == 0) &&
754  {
755  return true;
756  }
757 
758  return false;
759 }
760 
762  ossimNitfImageHeaderV2_1* hdr, ossim_uint32 startingResLevel) const
763 {
764  //---
765  // This assumes res level 0 is 1.0 magnification.
766  //---
767  if (hdr)
768  {
769  ossimString imagString;
770 
771  if (startingResLevel == 0)
772  {
773  imagString = "1.0 ";
774  }
775  else
776  {
777  //---
778  // Assumes power of 2 decimation.
779  //---
780  ossim_uint32 decimation = 1<<startingResLevel;
781 
782  //---
783  // Using slash '/' format. "/2" = 1/2, /
784  imagString = "/";
785  imagString += ossimString::toString(decimation);
786  if (imagString.size() <= 4)
787  {
788  if (imagString.size() == 2)
789  {
790  imagString += " "; // two spaces
791  }
792  else if (imagString.size() == 3)
793  {
794  imagString += " "; // one space
795  }
796  }
797  }
798  if (imagString.size())
799  {
800  hdr->setImageMagnification(imagString);
801  }
802  }
803 }
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)
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.
virtual void create(ossim::ostream *os, ossimScalarType scalar, ossim_uint32 bands, const ossimIrect &imageRect, const ossimIpt &tileSize, ossim_uint32 tilesToWrite, bool jp2)
Create method.
ossim_uint32 getNumberOfTilesHorizontal() const
virtual bool execute()
Builds the overviews.
void setPixelType(const ossimString &pixelType=ossimString("INT"))
virtual void setFileLength(ossim_uint64 fileLength)
Sets file length (FL) field.
std::basic_ostringstream< char > ostringstream
Class for char output memory streams.
Definition: ossimIosFwd.h:35
RTTI_DEF1(ossimKakaduNitfOverviewBuilder, "ossimKakaduNitfOverviewBuilder", ossimOverviewBuilderBase)
void setNumberOfPixelsPerBlockRow(ossim_uint32 pixels)
static const ossimFilename NIL
This was taken from Wx widgets for performing touch and access date stamps.
Definition: ossimFilename.h:40
bool buildOverviews(ossim_uint32 total_num_rlevels)
For imagery that already has overviews built, but with artifact edge pixels (such as JP2- compressed ...
void setActualBitsPerPixel(ossim_uint32 bitsPerPixel)
virtual void setNumberOfBands(ossim_uint32 nbands)
ossim_uint32 tileNumber
Represents serializable keyword/value map.
void setDate(const ossimLocalTm &d)
Sets field FDT.
virtual ossim_uint32 getNumberOfOutputBands() const
Returns the number of bands in a tile returned from this TileSource.
ossim_uint32 y
bool valid() const
Definition: ossimRefPtr.h:75
virtual void getPropertyNames(std::vector< ossimString > &propertyNames) const
Method to populate the list of property names.
virtual void setOutputFile(const ossimFilename &file)
Sets the output filename.
const char * find(const char *key) const
virtual void finish()
Finish method.
std::list< ossimListener * > theListenerList
virtual void writeStream(std::ostream &out)
void setSubheaderLength(ossim_uint32 length)
ossim_uint32 height() const
Definition: ossimIrect.h:487
static ossimString getNitfPixelType(ossimScalarType scalarType)
Get the nitf pixel type string from scalar type.
static ossimString toString(bool aValue)
Numeric to string methods.
virtual void getOutputImageRectangle(ossimIrect &rect) const
Gets the zero-based image rectangle for the output reduced resolution data set (rrds).
virtual void setPercentComplete(double percentComplete)
virtual void setHeaderLength(ossim_uint64 headerLength)
Sets header length (HL) field.
virtual std::ostream & print(std::ostream &out) const
print method.
virtual void replaceImageInfoRecord(int i, const ossimNitfImageInfoRecordV2_1 &recordInfo)
virtual ossimDataObjectStatus getDataObjectStatus() const
ossim_uint32 getNumberOfTilesVertical() const
ossim_uint32 getNumberOfTiles() const
OSSIM_DLL ossim_uint32 getActualBitsPerPixel(ossimScalarType scalarType)
Get actual bits per pixel for a given scalar type.
virtual bool setOverviewType(const ossimString &type)
Sets the overview output type.
virtual bool loadState(const ossimKeywordlist &spec, const char *prefix=0)
Computes and writes the mask file according to the specification in the KWL.
virtual void setProcessStatus(ossimProcessStatus processStatus)
void setImagField(ossimNitfImageHeaderV2_1 *hdr, ossim_uint32 startingResLevel) const
Set the Image Magnification (IMAG) field in the form of "/2 ".
void getPropertyNames(std::vector< ossimString > &propertyNames) const
Pushes this&#39;s names onto the list of property names.
static ossimString getCompressionRate(const ossimIrect &rect, ossim_uint32 bands, ossimScalarType scalar, ossim_uint64 lengthInBytes)
Get compression rate (COMRAT) which is bits perpixel per band.
void setTitle(const ossimString &title)
virtual ossim_uint32 getNumberOfDecimationLevels() const
This returns the total number of decimation levels.
void setBitsPerPixel(ossim_uint32 bitsPerPixel)
void setBlocksPerRow(ossim_uint32 blocks)
virtual bool canConnectMyInputTo(ossim_int32 index, const ossimConnectableObject *obj) const
virtual ossimString getOverviewType() const
Gets the overview type.
void writeHistogram()
Write histogram method.
void setTileSize(const ossimIpt &pt)
updated the tile size.
virtual const ossimFilename & getFilename() const
Returns the filename.
virtual const char * what() const
Returns the error message.
void setCategory(const ossimString &category)
std::string::size_type size() const
Definition: ossimString.h:405
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
void setImageLength(ossim_uint64 length)
ossimRefPtr< ossimBitMaskWriter > m_maskWriter
unsigned int ossim_uint32
const char * chars() const
For backward compatibility.
Definition: ossimString.h:77
#define PTR_CAST(T, p)
Definition: ossimRtti.h:321
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...
void setCompressionRateCode(const ossimString &value)
ossimHistogramMode getHistogramMode() const
Gets the histogram accumulation mode.
virtual ossimRefPtr< ossimImageData > getNextTile()
Will allow you to get the next tile in the sequence.
bool getAlphaChannelFlag() const
Retrieve the writer&#39;s setting for whether or not to add an alpha channel to the output png image...
Class for computing a mask from an input image source and writing the mask file to disk...
virtual ossim_int32 connectMyInputTo(ossimConnectableObject *inputObject, bool makeOutputConnection=true, bool createEventFlag=true)
Will try to connect this objects input to the passed in object.
void setNumberOfPixelsPerBlockCol(ossim_uint32 pixels)
virtual void setAlphaChannelFlag(bool flag)
Set the writer to add an alpha channel to the output.
virtual ossim_uint32 getNumberOfEntries() const
ossim_uint32 width() const
Definition: ossimIrect.h:500
virtual void setQualityType(ossimKakaduCompressionQuality type)
Sets the quality type.
virtual void setNumberOfRows(ossim_uint32 rows)
virtual void setProperty(ossimRefPtr< ossimProperty > property)
Method to set properties.
ossimScalarType
ossimKakaduNitfOverviewBuilder Class to build overviews from the Kakadu library.
ossimRefPtr< ossimImageHandler > m_imageHandler
OSSIM_DLL ossim_uint32 getBitsPerPixel(ossimScalarType scalarType)
Get bits per pixel for a given scalar type.
int getNumberOfProcessors() const
Definition: ossimMpi.cpp:154
virtual void addImageInfoRecord(const ossimNitfImageInfoRecordV2_1 &recordInfo)
virtual bool setProperty(ossimRefPtr< ossimProperty > property)
Will set the property whose name matches the argument "property->getName()".
void setImageHandler(ossimImageHandler *input)
Sets the input source or connection.
virtual bool writeTile(ossimImageData &srcTile)
Write tile method.
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...
virtual void setNumberOfCols(ossim_uint32 cols)
virtual void finalize()
Finalize method.
void setBlocksPerCol(ossim_uint32 blocks)
ossimRefPtr< ossimMaskFilter > m_maskFilter
void setRepresentation(const ossimString &rep)
int getRank() const
Definition: ossimMpi.cpp:140
virtual ossimFilename getOutputFile() const
Returns the output.
virtual ossimScalarType getOutputScalarType() const
This will be used to query the output pixel type of the tile source.
virtual ~ossimKakaduNitfOverviewBuilder()
virtual destructor
static ossimInfoFactoryRegistry * instance()
instance method
This class defines an abstract Handler which all image handlers(loaders) should derive from...
bool remove() const
ossim_int32 y
Definition: ossimIpt.h:142
void setScanForMinMax(bool flag)
Turn on/off scan for min max flag.
virtual void setSecurityClassificationSys(const ossimString &value)
void setSourceLevel(ossim_uint32 level)
Sets the input source resolution to decimate from.
virtual void slaveProcessTiles()
This implementation does nothing.
virtual void writeStream(ossim::ostream &out)
ossim_uint32 getSize() const
virtual void close()
Writes the mask file to path specified. Returns TRUE if successful.
void setHistogramMode(ossimHistogramMode mode)
Sets the histogram accumulation mode.
ossim_int32 x
Definition: ossimIpt.h:141
std::basic_ofstream< char > ofstream
Class for char output file streams.
Definition: ossimIosFwd.h:47
bool writeOmdFile(const std::string &file)
Writes an ossim metadata(omd) file with min, max, null values.
virtual void setBandRepresentation(const ossimString &rep)
Sets the band representation.
void setCompression(const ossimString &value)
virtual void disconnectAllInputs()
Will disconnect all of the input objects.
ossimFilename & setExtension(const ossimString &e)
Sets the extension of a file name.
virtual void getTypeNameList(std::vector< ossimString > &typeList) const
Method to populate class supported types.
void setStartingResLevel(ossim_uint32 res_level)
Sets the starting resolution level for the mask.
static ossimMpi * instance()
Definition: ossimMpi.cpp:27
virtual void setImageMagnification(const ossimString &value)
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
void setResampleType(ossimFilterResampler::ossimFilterResamplerType resampleType)
Sets the resampling type.
virtual void initialize()
This must be called.
std::basic_ostream< char > ostream
Base class for char output streams.
Definition: ossimIosFwd.h:23
bool rename(const ossimFilename &destFile, bool overwriteDestinationFlag=true) const
8 bit unsigned iteger
int ossim_int32
void setMaskSource(ossimImageSource *maskSource)
This set method is necessary when this object is being added to an ossimImageChain because ossimImage...
virtual void setBandInfo(ossim_uint32 idx, const ossimNitfImageBandV2_1 &info)
virtual bool removeListener(ossimListener *listener)