OSSIM - Open Source Software Image Map
Version 1.9.0 (20180803)
|
#include <ossimKakaduCompressor.h>
Public Member Functions | |
ossimKakaduCompressor () | |
default constructor More... | |
virtual | ~ossimKakaduCompressor () |
destructor More... | |
virtual void | create (ossim::ostream *os, ossimScalarType scalar, ossim_uint32 bands, const ossimIrect &imageRect, const ossimIpt &tileSize, ossim_uint32 tilesToWrite, bool jp2) |
Create method. More... | |
void | openJp2Codestream () |
Calls "open_codestream" on the m_jp2Target. More... | |
virtual bool | writeTile (ossimImageData &srcTile) |
Write tile method. More... | |
virtual void | finish () |
Finish method. More... | |
virtual void | setQualityType (ossimKakaduCompressionQuality type) |
Sets the quality type. More... | |
ossimKakaduCompressionQuality | getQualityType () const |
void | setReversibleFlag (bool reversible) |
Sets the m_reversible flag. More... | |
bool | getReversibleFlag () const |
virtual void | setAlphaChannelFlag (bool flag) |
Set the writer to add an alpha channel to the output. More... | |
bool | getAlphaChannelFlag () const |
Retrieve the writer's setting for whether or not to add an alpha channel to the output png image. More... | |
virtual void | setLevels (ossim_int32 levels) |
Sets the number of levels. More... | |
ossim_int32 | getLevels () const |
void | setThreads (ossim_int32 threads) |
Sets the number of threads. More... | |
ossim_int32 | getThreads () const |
void | setOptions (const std::vector< ossimString > &options) |
Sets the options array. More... | |
void | getOptions (std::vector< ossimString > &options) const |
Get the array of options. More... | |
bool | saveState (ossimKeywordlist &kwl, const char *prefix=0) const |
saves the state of the object. More... | |
bool | loadState (const ossimKeywordlist &kwl, const char *prefix=0) |
Method to the load (recreate) the state of an object from a keyword list. More... | |
virtual bool | setProperty (ossimRefPtr< ossimProperty > property) |
Will set the property whose name matches the argument "property->getName()". More... | |
ossimRefPtr< ossimProperty > | getProperty (const ossimString &name) const |
void | getPropertyNames (std::vector< ossimString > &propertyNames) const |
Pushes this's names onto the list of property names. More... | |
bool | writeGeotiffBox (const ossimImageGeometry *geom, const ossimIrect &rect, const ossimFilename &tmpFile, ossimPixelType pixelType) |
Writes the geotiff box to the jp2. More... | |
bool | writeGmlBox (const ossimImageGeometry *geom, const ossimIrect &rect) |
Writes the GML box to the jp2. More... | |
void | initialize (ossimNitfJ2klraTag *j2klraTag, ossim_uint32 actualBitsPerPixel) const |
Initializes the tag. More... | |
virtual ossimString | getLongName () const |
virtual ossimString | getClassName () const |
![]() | |
ossimObject () | |
virtual | ~ossimObject () |
virtual ossimObject * | dup () const |
virtual ossimString | getShortName () const |
virtual ossimString | getDescription () const |
virtual RTTItypeid | getType () const |
virtual bool | canCastTo (ossimObject *obj) const |
virtual bool | canCastTo (const RTTItypeid &id) const |
virtual bool | canCastTo (const ossimString &parentClassName) const |
virtual std::ostream & | print (std::ostream &out) const |
Generic print method. More... | |
virtual bool | isEqualTo (const ossimObject &obj, ossimCompareType compareType=OSSIM_COMPARE_FULL) const |
virtual void | accept (ossimVisitor &visitor) |
![]() | |
ossimReferenced () | |
ossimReferenced (const ossimReferenced &) | |
ossimReferenced & | operator= (const ossimReferenced &) |
void | ref () const |
increment the reference count by one, indicating that this object has another pointer which is referencing it. More... | |
void | unref () const |
decrement the reference count by one, indicating that a pointer to this object is referencing it. More... | |
void | unref_nodelete () const |
decrement the reference count by one, indicating that a pointer to this object is referencing it. More... | |
int | referenceCount () const |
![]() | |
ossimKakaduCompressorInterface () | |
GP: I had to add this or windows would not link with the latest compiler. More... | |
Private Member Functions | |
void | initializeCodingParams (kdu_core::kdu_params *cod, const ossimIrect &imageRect) |
int | getNumberOfLayers () const |
ossimString | getQualityTypeString () const |
void | setQualityTypeString (const ossimString &s) |
void | setLevels (kdu_core::kdu_params *cod, const ossimIrect &imageRect, ossim_int32 levels) |
Set levels. More... | |
void | setCodeBlockSize (kdu_core::kdu_params *cod, ossim_int32 xSize, ossim_int32 ySize) |
Set code block size. More... | |
void | setProgressionOrder (kdu_core::kdu_params *cod, ossim_int32 corder) |
Sets progression order. More... | |
void | setWaveletKernel (kdu_core::kdu_params *cod, ossim_int32 kernel) |
Sets the wavelet kernel to use. More... | |
void | setQualityLayers (kdu_core::kdu_params *cod, ossim_int32 layers) |
Sets the number of quality layers. More... | |
void | setTlmTileCount (ossim_uint32 tilesToWrite) |
void | printCompressionQualityTypes (std::ostream &out) const |
Private Attributes | |
ossimKakaduCompressedTarget * | m_target |
kdu_supp::jp2_family_tgt * | m_jp2FamTgt |
kdu_supp::jp2_target * | m_jp2Target |
kdu_core::kdu_codestream | m_codestream |
kdu_core::kdu_thread_env * | m_threadEnv |
kdu_core::kdu_thread_queue * | m_threadQueue |
int | m_layerSpecCount |
Num specs provided in 'flush' calls. More... | |
std::vector< kdu_core::kdu_long > | m_layerByteSizes |
Layer sizes provided in 'flush' calls. More... | |
ossimIrect | m_imageRect |
Layer slopes array provided in 'flush' calls. More... | |
bool | m_reversible |
Lossless or lossy. More... | |
bool | m_alpha |
If true write alpha channel. More... | |
ossim_int32 | m_levels |
Reduced resolution levels. More... | |
ossim_int32 | m_threads |
Number of threads. More... | |
std::vector< ossimString > | m_options |
Container for kakadu options to pass to kdu_params::parse_string. More... | |
ossimKakaduCompressionQuality | m_qualityType |
ossimRefPtr< ossimImageData > | m_normTile |
tile to use for normalized float data. More... | |
Additional Inherited Members | |
![]() | |
enum | ossimKakaduCompressionQuality { OKP_UNKNOWN = 0, OKP_USER_DEFINED = 1, OKP_NUMERICALLY_LOSSLESS = 2, OKP_VISUALLY_LOSSLESS = 3, OKP_LOSSY = 4, OKP_LOSSY2 = 5, OKP_LOSSY3 = 6, OKP_EPJE = 7 } |
![]() | |
virtual | ~ossimReferenced () |
Definition at line 41 of file ossimKakaduCompressor.h.
ossimKakaduCompressor::ossimKakaduCompressor | ( | ) |
default constructor
Definition at line 260 of file ossimKakaduCompressor.cpp.
|
virtual |
destructor
Definition at line 282 of file ossimKakaduCompressor.cpp.
References finish().
|
virtual |
Create method.
os | Stream to write to. |
scalar | Scalar type of source tiles to be fed to compressor. |
bands | Number of bands in source tiles to be fed to compressor. |
imageRect | The image rectangle. |
tileSize | The size of a tile. |
tilesTileWrite | The number of tiles to be written. If zero, the tlm marker segment will not be used. |
jp2 | If true jp2 header and jp2 geotiff block will be written out. |
Implements ossimKakaduCompressorInterface.
Definition at line 298 of file ossimKakaduCompressor.cpp.
|
virtual |
Finish method.
Every call to "create" should be matched by a "finish". Note the destructor calls finish.
Implements ossimKakaduCompressorInterface.
Definition at line 964 of file ossimKakaduCompressor.cpp.
References m_codestream, m_jp2FamTgt, m_jp2Target, m_layerByteSizes, m_normTile, m_target, m_threadEnv, m_threadQueue, ossimNotify(), and ossimNotifyLevel_WARN.
Referenced by ~ossimKakaduCompressor().
bool ossimKakaduCompressor::getAlphaChannelFlag | ( | ) | const |
Retrieve the writer's setting for whether or not to add an alpha channel to the output png image.
Definition at line 1083 of file ossimKakaduCompressor.cpp.
References m_alpha.
|
virtual |
Reimplemented from ossimObject.
Definition at line 292 of file ossimKakaduCompressor.cpp.
ossim_int32 ossimKakaduCompressor::getLevels | ( | ) | const |
Definition at line 1096 of file ossimKakaduCompressor.cpp.
References m_levels.
|
virtual |
Reimplemented from ossimObject.
Definition at line 287 of file ossimKakaduCompressor.cpp.
|
private |
Definition at line 1872 of file ossimKakaduCompressor.cpp.
References m_layerSpecCount.
void ossimKakaduCompressor::getOptions | ( | std::vector< ossimString > & | options | ) | const |
Get the array of options.
options | Array to initialize. |
ossimRefPtr< ossimProperty > ossimKakaduCompressor::getProperty | ( | const ossimString & | name | ) | const |
name | Name of property to return. |
Definition at line 1185 of file ossimKakaduCompressor.cpp.
References ossimKeywordNames::COMPRESSION_QUALITY_KW, and getQualityTypeString().
Referenced by ossimKakaduJp2Writer::getProperty(), and ossimKakaduNitfWriter::getProperty().
void ossimKakaduCompressor::getPropertyNames | ( | std::vector< ossimString > & | propertyNames | ) | const |
Pushes this's names onto the list of property names.
propertyNames | array to add this's property names to. |
Definition at line 1242 of file ossimKakaduCompressor.cpp.
References ossimKeywordNames::COMPRESSION_QUALITY_KW.
Referenced by ossimKakaduJp2Writer::getPropertyNames(), ossimKakaduNitfWriter::getPropertyNames(), and ossimKakaduNitfOverviewBuilder::getPropertyNames().
ossimKakaduCompressor::ossimKakaduCompressionQuality ossimKakaduCompressor::getQualityType | ( | ) | const |
Definition at line 1062 of file ossimKakaduCompressor.cpp.
References m_qualityType.
|
private |
Definition at line 1877 of file ossimKakaduCompressor.cpp.
Referenced by getProperty(), and saveState().
bool ossimKakaduCompressor::getReversibleFlag | ( | ) | const |
Definition at line 1073 of file ossimKakaduCompressor.cpp.
References m_reversible.
ossim_int32 ossimKakaduCompressor::getThreads | ( | ) | const |
Definition at line 1109 of file ossimKakaduCompressor.cpp.
References m_threads.
void ossimKakaduCompressor::initialize | ( | ossimNitfJ2klraTag * | j2klraTag, |
ossim_uint32 | actualBitsPerPixel | ||
) | const |
Initializes the tag.
j2klraTag | Pointer to tag. Initialized by this. |
actualBitsPerPixel | for scalar type. |
Definition at line 1506 of file ossimKakaduCompressor.cpp.
References ossimIrect::area(), m_imageRect, m_layerByteSizes, m_layerSpecCount, m_levels, ossimNitfJ2klraTag::setLayerBitRate(), ossimNitfJ2klraTag::setLayerId(), ossimNitfJ2klraTag::setLayersO(), ossimNitfJ2klraTag::setLevelsO(), and ossimNitfJ2klraTag::setOrigin().
|
private |
Definition at line 1541 of file ossimKakaduCompressor.cpp.
|
virtual |
Method to the load (recreate) the state of an object from a keyword list.
Return true if ok or false on error.
Reimplemented from ossimObject.
Definition at line 1294 of file ossimKakaduCompressor.cpp.
References ossimKeywordNames::COMPRESSION_QUALITY_KW, ossimKeywordlist::find(), and setQualityTypeString().
Referenced by ossimKakaduJp2Writer::loadState(), and ossimKakaduNitfWriter::loadState().
void ossimKakaduCompressor::openJp2Codestream | ( | ) |
Calls "open_codestream" on the m_jp2Target.
Note: Only valid if create method was called with jp2 = true.
Definition at line 560 of file ossimKakaduCompressor.cpp.
References m_jp2Target.
|
private |
Definition at line 2052 of file ossimKakaduCompressor.cpp.
|
virtual |
saves the state of the object.
Reimplemented from ossimObject.
Definition at line 1251 of file ossimKakaduCompressor.cpp.
References ossimKeywordlist::add(), ossimKeywordNames::COMPRESSION_QUALITY_KW, and getQualityTypeString().
Referenced by ossimKakaduJp2Writer::saveState(), and ossimKakaduNitfWriter::saveState().
|
virtual |
Set the writer to add an alpha channel to the output.
flag | true to create an alpha channel. |
Implements ossimKakaduCompressorInterface.
Definition at line 1078 of file ossimKakaduCompressor.cpp.
References m_alpha.
|
private |
Set code block size.
Nominal code-block dimensions (must be powers of 2 no less than 4 and no greater than 1024). Kakadu Default block dimensions are {64,64}
xSize | |
ySize |
Definition at line 1958 of file ossimKakaduCompressor.cpp.
|
virtual |
Sets the number of levels.
This must be positive and at least 1. Default = 5 ( r0 - r5 )
levels | Levels to set. |
Implements ossimKakaduCompressorInterface.
Definition at line 1088 of file ossimKakaduCompressor.cpp.
References m_levels.
Referenced by setLevels().
|
private |
Set levels.
Number of wavelet decomposition levels, or stages. May not exceed 32. Kakadu Default is 5
cod | Pointer to cod_params object. |
imageRect | The image rectangle. |
levels | Number of levels. |
Definition at line 1929 of file ossimKakaduCompressor.cpp.
References ossim::computeLevels(), and setLevels().
void ossimKakaduCompressor::setOptions | ( | const std::vector< ossimString > & | options | ) |
Sets the options array.
These get passed to the generic kdu_params::parse_string method. Note this adds options to the list. Does not zero out existing options.
options | Array of options to add. |
Definition at line 1114 of file ossimKakaduCompressor.cpp.
References m_options.
|
private |
Sets progression order.
Default progression order (may be overridden by Porder). The four character identifiers have the following interpretation: L=layer; R=resolution; C=component; P=position. The first character in the identifier refers to the index which progresses most slowly, while the last refers to the index which progresses most quickly. [Default is LRCP] Enumerations: (LRCP=0,RLCP=1,RPCL=2,PCRL=3,CPRL=4)
corder | The progression order which should be one of the above enumerations. |
Definition at line 1974 of file ossimKakaduCompressor.cpp.
|
virtual |
Will set the property whose name matches the argument "property->getName()".
property | Object containing property to set. |
Implements ossimKakaduCompressorInterface.
Definition at line 1124 of file ossimKakaduCompressor.cpp.
References ossimRefPtr< T >::valid().
Referenced by ossimKakaduJp2Writer::setProperty(), ossimKakaduNitfWriter::setProperty(), and ossimKakaduNitfOverviewBuilder::setProperty().
|
private |
Sets the number of quality layers.
Number of quality layers. May not exceed 16384. Kakadu default is 1.
layers. |
Definition at line 2024 of file ossimKakaduCompressor.cpp.
|
virtual |
Sets the quality type.
Type enumerations: OKP_UNKNOWN = 0, OKP_USER_DEFINED = 1, OKP_NUMERICALLY_LOSSLESS = 2, OKP_VISUALLY_LOSSLESS = 3, OKP_LOSSY = 4, OKP_EPJE = 5
type | See enumeration for types. |
Implements ossimKakaduCompressorInterface.
Definition at line 1041 of file ossimKakaduCompressor.cpp.
References m_qualityType, ossimKakaduCompressorInterface::OKP_EPJE, ossimKakaduCompressorInterface::OKP_LOSSY, ossimKakaduCompressorInterface::OKP_VISUALLY_LOSSLESS, and setReversibleFlag().
|
private |
Definition at line 1882 of file ossimKakaduCompressor.cpp.
References ossimString::downcase().
Referenced by loadState().
void ossimKakaduCompressor::setReversibleFlag | ( | bool | reversible | ) |
Sets the m_reversible flag.
If set to true the compression will be lossless; if not, lossy. Default is lossless.
reversible | Flag to set. |
Definition at line 1068 of file ossimKakaduCompressor.cpp.
References m_reversible.
Referenced by setQualityType().
void ossimKakaduCompressor::setThreads | ( | ossim_int32 | threads | ) |
Sets the number of threads.
This must be positive and at least 1. Default = 1 thread.
threads | The number of threads. |
Definition at line 1101 of file ossimKakaduCompressor.cpp.
References m_threads.
|
private |
Definition at line 2040 of file ossimKakaduCompressor.cpp.
References ossimString::c_str(), and m_codestream.
|
private |
Sets the wavelet kernel to use.
Wavelet kernels to use. The special value, ‘ATK’ means that an ATK (Arbitrary Transform Kernel) marker segment is used to store the DWT kernel. In this case, the ‘Catk’ attribute must be non-zero. [Default is W5X3 if ‘Creversible’ is true, W9X7 if ‘Creversible’ is false, and ATK if ‘Catk’ is non-zero.
Enumerations: (W9X7=0,W5X3=1,ATK=-1)
kernel | The kernel which should be one of the above enumerations. |
Definition at line 1996 of file ossimKakaduCompressor.cpp.
References m_reversible.
bool ossimKakaduCompressor::writeGeotiffBox | ( | const ossimImageGeometry * | geom, |
const ossimIrect & | rect, | ||
const ossimFilename & | tmpFile, | ||
ossimPixelType | pixelType | ||
) |
Writes the geotiff box to the jp2.
geom | Output image geometry. |
rect | Output rectangle (view rect). |
tmpFile | Temp tiff file to write out for reading back in. |
pixelType | OSSIM_PIXEL_IS_POINT(0) or OSSIM_PIXEL_IS_AREA(1) |
Definition at line 1351 of file ossimKakaduCompressor.cpp.
References ossimRefPtr< T >::get(), ossimImageGeometry::getProjection(), m_jp2Target, ossimRefPtr< T >::valid(), and ossimGeoTiff::writeJp2GeotiffBox().
Referenced by ossimKakaduJp2Writer::writeGeotiffBox().
bool ossimKakaduCompressor::writeGmlBox | ( | const ossimImageGeometry * | geom, |
const ossimIrect & | rect | ||
) |
Writes the GML box to the jp2.
geom | Output image geometry. |
rect | Output rectangle (view rect). |
Definition at line 1399 of file ossimKakaduCompressor.cpp.
References ossim::byteOrder(), ossimGmlSupportData::initialize(), m_jp2Target, OSSIM_LITTLE_ENDIAN, ossimEndian::swap(), and ossimGmlSupportData::write().
Referenced by ossimKakaduJp2Writer::writeGmlBox().
|
virtual |
Write tile method.
Writes tiles stream provided to create method. Note that tiles should be fed to compressor in left to right, top to bottom order.
srcTile | The source tile to write. |
Implements ossimKakaduCompressorInterface.
Definition at line 573 of file ossimKakaduCompressor.cpp.
References ossim::getActualBitsPerPixel(), ossimImageData::getAlphaBuf(), ossimImageData::getBuf(), ossimDataObject::getDataObjectStatus(), ossimImageData::getHeight(), ossimImageData::getNumberOfBands(), ossimImageData::getOrigin(), ossimRectilinearDataObject::getScalarType(), ossimImageData::getWidth(), ossim::isSigned(), ossimIrect::lr(), m_alpha, m_codestream, m_imageRect, m_threadEnv, m_threadQueue, ossim::min(), OSSIM_NULL, OSSIM_UINT8, ossimIrect::ul(), ossimIpt::x, and ossimIpt::y.
|
private |
If true write alpha channel.
Definition at line 373 of file ossimKakaduCompressor.h.
Referenced by getAlphaChannelFlag(), setAlphaChannelFlag(), and writeTile().
|
private |
Definition at line 353 of file ossimKakaduCompressor.h.
Referenced by finish(), setTlmTileCount(), and writeTile().
|
private |
Layer slopes array provided in 'flush' calls.
Image rectangle. Used for clip in writeTile.
Definition at line 367 of file ossimKakaduCompressor.h.
Referenced by initialize(), and writeTile().
|
private |
Definition at line 351 of file ossimKakaduCompressor.h.
Referenced by finish().
|
private |
Definition at line 352 of file ossimKakaduCompressor.h.
Referenced by finish(), openJp2Codestream(), writeGeotiffBox(), and writeGmlBox().
|
private |
Layer sizes provided in 'flush' calls.
Definition at line 361 of file ossimKakaduCompressor.h.
Referenced by finish(), and initialize().
|
private |
Num specs provided in 'flush' calls.
Definition at line 358 of file ossimKakaduCompressor.h.
Referenced by getNumberOfLayers(), and initialize().
|
private |
Reduced resolution levels.
Definition at line 376 of file ossimKakaduCompressor.h.
Referenced by getLevels(), initialize(), and setLevels().
|
private |
tile to use for normalized float data.
Definition at line 387 of file ossimKakaduCompressor.h.
Referenced by finish().
|
private |
Container for kakadu options to pass to kdu_params::parse_string.
Definition at line 382 of file ossimKakaduCompressor.h.
Referenced by setOptions().
|
private |
Definition at line 384 of file ossimKakaduCompressor.h.
Referenced by getQualityType(), and setQualityType().
|
private |
Lossless or lossy.
Definition at line 370 of file ossimKakaduCompressor.h.
Referenced by getReversibleFlag(), setReversibleFlag(), and setWaveletKernel().
|
private |
Definition at line 349 of file ossimKakaduCompressor.h.
Referenced by finish().
|
private |
Definition at line 354 of file ossimKakaduCompressor.h.
Referenced by finish(), and writeTile().
|
private |
Definition at line 355 of file ossimKakaduCompressor.h.
Referenced by finish(), and writeTile().
|
private |
Number of threads.
Definition at line 379 of file ossimKakaduCompressor.h.
Referenced by getThreads(), and setThreads().