54 #ifdef OSSIM_ID_ENABLED 55 static const char OSSIM_ID[] =
"$Id: ossimNitfTileSource.cpp 22925 2014-10-28 22:01:09Z dburken $";
61 static const char* READ_MODE[] = {
"READ_MODE_UNKNOWN",
74 static ossimTrace traceDebug(
"ossimNitfTileSource:debug");
78 static const ossim_uint32 OSSIM_NITF_VQ_BLOCKSIZE = 6144;
83 struct jpeg_error_mgr
pub;
94 theNitfImageHeader(0),
95 theReadMode(READ_MODE_UNKNOWN),
97 theSwapBytesFlag(false),
98 theNumberOfInputBands(0),
99 theNumberOfOutputBands(0),
100 theBlockSizeInBytes(0),
101 theReadBlockSizeInBytes(0),
102 theNumberOfImages(0),
104 theImageRect(0,0,0,0),
109 theCacheEnabledFlag(false),
112 thePackedBitsFlag(false),
114 theNitfBlockOffset(0),
116 m_jpegOffsetsDirty(false)
121 <<
"ossimNitfTileSource::ossimNitfTileSource entered..." << endl;
122 #ifdef OSSIM_ID_ENABLED 194 const std::string& connectionString )
196 static const char MODULE[] =
"ossimNitfTileSource::open( stream, ...)";
199 if(!str)
return result;
205 << MODULE <<
" entered...\nFile = " << file <<
"\n";
248 << MODULE <<
" ERROR:\nNull image header!" << endl;
258 << MODULE <<
"DEBUG:" 259 <<
"\nImage header[" << i <<
"]:\n" << *(hdr.
get())
304 <<
" has an unsupported compression code = " 349 << MODULE <<
"DEBUG:\nNo images in file!" << endl;
357 << MODULE <<
" exit status: " << (result?
"true":
"false") <<
"\n";
369 static const char MODULE[] =
"ossimNitfTileSource::parseFile";
376 << MODULE <<
" DEBUG: Nitf file = " << file << endl;
396 << MODULE <<
"DEBUG:" <<
"\nError parsing file!" << endl;
408 << MODULE <<
"DEBUG:\nNumber of images " 418 << MODULE <<
"DEBUG:\nNo images in file!" << endl;
437 << MODULE <<
" ERROR:\nNull image header!" << endl;
447 << MODULE <<
"DEBUG:" 448 <<
"\nImage header[" << i <<
"]:\n" << *hdr
495 <<
" has an unsupported compression code = " 507 <<
" has an invalid image header\n";
534 <<
"DEBUG:\nNumber of header not equal number of images!" 556 << MODULE <<
" DEBUG:" 564 file, ios::in | ios::binary);
571 << MODULE <<
" ERROR:" 572 <<
"\nCannot open: " << file.
c_str() << endl;
580 << MODULE <<
" leaving with true..." << endl;
709 <<
"Entry with jpeg compression (C3) has an unsupported " 745 if ( (compressionCode ==
"C3") && ((imode ==
"B")||(imode ==
"P")) )
749 else if (numberOfBlocks > 1)
755 else if (imode ==
"P")
759 else if (imode ==
"R")
763 else if (imode ==
"S")
774 else if (imode ==
"P")
778 else if (imode ==
"R")
782 else if (imode ==
"S")
790 <<
"ossimNitfTileSource::initializeReadMode DEBUG:" 791 <<
"\nnumberOfBlocks: " << numberOfBlocks
792 <<
"\nIMODE: " << imode
811 if (bitsPerPixel < 1)
818 switch (bitsPerPixel)
827 if(pixelValueType ==
"SI")
839 if(pixelValueType ==
"SI")
851 if(pixelValueType ==
"SI")
863 if(pixelValueType ==
"SI")
875 if(pixelValueType ==
"SI")
889 if(pixelValueType ==
"SI")
901 if(pixelValueType ==
"SI")
905 else if(pixelValueType ==
"R")
913 if(pixelValueType ==
"R")
929 else if(bitsPerPixel < 16)
933 else if(bitsPerPixel < 32)
952 <<
"ossimNitfTileSource::initializeScalarType DEBUG:" 998 if ( bandInfo.
valid() )
1020 <<
"ossimNitfTileSource::initializeBandCount DEBUG:" 1043 bytesRowCol = OSSIM_NITF_VQ_BLOCKSIZE;
1055 if ( bytes > 2147483647 )
1060 <<
"ossimNitfTileSource::initializeBlockSize WARNING!" 1061 <<
"\nBusting 2 GIG block size: " << bytes
1069 if ( !bytesRowColCacheTile )
1079 if ( bytes > 2147483647 )
1084 <<
"ossimNitfTileSource::initializeBlockSize WARNING!" 1085 <<
"\nBusting 2 GIG cache bytes: " << bytes
1091 bytesRowColCacheTile = bytes;
1100 <<
"\ngetNumberOfPixelsPerBlockHoriz(): " 1102 <<
"\ngetNumberOfPixelsPerBlockVert(): " 1104 <<
"\ngetBitsPerPixelPerBand(): " 1106 <<
"\nbytesRowCol: " << bytesRowCol
1107 <<
"\nbytesRowColCacheTile: " << bytesRowColCacheTile
1161 <<
"ossimNitfTileSource::initializeBlockSize DEBUG:" 1282 if ( (startCol > 0) && (startRow > 0) )
1286 shift.
x = (startCol-1) *
1288 shift.
y = (startRow-1) *
1302 if ( transform.
valid() )
1318 createProjection(
this);
1335 <<
"ossimNitfTileSource::createImageGeometry DEBUG:\n";
1364 <<
"ossimNitfTileSource::initializeImageRect DEBUG:" 1365 <<
"\noffset from ILOC field: " << iloc
1429 <<
"ossimNitfTileSource::initializeCacheSize DEBUG:" 1473 <<
"ossimNitfTileSource::initializeCacheTileInterLeaveType DEBUG:" 1474 <<
"\nCache tile interleave type: " 1636 << __FILE__ <<
" " << __LINE__
1637 <<
" loadTile failed!" 1665 while (
y < zbClipRect.
lr().
y)
1669 while (
x < zbClipRect.
lr().
x)
1707 bool result =
false;
1720 if (tempTile.
valid())
1747 <<
"ossimNitfTileSource::loadBlock DEBUG:" 1748 <<
" x: " <<
x <<
" y: " <<
y << endl;
1788 <<
"ossimNitfTileSource::loadBlock BIP Read Error!" 1789 <<
"\nReturning error..." << endl;
1827 <<
"ossimNitfTileSource::loadBlock Read Error!" 1828 <<
"\nReturning error..." << endl;
1859 <<
"ossimNitfTileSource::loadBlock Read Error!" 1860 <<
"\nReturning error..." << endl;
1913 for(bandIdx = 0; bandIdx < bandCount; ++bandIdx)
1917 for(idx = 0; idx < maxIdx; ++idx)
1923 memcpy((
char*)packedBuffer->
getBuf(bandIdx),
1933 for(bandIdx = 0; bandIdx < bandCount; ++bandIdx)
1937 for(idx = 0; idx < maxIdx; ++idx)
1943 memcpy((
char*)packedBuffer->
getBuf(bandIdx),
1952 for(bandIdx = 0; bandIdx < bandCount; ++bandIdx)
1956 for(idx = 0; idx < maxIdx; ++idx)
1962 memcpy((
char*)packedBuffer->
getBuf(bandIdx),
1980 if(!hdr||!tile)
return;
1982 if(!tile->
getBuf())
return;
1995 for (band = 0; band < numberOfBands; ++band)
2007 for(idx = 0; idx < maxIdx; ++idx)
2009 if(*buf == transparentValue)
2027 for(idx = 0; idx < maxIdx; ++idx)
2029 if(*buf == transparentValue)
2042 for(idx = 0; idx < maxIdx; ++idx)
2044 if(*buf == transparentValue)
2070 if(result < 1.0) result = 1.0;
2087 if(result > test) result = test;
2092 switch (bitsPerPixel)
2096 if (result > 2047.0)
2104 if (result > 4095.0)
2151 return streamPosition;
2157 cout <<
"ossimNitfTileSource::getPosition blockNumber: " 2158 << blockNumber << endl;
2166 if(blockOffset == 0xffffffff)
2170 streamPosition += blockOffset;
2205 streamPosition += (std::streamoff)((
ossim_uint64)blockNumber *
2234 std::streampos bandOffset = 0;
2260 std::streampos blockOffset = 0;
2261 std::streampos blockSizeInBytes = 0;
2285 blockOffset = blockSizeInBytes;
2318 <<
"ossimNitfTileSource::loadState(kwl, prefix) DEBUG:" 2319 <<
"\nUnable to load, exiting..." << std::endl;
2324 const char* lookup = kwl.
find(prefix,
"entry");
2348 <<
"ossimNitfTileSource::loadState(kwl, prefix) DEBUG:" 2358 const char* prefix)
const 2378 bool needDefault =
false;
2403 bool needDefault =
false;
2483 blockX = (block_origin.
x /
2485 blockY= (block_origin.
y /
2509 blockNumber = blockY;
2565 return((compressionCode ==
"C4")||
2566 (compressionCode ==
"M4"));
2753 bool result =
false;
2757 if ( hdr && (BANDS > 2) )
2766 if ( imageBand.
valid() )
2775 else if ( os ==
"G" )
2779 else if ( os ==
"B" )
2785 ( r != BOGUS ) && ( g != BOGUS ) && ( b != BOGUS ) )
2848 if (!property)
return;
2895 if (!hdr||!destination)
2900 (!destination->
getBuf())||
2924 for(compressionYidx = 0; compressionYidx < h; ++compressionYidx)
2926 for(compressionXidx = 0; compressionXidx < w; ++compressionXidx)
2928 tempRows[0][uncompressIdx] = (*theLut)[*srcPtr][0];
2929 tempRows[1][uncompressIdx] = (*theLut)[*srcPtr][1];
2930 tempRows[2][uncompressIdx] = (*theLut)[*srcPtr][2];
2941 if (!hdr||!destination)
2948 if( ( (BANDS != 1) && (BANDS!=3) ) ||
2949 (!destination->
getBuf()) ||
2961 if(!compressionHeader)
2966 const std::vector<ossimNitfVqCompressionOffsetTableData>& table =
2971 if(!bandInfo.
valid())
return;
2973 std::vector<ossimRefPtr<ossimNitfImageLut> > luts(BANDS);
2974 std::vector<ossim_uint8*> tempRows(BANDS);
2977 for (band =0; band<BANDS; ++band)
2979 luts[band] = bandInfo->
getLut(band);
2980 if ( luts[band].valid() )
2996 theNumberOfValuesPerCompressionLookup);
3011 compressionYidx < COMPRESSION_HEIGHT;
3014 uncompressYidx = compressionYidx * ROWS * DEST_WIDTH;
3017 compressionXidx < COMPRESSION_WIDTH;
3020 uncompressIdx = uncompressYidx + COLS * compressionXidx;
3022 codeWord = bits.getValueAsUint32(compressionIdx++);
3027 data = &(table[rowIdx].theData[codeWord]);
3031 lutValue = (*data)&0xff;
3033 for (band = 0; band < BANDS; ++band)
3036 tempRows[band][uncompressIdx+colIdx] = p;
3042 uncompressIdx += DEST_WIDTH;
3055 if (!hdr||!destination)
3062 if(( (BANDS != 1)&&(BANDS!=3) ) ||
3063 (!destination->
getBuf())||
3073 if(!compressionHeader)
3078 const std::vector<ossimNitfVqCompressionOffsetTableData>& table =
3083 if(!bandInfo.
valid())
return;
3085 std::vector<ossimRefPtr<ossimNitfImageLut> > luts(BANDS);
3086 std::vector<ossim_uint8*> tempRows(BANDS);
3089 for (band =0; band<BANDS; ++band)
3091 luts[band] = bandInfo->
getLut(band);
3092 if ( luts[band].valid() )
3119 cols = table[0].theNumberOfValuesPerCompressionLookup;
3127 for(compressionYidx = 0;
3128 compressionYidx < compressionHeight;
3131 uncompressYidx = compressionYidx*rows*destWidth;
3133 for(compressionXidx = 0;
3134 compressionXidx < compressionWidth;
3137 uncompressIdx = uncompressYidx + cols*compressionXidx;
3138 ossim_uint32 codeWord = bits.getValueAsUint32(compressionIdx);
3140 bool transparent =
false;
3141 if (codeWord == 4095)
3153 for(rowIdx = 0; rowIdx < rows; ++rowIdx)
3155 data = &table[rowIdx].theData[codeWord];
3157 for(colIdx = 0; colIdx < cols; ++colIdx)
3159 lutValue = (*data)&0xff;
3163 transparent =
false;
3172 uncompressIdx += destWidth;
3177 uncompressIdx = uncompressYidx + cols*compressionXidx;
3178 codeWord = bits.getValueAsUint32(compressionIdx);
3181 for(rowIdx = 0; rowIdx < rows; ++rowIdx)
3183 data = &table[rowIdx].theData[codeWord];
3185 for(colIdx = 0; colIdx < cols; ++colIdx)
3187 lutValue = (*data)&0xff;
3189 for (band = 0; band < BANDS; ++band)
3192 tempRows[band][uncompressIdx+colIdx] = (!transparent?p:NP);
3197 uncompressIdx += destWidth;
3210 bool allBlocksFound =
false;
3216 return allBlocksFound;
3257 std::streamoff soiOffset = 0;
3258 std::streamoff eoiOffset = 0;
3268 while (
theFileStr->get( ct.c ) && !allBlocksFound )
3284 soiOffset = ((std::streamoff)
theFileStr->tellg()) - 2;
3317 allBlocksFound =
true;
3328 else if ( ( ct.uc == AP6 ) || ( ct.uc == AP7 ) || ( ct.uc == DHT ) ||
3329 ( ct.uc == DQT ) || ( ct.uc == SOS ) ||
3330 ( ( ct.uc >= 0xc0 ) && ( ct.uc <= 0xcF ) )
3337 swapper->
swap( length );
3342 theFileStr->seekg( length - 2, std::ios_base::cur );
3378 if ( !allBlocksFound )
3384 <<
"\nBlock offset count wrong!" 3385 <<
"\nexpected blocks: " << total_blocks
3394 return allBlocksFound;
3404 <<
"ossimNitfTileSource::uncompressJpegBlock DEBUG:" 3405 <<
"\nblockNumber: " << blockNumber
3423 <<
"ossimNitfTileSource::uncompressJpegBlock scan for offsets error!" 3424 <<
"\nReturning error..." << endl;
3443 if (!
theFileStr->read((
char*)&(compressedBuf.front()),
3448 <<
"ossimNitfTileSource::uncompressJpegBlock Read Error!" 3449 <<
"\nReturning error..." << endl;
3460 jpeg_decompress_struct cinfo;
3471 cinfo.err = jpeg_std_error(&jerr.
pub);
3481 jpeg_destroy_decompress(&cinfo);
3486 jpeg_CreateDecompress(&cinfo, JPEG_LIB_VERSION,
sizeof(cinfo));
3493 &(compressedBuf.front()),
3497 jpeg_read_header(&cinfo,
TRUE);
3500 if (cinfo.quant_tbl_ptrs[0] == NULL)
3505 jpeg_destroy_decompress(&cinfo);
3511 if (cinfo.ac_huff_tbl_ptrs[0] == NULL)
3516 jpeg_destroy_decompress(&cinfo);
3528 jpeg_start_decompress(&cinfo);
3534 <<
"jpeg cinfo.output_width: " << cinfo.output_width
3535 <<
"\njpeg cinfo.output_height: " << cinfo.output_height
3556 const ossim_uint32 ROW_STRIDE = SAMPLES * cinfo.output_components;
3558 if ( (SAMPLES < theCacheTile->getWidth() ) ||
3559 (LINES_TO_READ < theCacheTile->getHeight()) )
3568 jpeg_finish_decompress(&cinfo);
3569 jpeg_destroy_decompress(&cinfo);
3580 std::vector<ossim_uint8> lineBuffer(ROW_STRIDE);
3582 jbuf[0] = (JSAMPROW) &(lineBuffer.front());
3584 while (cinfo.output_scanline < LINES_TO_READ)
3587 jpeg_read_scanlines(&cinfo, jbuf, 1);
3602 for (
ossim_uint32 sample = 0; sample < SAMPLES; ++sample)
3606 destinationBuffer[band][sample] = lineBuffer[index];
3619 jpeg_finish_decompress(&cinfo);
3620 jpeg_destroy_decompress(&cinfo);
3630 jpeg_decompress_struct& cinfo)
const 3639 if (cinfo.quant_tbl_ptrs[0] != NULL)
3653 if (comrat.
size() >= 4)
3657 s.
push_back(comrat[static_cast<std::string::size_type>(3)]);
3659 if ( (comTbl > 0) && (comTbl < 6) )
3661 tableIndex = comTbl-1;
3666 <<
"ossimNitfTileSource::loadJpegQuantizationTables WARNING\n" 3667 <<
"\nNo quantization tables specified!" 3673 cinfo.quant_tbl_ptrs[0] = jpeg_alloc_quant_table((j_common_ptr) &cinfo);
3675 JQUANT_TBL* quant_ptr = cinfo.quant_tbl_ptrs[0];
3680 quant_ptr->quantval[i] = QTABLE_ARRAY[tableIndex][i];
3690 jpeg_decompress_struct& cinfo)
const 3692 if ( (cinfo.ac_huff_tbl_ptrs[0] != NULL) &&
3693 (cinfo.dc_huff_tbl_ptrs[0] != NULL) )
3698 cinfo.ac_huff_tbl_ptrs[0] = jpeg_alloc_huff_table((j_common_ptr)&cinfo);
3699 cinfo.dc_huff_tbl_ptrs[0] = jpeg_alloc_huff_table((j_common_ptr)&cinfo);
3702 JHUFF_TBL* huff_ptr;
3705 huff_ptr = cinfo.ac_huff_tbl_ptrs[0];
3706 for (i = 0; i < 16; ++i)
3709 huff_ptr->bits[i+1] = AC_BITS[i];
3712 for (i = 0; i < 256; ++i)
3714 huff_ptr->huffval[i] = AC_HUFFVAL[i];
3718 huff_ptr = cinfo.dc_huff_tbl_ptrs[0];
3719 for (i = 0; i < 16; ++i)
3722 huff_ptr->bits[i+1] = DC_BITS[i];
3725 for (i = 0; i < 256; i++)
3728 huff_ptr->huffval[i] = DC_HUFFVAL[i];
virtual void deleteCache(ossimAppFixedCacheId cacheId)
bool parseStream(const ossimFilename &file, ossim::istream &in)
Parse stream method.
16 bit unsigned integer (15 bits used)
void clear()
Erases the entire container.
virtual ossim_uint32 getWidth() const
virtual ossim_uint32 getTileWidth() const
Returns the width of the output tile.
virtual bool isSourceEnabled() const
ossim_uint32 getNumberOfEntries() const
ossimString getSecurityClassification() const
ossimRefPtr< ossimImageGeometry > theGeometry
virtual double getMaxPixelValue(ossim_uint32 band=0) const
Returns the max pixel of the band.
virtual ossim_uint32 getNumberOfInputBands() const
bool loadJpegHuffmanTables(jpeg_decompress_struct &cinfo) const
Loads default huffman tables.
std::vector< ossim_uint32 > theEntryList
virtual bool setCurrentEntry(ossim_uint32 entryIdx)
ossimString getStartRow() const
void setProjection(ossimProjection *projection)
Sets the projection to be used for local-to-world coordinate transformation.
virtual void initializeCacheTileInterLeaveType()
Initializes the data member "theCacheTileInterLeaveType".
virtual const ossimRefPtr< ossimNitfImageLut > getLut(ossim_uint32 idx) const =0
static ossimString upcase(const ossimString &aString)
virtual ossim_uint32 getNumberOfBands() const
ossimFilename theImageFile
ossim_uint32 getNumberOfBands() const
virtual void setImageRectangle(const ossimIrect &rect)
void setBoundingRectangle(const ossimIrect &imageRect)
ossimNitfImageHeader * getNewImageHeader(ossim_uint32 imageNumber) const
ossim_uint32 theNumberOfInputBands
virtual bool uncompressJpegBlock(ossim_uint32 x, ossim_uint32 y)
Uncompresses a jpeg block using the jpeg-6b library.
virtual const ossim_uint8 * getUcharBuf() const
Represents serializable keyword/value map.
static const ossimErrorCode OSSIM_OK
std::basic_ifstream< char > ifstream
Class for char input file streams.
std::shared_ptr< ossim::istream > theFileStr
const char * find(const char *key) const
std::vector< ossimDpt > theDecimationFactors
IMODE = R "single block Band Interleaved By Row".
virtual ossimString getEntryString(ossim_int32 entry_number) const
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::ostream & print(std::ostream &out) const
Prints contents to output stream.
virtual ossim_uint32 getNumberOfLines(ossim_uint32 resLevel=0) const =0
Pure virtual, derived classes must implement.
void setCacheEnabledFlag(bool flag)
ossim_uint32 height() const
bool contains(char aChar) const
ossimRefPtr< ossimNitfFile > theNitfFile
std::vector< ossim_uint32 > theNitfBlockSize
virtual ossim_uint32 getNumberOfLines(ossim_uint32 resLevel=0) const
Returns the number of lines in the image.
ossim_uint32 theReadBlockSizeInBytes
virtual void initializeSwapBytesFlag()
Initializes the data member "theSwapBytesFlag" from the current entry.
virtual ~ossimNitfTileSource()
virtual ossim_uint32 getTileHeight() const
Returns the height of the output tile.
void initializeLut()
Initializes "theLut" if applicable.
OSSIM_DLL void defaultTileSize(ossimIpt &tileSize)
virtual ossimString getBandRepresentation() const =0
const ossimIpt & ul() const
virtual ossimDataObjectStatus getDataObjectStatus() const
virtual ossim_uint32 getHeight() const
OSSIM_DLL ossimByteOrder byteOrder()
16 bit unsigned integer (14 bits used)
static const ossimErrorCode OSSIM_ERROR
ossim_uint32 toUInt32() const
16 bit unsigned integer (13 bits used)
static StreamFactoryRegistry * instance()
virtual ossim_uint32 getNumberOfLuts() const =0
virtual void setReadOnlyFlag(bool flag)
virtual ossimRefPtr< ossimProperty > getProperty(const ossimString &name) const
ossim_uint32 getValueAsUint32(ossim_uint32 idx) const
Extract out the value at offset indicated by idx and convert the the vale to an ossim_uint32.
bool intersects(const ossimIrect &rect) const
unsigned short ossim_uint16
virtual void setProperty(ossimRefPtr< ossimProperty > property)
virtual ossim_uint32 getNumberOfSamples(ossim_uint32 resLevel=0) const
Returns the number of samples in the image.
virtual bool getRgbBandList(std::vector< ossim_uint32 > &bandList) const
Convenience method to get the zero based rgb output band list.
virtual double getNullPixelValue(ossim_uint32 band=0) const
Each band has a null pixel associated with it.
void initializeBandCount()
Initializes the data member "theNumberOfBands" from the current entry.
virtual ossim_uint32 getCurrentEntry() const
ossimInterleaveType theCacheTileInterLeaveType
std::vector< ossim_uint8 > theCompressedBuf
ossim_uint32 getNumberOfBlocks() const
IMODE = B, IC = C3 "JPEG compressed blocks".
virtual void initialize()
Initialize the data buffer.
virtual bool canUncompress(const ossimNitfImageHeader *hdr) const
static ossimAppFixedTileCache * instance(ossim_uint32 maxSize=0)
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 getSizePerBandInBytes() const
Returns the number of bytes in single band of the tile.
struct jpeg_error_mgr pub
virtual bool allocate()
Allocates everything for current entry.
virtual bool isValidRLevel(ossim_uint32 resLevel) const
Determines if the passed in reslution level is valid.
bool toSimpleVector(std::vector< T > &result, const ossimString &stringOfPoints)
virtual double getMinPixelValue(ossim_uint32 band=0) const
Retuns the min pixel value.
ossim_int32 toInt32() const
bool completely_within(const ossimIrect &rect) const
void vqUncompressM4(ossimRefPtr< ossimImageData > destination, ossim_uint8 *source)
Uncompresses Vector Quantization masked image data.
ossim_uint32 theBlockSizeInBytes
void push_back(char c)
Equivalent to insert(end(), c).
virtual void getPropertyNames(std::vector< ossimString > &propertyNames) const
void add(const char *prefix, const ossimKeywordlist &kwl, bool overwrite=true)
virtual void loadTile(const void *src, const ossimIrect &src_rect, ossimInterleaveType il_type)
#define RTTI_DEF1_INST(cls, name, b1)
virtual ossimScalarType getOutputScalarType() const
Returns the output pixel type of the tile source.
static ossimScalarTypeLut * instance()
Returns the static instance of an ossimScalarTypeLut object.
virtual bool getOverviewTile(ossim_uint32 resLevel, ossimImageData *result)
Method to get an overview tile.
static ossimImageDataFactory * instance()
OSSIM_DLL void ossimJpegMemorySrc(jpeg_decompress_struct *cinfo, const ossim_uint8 *buffer, std::size_t bufsize)
Method which uses memory instead of a FILE* to read from.
virtual bool isOpen() const
Derived classes must implement this method to be concrete.
ossim_uint32 theNumberOfImages
ossimRefPtr< ossimImageData > getTile(ossimAppFixedCacheId cacheId, const ossimIpt &origin)
bool loadJpegQuantizationTables(jpeg_decompress_struct &cinfo) const
Loads one of the default tables based on COMRAT value.
virtual ossimDataObjectStatus validate() const
virtual ossimRefPtr< ossimImageGeometry > getImageGeometry()
Returns the image geometry object associated with this tile source or NULL if non defined...
virtual const ossimFilename & getFilename() const
Returns the filename.
signed short ossim_sint16
IMODE = B of S "single block or one block for each band".
std::string::size_type size() const
virtual void initializeScalarType()
Initializes the data member "theScalarType" from the current entry.
void initializeCacheTile()
Initializes the cache tile size(width and height).
bool toBool() const
String to numeric methods.
virtual bool initializeImageRect()
Initializes the data members "theImageRect" and "theBlockRect" from the current entry.
unsigned long long ossim_uint64
const ossimNitfFileHeader * getHeader() const
unsigned int ossim_uint32
virtual const ossim_float64 * getNullPix() const
ossim_uint32 getPartialReadSize(const ossimIpt &blockOrigin) const
ossimString trim(const ossimString &valueToTrim=ossimString(" \\)) const
this will strip lead and trailing character passed in.
virtual void close()
Closes file and destroys all memory allocated.
bool isVqCompressed(const ossimString &compressionCode) const
virtual ossimString getLongName() const
IMODE = S "Band Sequential".
void initializeCacheSize()
Initializes the data member "theCacheSize".
ossimRefPtr< ossimImageData > theCacheTile
virtual ossimIrect getImageRectangle() const
virtual bool parseFile()
Parses "theImageFile" and initializes all nitf headers.
const ossimIpt & lr() const
virtual void getPropertyNames(std::vector< ossimString > &propertyNames) const
const ossimNitfImageHeader * getCurrentImageHeader() const
ossimAppFixedTileCache::ossimAppFixedCacheId theCacheId
virtual ossimRefPtr< ossimImageData > create(ossimSource *owner, ossimScalarType scalar, ossim_uint32 bands=1) const
ossim_uint32 width() const
ossimErrorCode theErrorStatus
bool loadTile(const ossimIrect &clipRect)
Returns true on success, false on error.
static const char * BANDS_KW
ossimIrect clipToRect(const ossimIrect &rect) const
virtual void initializeOutputTile()
Initializes the output tile size(width and height).
virtual void establishDecimationFactors()
Virtual method determines the decimation factors at each resolution level.
void explodePackedBits(ossimRefPtr< ossimImageData > packedBuffer) const
std::streampos getBandOffset() const
bool initializeBlockSize()
Initializes the data member "theBlockSize" from the current entry.
Container class that holds both 2D transform and 3D projection information for an image Only one inst...
virtual void setOrigin(const ossimIpt &origin)
virtual void initializeCompressedBuf()
Initializes the data member theCompressedBuf.
static ossimProjectionFactoryRegistry * instance()
virtual void getEntryList(std::vector< ossim_uint32 > &entryList) const
const ossimNitfFileHeader * getFileHeader() const
virtual ossimRefPtr< ossimProperty > getProperty(const ossimString &name) const
ossimScalarType theScalarType
virtual ossimScalarType getScalarType() const
virtual void makeBlank()
Initializes data to null pixel values.
const ossimProjection * getProjection() const
Access methods for projection (may be NULL pointer).
ossimRefPtr< ossimImageData > theTile
virtual void completeOpen()
Will complete the opening process.
16 bit unsigned integer (11 bits used)
static const char * ENABLE_CACHE_KW
bool loadBlockFromCache(ossim_uint32 x, ossim_uint32 y, const ossimIrect &clipRect)
Loads a block of data to theCacheTile.
ossimRefPtr< ossimImageHandler > theOverview
ossim_uint32 theCurrentEntry
IMODE = P "Band Interleaved By Pixel".
void lutUncompress(ossimRefPtr< ossimImageData > destination, ossim_uint8 *source)
virtual ossim_uint32 getImageTileWidth() const
Returns the tile width of the image or 0 if the image is not tiled.
This class defines an abstract Handler which all image handlers(loaders) should derive from...
virtual bool open()
Returns true if the image_file can be opened and is a valid nitf file.
virtual ossim_uint32 getSize() const
Returns the total number of pixels in a tile for all bands.
This class will allow access to individual packed pixels given an offset and return as an ossim_uint3...
virtual bool scanForJpegBlockOffsets()
scans the file storing in offsets in "theNitfBlockOffset" and block sizes in "theNitfBlockSize".
virtual const void * getBuf() const
virtual void setErrorStatus() const
void setTransform(ossim2dTo2dTransform *transform)
Sets the transform to be used for local-to-full-image coordinate transformation.
ossimNitfTileSource & operator=(const ossimNitfTileSource &rhs)
Operator=, disallow...
virtual ossimRefPtr< ossimImageData > getTile(const ossimIrect &tileRect, ossim_uint32 resLevel=0)
ossim_uint32 getBlockNumber(const ossimIpt &block_origin) const
const char * c_str() const
Returns a pointer to a null-terminated array of characters representing the string's contents...
void convertTransparentToNull(ossimRefPtr< ossimImageData > tile) const
void stretchToTileBoundary(const ossimIpt &tileWidthHeight)
const ossim2dTo2dTransform * getTransform() const
Access methods for transform (may be NULL pointer).
virtual ossim_uint32 getNumberOfOutputBands() const
ossim2dTo2dTransform * newTransform() const
ossimFilename theOverviewFile
virtual ossim_uint32 getImageTileHeight() const
Returns the tile width of the image or 0 if the image is not tiled.
void destroy()
Deletes all memory allocated by this object.
IMODE = B "Band Interleaved By Block or a single band".
virtual ossim_uint32 getNumberOfSamples(ossim_uint32 resLevel=0) const =0
Pure virtual, derived classes must implement.
bool parseFile(const ossimFilename &file)
ossimIrect theBlockImageRect
virtual ossimIrect getBoundingRect(ossim_uint32 resLevel=0) const
Returns zero-based bounding rectangle of the image.
std::streampos getBlockOffset() const
virtual double getMaxPixelValue(ossim_uint32 band=0) const
Returns the max pixel of the band.
ossimString getStartColumn() const
virtual std::shared_ptr< ossim::istream > createIstream(const std::string &connectionString, const ossimKeywordlist &options=ossimKeywordlist(), std::ios_base::openmode mode=std::ios_base::in|std::ios_base::binary) const
Will try to creates an istream interface to the connectionString passed in.
ossimRefPtr< ossimNBandLutDataObject > theLut
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
Method to save the state of an object to a keyword list.
virtual double getMinPixelValue(ossim_uint32 band=0) const
Retuns the min pixel value.
bool getPosition(std::streamoff &position, ossim_uint32 x, ossim_uint32 y, ossim_uint32 band) const
virtual void initializeReadMode()
Initializes the data member "theReadMode" from the current entry.
virtual bool loadBlock(ossim_uint32 x, ossim_uint32 y)
Loads a block of data to theCacheTile.
virtual ossimString getShortName() const
virtual void setProperty(ossimRefPtr< ossimProperty > property)
void vqUncompressC4(ossimRefPtr< ossimImageData > destination, ossim_uint8 *source)
Uncompresses Vector Quantization unmasked image data.
virtual bool allocateBuffers()
Allocates buffers for current entry.
IMODE = R "Band Interleaved By Row".
virtual double getNullPixelValue(ossim_uint32 band=0) const
Each band has a null pixel associated with it.
virtual const ossimIpt & getOrigin() const
unsigned char ossim_uint8
std::vector< ossim_uint32 > theOutputBandList
bool getCacheEnabledFlag() const
ossimRefPtr< ossimImageData > addTile(ossimAppFixedCacheId cacheId, ossimRefPtr< ossimImageData > data, bool duplicateData=true)
std::vector< ossimRefPtr< ossimNitfImageHeader > > theNitfImageHeader
std::vector< std::streamoff > theNitfBlockOffset
IMODE = P "single block Band Interleaved By Pixel".
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 void establishDecimationFactors()
Virtual method determines the decimation factors at each resolution level.
OSSIM_DLL void ossimJpegErrorExit(jpeg_common_struct *cinfo)
Error routine that will replace jpeg's standard error_exit method.
ossim_uint32 theStartingResLevel
theStartingResLevel If set to something other than zero(default) this is indicative that the reader i...
ossim_uint32 theNumberOfOutputBands
16 bit unsigned integer (12 bits used)
bool isnan(const float &v)
isnan Test for floating point Not A Number (NAN) value.