34 #include <kdu_sample_processing.h> 35 #include <kdu_region_decompressor.h> 36 #include <kdu_threads.h> 42 #ifdef OSSIM_ID_ENABLED 43 static const char OSSIM_ID[] =
"$Id";
50 "ossimKakaduJ2kReader",
57 theOpenTileThreadQueue(0),
69 kdu_customize_warnings(&pretty_cout);
70 kdu_customize_errors(&pretty_cerr);
143 result.
x = 1.0 / pow((
double)2, (
double)resLevel);
149 vector<ossimDpt>& decimations)
const 152 decimations.resize(LEVELS);
225 static const char MODULE[] =
"ossimKakaduJ2kReader::open";
230 << MODULE <<
" entered...\n";
262 if ( (soc == SOC_MARKER) && (siz == SIZ_MARKER) )
310 <<
"Unable to create thread!\n";
332 kdu_core::kdu_dims region_of_interest;
333 region_of_interest.pos.x = 0;
334 region_of_interest.pos.y = 0;
345 kdu_core::KDU_WANT_OUTPUT_COMPONENTS);
378 newTileCache(fullImgRect, tileSize);
394 <<
"\nSIZ marker segment" 396 <<
"theCodestream.get_num_components(false): " 398 <<
"\ntheCodestream.get_num_components(true): " 400 <<
"\ntheCodestream.get_bit_depth(0, true): " 402 <<
"\ntheCodestream.get_signed(0, true): " 404 <<
"\ntheCodestream.get_min_dwt_levels(): " 407 <<
"\nFull image rect: " << fullImgRect
408 <<
"\nthreads: " << threads
411 vector<ossimDpt> decimations;
417 <<
"Decimation factor[" << i <<
"]: " 419 <<
"\nsamples[" << i <<
"]: " 421 <<
"\nlines[" << i <<
"]: " 439 << MODULE <<
" ERROR:" 447 << MODULE <<
" exit status = " << (result?
"true":
"false\n")
566 while (
y < exandedRect.
lr().
y)
570 while (
x < exandedRect.
lr().
x)
583 clipToRect(clipRect);
625 static_cast<int>(resLevel),
633 << __FILE__ <<
" " << __LINE__ <<
" caught exception\n" 729 if (tempTile.
valid())
769 << __FILE__ << __LINE__
770 <<
" ossimKakaduJ2kReader::loadBlock failed!" virtual void deleteCache(ossimAppFixedCacheId cacheId)
virtual bool isSourceEnabled() const
virtual ossimString getLongName() const
Returns long name.
virtual bool open()
Open method.
virtual ossim_uint32 getNumberOfBands() const
ossimFilename theImageFile
virtual void setImageRectangle(const ossimIrect &rect)
ossim_uint32 theMinDwtLevels
ossim_uint32 m_Xsiz
width of reference grid
Represents serializable keyword/value map.
virtual ossim_uint32 getNumberOfLines(ossim_uint32 resLevel=0) const
Gets number of lines for res level.
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
Method to the load (recreate) the state of an object from a keyword list.
virtual ossim_uint32 getNumberOfLines(ossim_uint32 resLevel=0) const =0
Pure virtual, derived classes must implement.
double nan()
Method to return ieee floating point double precision NAN.
ossimRefPtr< ossimImageData > theCacheTile
virtual ossim_uint32 getNumberOfInputBands() const
Returns the number of bands in the image.
OSSIM_DLL void defaultTileSize(ossimIpt &tileSize)
const ossimIpt & ul() const
OSSIM_DLL ossimByteOrder byteOrder()
ossim_uint32 toUInt32() const
ossimKakaduJ2kReader class for reading images with JPEG2000 (J2K) compressed blocks using kakadu libr...
ossim_uint32 theTileSizeY
bool intersects(const ossimIrect &rect) const
ossimKakaduJ2kReader()
default construtor
unsigned short ossim_uint16
bool loadTile(ossim_uint32 x, ossim_uint32 y)
Loads a block of data to theCacheTile.
virtual void initialize()
Initialize the data buffer.
void initializeTile()
Initializes data member "theTile".
static ossimAppFixedTileCache * instance(ossim_uint32 maxSize=0)
virtual ossimRefPtr< ossimImageData > getTile(const ossimIrect &rect, ossim_uint32 resLevel=0)
Method to grab a tile(rectangle) from image.
virtual ossim_uint32 getNumberOfDecimationLevels() const
This returns the total number of decimation levels.
virtual bool isValidRLevel(ossim_uint32 resLevel) const
Determines if the passed in reslution level is valid.
ossim_uint32 m_YTsiz
height of one reference tile
bool completely_within(const ossimIrect &rect) const
virtual ossim_uint32 getImageTileWidth() const
Returns the tile width of the image or 0 if the image is not tiled.
virtual void loadTile(const void *src, const ossimIrect &src_rect, ossimInterleaveType il_type)
virtual ossimString getClassName() const
Returns short name.
ossim_uint32 theTileSizeX
ossim_uint16 m_Csiz
number of component in the image
virtual bool isOpen() const
Method to test for open file stream.
kdu_core::kdu_codestream theCodestream
virtual ossimString getShortName() const
Returns short name.
kdu_core::kdu_thread_queue * theOpenTileThreadQueue
static ossimImageDataFactory * instance()
ossimRefPtr< ossimImageData > getTile(ossimAppFixedCacheId cacheId, const ossimIpt &origin)
const char * findPreference(const char *key) const
virtual ossimDataObjectStatus validate() const
virtual const char * what() const
Returns the error message.
virtual ~ossimKakaduJ2kReader()
virtural destructor
virtual bool getOverviewTile(ossim_uint32 resLevel, ossimImageData *result)
Gets an overview tile.
ossim_uint32 m_XTsiz
width of one reference tile
unsigned int ossim_uint32
virtual ossimIrect getImageRectangle() const
const ossimIpt & lr() const
virtual void close()
Deletes the overview and clears the valid image vertices.
ossimIrect clipToRect(const ossimIrect &rect) const
static ossimPreferences * instance()
virtual ossim_uint32 getNumberOfSamples(ossim_uint32 resLevel=0) const
Gets the number of samples for res level.
ossimScalarType theScalarType
virtual void getDecimationFactor(ossim_uint32 resLevel, ossimDpt &result) const
Gets the decimation factor for a resLevel.
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
Method to the load (recreate) the state of an object from a keyword list.
virtual ossim_uint32 getNumberOfDecimationLevels() const
Returns the number of decimation levels.
virtual void makeBlank()
Initializes data to null pixel values.
virtual void completeOpen()
Will complete the opening process.
ossimRefPtr< ossimImageHandler > theOverview
bool copyRegionToTile(kdu_supp::kdu_channel_mapping *channelMapping, kdu_core::kdu_codestream &codestream, int discard_levels, kdu_core::kdu_thread_env *threadEnv, kdu_core::kdu_thread_queue *threadQueue, ossimImageData *destTile)
Copies region from codestream to tile at a given rlevel.
ossimRefPtr< ossimImageData > theTile
This class defines an abstract Handler which all image handlers(loaders) should derive from...
virtual void getDecimationFactors(vector< ossimDpt > &decimations) const
Get array of decimations for all levels.
kdu_core::kdu_thread_env * theThreadEnv
virtual const void * getBuf() const
virtual ossimScalarType getOutputScalarType() const
Returns the output pixel type of the tile source.
ossimAppFixedTileCache::ossimAppFixedCacheId theCacheId
bool loadTileFromCache(ossim_uint32 x, ossim_uint32 y, const ossimIrect &clipRect)
Loads a block of data to theCacheTile from the cache.
ossimJ2kSizRecord theSizRecord
const char * c_str() const
Returns a pointer to a null-terminated array of characters representing the string's contents...
void stretchToTileBoundary(const ossimIpt &tileWidthHeight)
virtual ossim_uint32 getImageTileHeight() const
Returns the tile width of the image or 0 if the image is not tiled.
virtual ossim_uint32 getNumberOfOutputBands() const
Returns the number of bands in a tile returned from this TileSource.
virtual ossim_uint32 getNumberOfSamples(ossim_uint32 resLevel=0) const =0
Pure virtual, derived classes must implement.
virtual void closeEntry()
Method to close current entry.
RTTI_DEF1_INST(ossimKakaduJ2kReader, "ossimKakaduJ2kReader", ossimImageHandler) ossimKakaduJ2kReader
ossimScalarType getScalarType() const
Gets the scalar type.
ossimRefPtr< ossimImageData > addTile(ossimAppFixedCacheId cacheId, ossimRefPtr< ossimImageData > data, bool duplicateData=true)
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
ossim_uint32 m_Ysiz
height of reference grid
virtual ossimRefPtr< ossimImageData > getTile(const ossimIpt &origin, ossim_uint32 resLevel=0)
void parseStream(ossim::istream &in)
Parse method.