50 static const ossimString OVERVIEW_TYPE =
"ossim_kakadu_nitf_j2k";
51 static const ossimString OVERVIEW_TYPE_ALIAS =
"j2k";
53 static const ossimIpt DEFAULT_TILE_SIZE(1024, 1024);
56 "ossimKakaduNitfOverviewBuilder",
60 ossimString(
"ossimKakaduNitfOverviewBuilder:debug"));
62 #ifdef OSSIM_ID_ENABLED 63 static const char OSSIM_ID[] =
"$Id: ossimKakaduNitfOverviewBuilder.cpp 22363 2013-08-07 20:28:54Z dburken $";
76 <<
"ossimKakaduNitfOverviewBuilder::ossimKakaduNitfOverviewBuilder" 78 #ifdef OSSIM_ID_ENABLED 115 getFilenameWithThisExtension(
ossimString(
"ovr"), usePrefix);
129 if ( (type == OVERVIEW_TYPE) || (type == OVERVIEW_TYPE_ALIAS) )
139 return OVERVIEW_TYPE;
143 std::vector<ossimString>& typeList)
const 145 typeList.push_back(OVERVIEW_TYPE);
146 typeList.push_back(OVERVIEW_TYPE_ALIAS);
151 static const char MODULE[] =
"ossimKakaduNitfOverviewBuilder::execute";
185 <<
"\nCurrent number of reduced res sets: " 187 <<
"\nNumber of required reduced res sets: " 189 <<
"\nStarting reduced res set: " << startingResLevel
194 if ( startingResLevel < requiedResLevels )
262 if ( startingResLevel > 1)
264 sourceResLevel = startingResLevel - 1;
271 <<
"\nSource starting reduced res set: " << sourceResLevel
311 std::streampos endOfFileHdrPos;
312 std::streampos endOfImgHdrPos;
313 std::streampos endOfFilePos;
318 os->open(outputFileTemp.
chars(), std::ios_base::out|std::ios_base::binary);
325 std::shared_ptr<ossimInfoBase> info =
330 info->getKeywordlist(kwl);
341 const char* lookup = kwl.
find(
"nitf.FSCLAS");
347 endOfFileHdrPos = os->tellp();
403 out << std::setfill(
'0')
412 endOfImgHdrPos = os->tellp();
432 << MODULE <<
" DEBUG:" 433 <<
"\noutputTilesWide: " << outputTilesWide
434 <<
"\noutputTilesHigh: " << outputTilesHigh
435 <<
"\nnumberOfTiles: " << numberOfTiles
436 <<
"\nimageRect: " << imageRect
469 <<
" levels..." << endl;
494 << MODULE <<
" ERROR: reading tile: " 499 if ( result && t.
valid() )
516 << MODULE <<
" ERROR:\nWriting tile: " 525 << MODULE <<
" ERROR:\nNull tile returned: " <<
tileNumber 556 double numTiles = numberOfTiles;
567 endOfFilePos = os->tellp();
573 os->seekp(0, std::ios_base::beg);
576 std::streamoff length = endOfFilePos;
580 length = endOfFileHdrPos;
583 length = endOfImgHdrPos - endOfFileHdrPos;
586 static_cast<ossim_uint64>(length));
589 length = endOfFilePos - endOfImgHdrPos;
591 static_cast<ossim_uint64>(length));
603 static_cast<ossim_uint64>(length));
609 if (progressListener)
612 delete progressListener;
613 progressListener = 0;
644 << MODULE <<
"Writing alpha bit mask file..." << std::endl;
666 if (progressListener)
668 delete progressListener;
669 progressListener = 0;
677 outputFileTemp.
rename(outputFile);
691 <<
" Image has required reduced resolution data sets.\n"<< std::endl;
697 <<
"Source image file and overview file cannot be the same!" 706 << MODULE <<
" exit status = " << (result?
"true":
"false\n")
719 if ( property.
valid() )
726 std::vector<ossimString>& propertyNames)
const 733 out <<
"ossimKakaduNitfOverviewBuilder::print" 771 if (startingResLevel == 0)
786 if (imagString.
size() <= 4)
788 if (imagString.
size() == 2)
792 else if (imagString.
size() == 3)
798 if (imagString.
size())
virtual ossimObject * getObject()
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.
std::basic_ostringstream< char > ostringstream
Class for char output memory streams.
RTTI_DEF1(ossimKakaduNitfOverviewBuilder, "ossimKakaduNitfOverviewBuilder", ossimOverviewBuilderBase)
static const ossimFilename NIL
This was taken from Wx widgets for performing touch and access date stamps.
bool buildOverviews(ossim_uint32 total_num_rlevels)
For imagery that already has overviews built, but with artifact edge pixels (such as JP2- compressed ...
ossimKakaduNitfOverviewBuilder()
default constructor
bool needsAborting() const
bool getScanForMinMaxNull() const
ossim_int32 getLevels() const
Represents serializable keyword/value map.
virtual ossim_uint32 getNumberOfOutputBands() const
Returns the number of bands in a tile returned from this TileSource.
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
void setSubheaderLength(ossim_uint32 length)
ossim_uint32 height() const
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 std::ostream & print(std::ostream &out) const
print method.
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'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.
virtual ossim_uint32 getNumberOfDecimationLevels() const
This returns the total number of decimation levels.
virtual bool canConnectMyInputTo(ossim_int32 index, const ossimConnectableObject *obj) const
virtual ossimString getOverviewType() const
Gets the overview type.
void writeHistogram()
Write histogram method.
ossimKeywordlist m_bitMaskSpec
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.
std::string::size_type size() const
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.
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...
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'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.
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
virtual void setQualityType(ossimKakaduCompressionQuality type)
Sets the quality type.
virtual void setProperty(ossimRefPtr< ossimProperty > property)
Method to set properties.
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
virtual bool setProperty(ossimRefPtr< ossimProperty > property)
Will set the property whose name matches the argument "property->getName()".
ossimFilename m_outputFile
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's tile, derives the alpha mask and saves it in buffer for later writing to disk...
virtual void finalize()
Finalize method.
ossimRefPtr< ossimMaskFilter > m_maskFilter
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...
virtual void setErrorStatus() const
void setScanForMinMax(bool flag)
Turn on/off scan for min max flag.
void setSourceLevel(ossim_uint32 level)
Sets the input source resolution to decimate from.
ossimKakaduCompressor * m_compressor
virtual void slaveProcessTiles()
This implementation does nothing.
ossim_uint32 getSize() const
bool getScanForMinMax() const
virtual void close()
Writes the mask file to path specified. Returns TRUE if successful.
void setHistogramMode(ossimHistogramMode mode)
Sets the histogram accumulation mode.
std::basic_ofstream< char > ofstream
Class for char output file streams.
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.
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()
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.
bool rename(const ossimFilename &destFile, bool overwriteDestinationFlag=true) const
ossim_uint32 m_overviewStopDimension
void setMaskSource(ossimImageSource *maskSource)
This set method is necessary when this object is being added to an ossimImageChain because ossimImage...
virtual bool removeListener(ossimListener *listener)