50 #ifdef OSSIM_ID_ENABLED 51 static const char OSSIM_ID[] =
"$Id: ossimOpjJp2Reader.cpp 11439 2007-07-29 17:43:24Z dburken $";
74 <<
"ossimOpjJp2Reader::ossimOpjJp2Reader entered..." << std::endl;
75 #ifdef OSSIM_ID_ENABLED 77 <<
"OSSIM_ID: " << OSSIM_ID << endl;
102 static const char MODULE[] =
"ossimOpjJp2Reader::open";
107 << MODULE <<
" entered..." 125 if (
m_format != OPJ_CODEC_UNKNOWN )
127 m_str->seekg(0, ios_base::beg);
139 m_str->seekg(0, ios_base::beg);
144 <<
" DEBUG: J2K COD RECORD:\n" 152 if (
status && traceDebug() )
155 <<
" DEBUG: J2K SIZ RECORD:\n" 160 else if ( traceDebug() )
178 << MODULE <<
" exit status " << (
status?
"true\n":
"false\n");
254 <<
"ossimOpjJp2Reader::getOverviewTile DEBUG:" 255 <<
"\ntile rect: " << tileRect
256 <<
"\nimageRect: " << imageRect
257 <<
"\nclipRect: " << clipRect
258 <<
"\nshiftedRect: " << shiftedRect
259 <<
"\noffset: " << offset
260 <<
"\nresLevel: " << resLevel
285 << __FILE__ <<
" " << __LINE__ <<
" caught exception\n" 292 << __FILE__ <<
" " << __LINE__ <<
" caught unknown exception\n";
304 static_cast<int>(resLevel),
306 theOpenTileThreadQueue,
312 static_cast<int>(resLevel),
314 theOpenTileThreadQueue,
322 << __FILE__ <<
" " << __LINE__ <<
" caught exception\n" 351 const char* prefix)
const 525 while ( str->get( ct.c ) )
529 if ( str->get( ct.c ) )
533 if ( str->get( ct.c ) )
537 if ( str->get( ct.c ) )
578 while ( str->get( ct.c ) )
582 if ( str->get( ct.c ) )
650 static const char MODULE[] =
"ossimOpjJp2Reader::getInternalImageGeometry";
661 std::streamoff pos =
m_str->tellg();
663 m_str->seekg(0, std::ios_base::beg );
668 m_str->seekg(4, std::ios_base::beg );
673 if ( geom.
valid() == false )
681 m_str->seekg(pos, std::ios_base::beg );
690 static const char MODULE[] =
"ossimOpjJp2Reader::getImageGeometryFromGeotiffBox";
700 std::streamoff pos =
m_str->tellg();
702 m_str->seekg(0, std::ios_base::beg );
704 std::vector<ossim_uint8> box;
710 m_str->seekg(pos, std::ios_base::beg );
712 if ( boxPos && box.size() )
717 <<
"Found geotiff uuid at: " << boxPos+8 <<
"\n";
735 boxStream.str( boxString );
782 if ( type ==
"pixel_is_area" )
786 else if ( type ==
"pixel_is_point" )
806 static const char MODULE[] =
"ossimOpjJp2Reader::getImageGeometryFromGmlBox";
816 std::streamoff pos =
m_str->tellg();
818 m_str->seekg(0, std::ios_base::beg );
820 std::vector<ossim_uint8> box;
826 m_str->seekg(pos, std::ios_base::beg );
828 if ( boxPos && box.size() )
833 <<
"Found gml box at: " << boxPos+8
834 <<
"\nbox size: " << box.size() <<
"\n";
841 boxStream.rdbuf()->pubsetbuf( (
char*)&box.front(), box.size() );
844 std::string boxString( box.begin(), box.end() );
846 boxStream.str( boxString );
891 static const char M[] =
"ossimOpjJp2Reader::getMetadataImageGeometry";
904 if ( fdgcFile.
exists() == false )
913 if ( fgdcDoc.
open(fdgcFile) )
944 if ( tfw.
open(worldFile, pixelType, unitType) )
947 gsd.
y = std::fabs(gsd.
y);
974 << M <<
" Unhandled rotation in tfw file." << std::endl;
991 << M <<
" exit status = " << (geom.
valid()?
"true":
"false\n")
1008 <<
"ossimOpjJp2Reader::allocate DEBUG:"
virtual bool isSourceEnabled() const
bool open(const ossimFilename &file, ossimPixelType ptype, ossimUnitType unit)
static ossimImageGeometryRegistry * instance()
ossimRefPtr< ossimImageGeometry > theGeometry
virtual const ossim_float64 * getMaxPix() const
ossim_uint32 m_XTOsiz
Horizontal offset from the orgin of reference grid to the left edge of first tile.
void setProjection(ossimProjection *projection)
Sets the projection to be used for local-to-world coordinate transformation.
void allocate()
Initializes tiles.
ossim_uint32 m_YTOsiz
Vertical offset from the orgin of reference grid to the top edge of first tile.
ossimFilename theImageFile
virtual void setImageRectangle(const ossimIrect &rect)
virtual ossimRefPtr< ossimImageGeometry > getImageGeometryFromGeotiffBox()
ossim_uint32 m_Xsiz
width of reference grid
Represents serializable keyword/value map.
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
Method to the load (recreate) the state of an object from a keyword list.
std::basic_ifstream< char > ifstream
Class for char input file streams.
const char * find(const char *key) const
virtual ossimScalarType getOutputScalarType() const
Returns the output pixel type of the tile source.
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.
virtual ossim_uint32 getNumberOfInputBands() const
Returns the number of bands in the image.
virtual ossimString getLongName() const
virtual ossimRefPtr< ossimImageData > getTile(const ossimIrect &rect, ossim_uint32 resLevel=0)
Returns a pointer to a tile given an origin representing the upper left corner of the tile to grab fr...
virtual double getMaxPixelValue(ossim_uint32 band=0) const
Returns the max pixel of the band.
void parseStream(std::istream &in)
Parse method.
bool getImageGeometry(ossimKeywordlist &geomKwl, ossim_uint32 entryIndex) const
Extracts geometry info to keyword list.
ossimRefPtr< ossimProjection > getGridCoordSysProjection()
Gets projection from Grid Coordinate system node.
static ossimString toString(bool aValue)
Numeric to string methods.
static const char * NUMBER_LINES_KW
virtual void close()
close method
virtual ossimString getShortName() const
unsigned short ossim_uint16
virtual bool extendGeometry(ossimImageHandler *handler) const
virtual void initialize()
Initialize the data buffer.
ossimRefPtr< ossimImageData > m_tile
virtual ossimIrect getImageRectangle(ossim_uint32 reduced_res_level=0) const
Returns the zero based image rectangle for the reduced resolution data set (rrds) passed in...
virtual void setMetersPerPixel(const ossimDpt &gsd)
ossimPixelType thePixelType
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.
virtual ossim_uint32 getNumberOfDecimationLevels() const
Returns the number of decimation levels.
ossim_uint32 m_YTsiz
height of one reference tile
virtual ossimRefPtr< ossimImageGeometry > getImageGeometry()
Returns the image geometry object associated with this tile source or NULL if non defined...
bool getImageGeometry(ossimKeywordlist &geomKwl) const
Extracts geometry info to keyword list.
void add(const char *prefix, const ossimKeywordlist &kwl, bool overwrite=true)
virtual void loadTile(const void *src, const ossimIrect &src_rect, ossimInterleaveType il_type)
ossim_uint16 m_Csiz
number of component in the image
virtual ossim_uint32 getImageTileHeight() const
Returns the tile width of the image or 0 if the image is not tiled.
static ossimImageDataFactory * instance()
virtual ossimString getClassName() const
ossimProjection * createProjection(const ossimFilename &filename, ossim_uint32 entryIdx) const
bool initSizRecord(std::istream *str, ossimJ2kSizRecord &sizRecord) const
virtual ~ossimOpjJp2Reader()
virtual destructor
ossim_uint32 m_XOsiz
Horizontal offset from the orgin of reference grid to the left side of image.
virtual ossimRefPtr< ossimImageGeometry > getInternalImageGeometry()
virtual ossimDataObjectStatus validate() const
virtual const char * what() const
Returns the error message.
bool initCodRecord(std::istream *str, ossimJ2kCodRecord &sizRecord) const
std::string::size_type size() const
ossim_uint32 m_minDwtLevels
ossim_uint32 m_XTsiz
width of one reference tile
unsigned int ossim_uint32
const char * chars() const
For backward compatibility.
Class for FGDC XML doc parsing.
ossim_uint8 m_numberOfDecompositionLevels
SPcod - Number of decomposition levels.
virtual ossimIrect getImageRectangle() const
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
Method to save the state of an object to a keyword list.
virtual ossim_uint32 getImageTileWidth() const
Returns the tile width of the image or 0 if the image is not tiled.
virtual void close()
Deletes the overview and clears the valid image vertices.
static ossimString downcase(const ossimString &aString)
virtual ossim_uint32 getNumberOfOutputBands() const
Returns the number of bands in a tile returned from this TileSource.
virtual ossimRefPtr< ossimImageData > create(ossimSource *owner, ossimScalarType scalar, ossim_uint32 bands=1) const
bool initialize(const ossimImageGeometry *geom, const ossimIrect &rect)
Initializes gml block from geometry file.
void initImageParameters(ossimImageGeometry *geom) const
Convenience method to set things needed in the image geometry from the image handler.
ossimIrect clipToRect(const ossimIrect &rect) const
bool opj_decode(std::ifstream *in, const ossimIrect &rect, ossim_uint32 resLevel, ossim_int32 format, std::streamoff fileOffset, ossimImageData *tile)
Container class that holds both 2D transform and 3D projection information for an image Only one inst...
static ossimProjectionFactoryRegistry * instance()
ossimRefPtr< ossimImageData > m_cacheTile
virtual ossimRefPtr< ossimImageGeometry > getExternalImageGeometry() const
Returns the image geometry object associated with this tile source or NULL if non defined...
virtual void makeBlank()
Initializes data to null pixel values.
const ossimProjection * getProjection() const
Access methods for projection (may be NULL pointer).
std::basic_istream< char > istream
Base class for char input streams.
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.
This class defines an abstract Handler which all image handlers(loaders) should derive from...
const ossimDpt & getScale() const
Converts world file parameters into x, y scale (for use in affine transform)
virtual bool open()
open method.
virtual const void * getBuf() const
static const char * PIXEL_TYPE_KW
ossimJ2kSizRecord m_sizRecord
const ossimDpt & getTranslation() const
Provides access to the translation (for use in affine transform)
ossimOpjJp2Reader()
default constructor
virtual bool isOpen() const
Derived classes must implement this method to be concrete.
const char * c_str() const
Returns a pointer to a null-terminated array of characters representing the string's contents...
virtual ossim_uint32 getNumberOfLines(ossim_uint32 reduced_res_level=0) const
Returns the number of lines in the image.
virtual void setUlTiePoints(const ossimGpt &gpt)
bool open(const ossimFilename &xmlFileName)
Open method.
double getRotation() const
Converts world file parameters into RH rotation in radians (for use in affine transform) ...
#define RTTI_DEF1(cls, name, b1)
std::basic_istringstream< char > istringstream
Class for char input memory streams.
ossimRefPtr< ossimImageGeometry > getMetadataImageGeometry() const
virtual bool getOverviewTile(ossim_uint32 resLevel, ossimImageData *result)
Gets an overview tile.
ossim_int32 getCodecFormat(std::istream *str)
Gets codec format from magic number.
std::streamoff getGmlBox(std::ifstream &str, std::vector< ossim_uint8 > &box) const
Method to get the embedded JP2 GML Box.
ossimFilename & setExtension(const ossimString &e)
Sets the extension of a file name.
ossimUnitType getUnitType() const
std::streamoff getGeotiffBox(std::ifstream &str, std::vector< ossim_uint8 > &box) const
Method to get the embedded JP2 GeoTIFF box.
static const char * NUMBER_SAMPLES_KW
unsigned char ossim_uint8
ossimScalarType getScalarType() const
Gets the scalar type.
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
Method to save the state of an object to a keyword list.
virtual ossim_uint32 getNumberOfSamples(ossim_uint32 reduced_res_level=0) const
Returns the number of samples in the image.
virtual ossimRefPtr< ossimImageGeometry > getImageGeometryFromGmlBox()
ossim_uint32 m_YOsiz
Vertical offset from the orgin of reference grid to the top of image.
ossim_uint32 m_Ysiz
height of reference grid
const std::string & string() const
virtual ossimRefPtr< ossimImageData > getTile(const ossimIpt &origin, ossim_uint32 resLevel=0)
void parseStream(ossim::istream &in)
Parse method.