40 static ossimTrace traceExec (
"ossimCcfTileSource:exec");
41 static ossimTrace traceDebug (
"ossimCcfTileSource:debug");
181 <<
"ossimCcfTileSource fillBuffer ERROR:" 182 <<
"\nUnsupported pixel type!" 183 <<
"\nBuffer not filled. Returning error." << endl;
199 if(!
isOpen())
return false;
213 const ossim_uint32 CHIP_OFFSET_TO_END = SAMPLES_PER_CHIP - 1;
229 ossim_uint32 w = (CHIPS_IN_SAMPLE_DIR*SAMPLES_PER_CHIP);
231 ossim_uint32 chunks_in_x_dir = size_in_x / w + (size_in_x % w ? 1 : 0);
232 ossim_uint32 chunks_in_y_dir = size_in_y / h + (size_in_y % h ? 1 : 0);
244 ulChunkPt.
x = chunkOrigin.
x;
256 for (
ossim_uint32 y_chip=0; y_chip<CHIPS_IN_LINE_DIR; ++y_chip)
258 chip_pt.
x = ulChunkPt.
x;
261 for (
ossim_uint32 x_chip=0; x_chip<CHIPS_IN_SAMPLE_DIR; ++x_chip)
265 chip_pt.
x + CHIP_OFFSET_TO_END,
266 chip_pt.
y + CHIP_OFFSET_TO_END);
279 = ( ulChunkPt.
y / CHUNK_SIDE_SIZE * BYTES_PER_CHUNK *
280 CHUNKS_IN_SAMPLE_DIR ) +
281 ( ulChunkPt.
x / CHUNK_SIDE_SIZE * BYTES_PER_CHUNK );
283 streampos seek_position = startOfData + tmp_offset;
287 = ( y_chip * BYTES_PER_CHIP * CHIPS_IN_SAMPLE_DIR ) +
288 (x_chip * BYTES_PER_CHIP);
290 seek_position += tmp_offset;
303 cerr <<
"ossimCcfTileSource fillUchBuffer READ ERROR!" 304 <<
"\nReturning from method." << endl;
314 for (
ossim_uint32 band=0; band<NUMBER_OF_INPUT_BANDS; ++band)
322 band * CHIP_SIZE_PER_BAND +
323 (chip_clip_rect.
ul().
y - chip_rect.
ul().
y) *
324 SAMPLES_PER_CHIP + chip_clip_rect.
ul().
x -
333 band * TILE_SIZE_PER_BAND +
334 (chip_clip_rect.
ul().
y - tile_rect.
ul().
y) *
340 chip_line <= chip_clip_rect.
lr().
y;
346 chip_sample <= chip_clip_rect.
lr().
x;
354 s += SAMPLES_PER_CHIP;
362 chip_pt.
x += SAMPLES_PER_CHIP;
366 chip_pt.
y += LINES_PER_CHIP;
370 ulChunkPt.
x += CHUNK_SIDE_SIZE;
374 ulChunkPt.
y += CHUNK_SIDE_SIZE;
400 chunksInSampleDir(reduced_res_level);
403 const ossim_uint32 CHIP_OFFSET_TO_END = SAMPLES_PER_CHIP - 1;
418 ossim_uint32 w = (CHIPS_IN_SAMPLE_DIR*SAMPLES_PER_CHIP);
420 ossim_uint32 chunks_in_x_dir = size_in_x / w + (size_in_x % w ? 1 : 0);
421 ossim_uint32 chunks_in_y_dir = size_in_y / h + (size_in_y % h ? 1 : 0);
431 ulChunkPt.
x = chunkOrigin.
x;
443 for (
ossim_uint32 y_chip=0; y_chip<CHIPS_IN_LINE_DIR; ++y_chip)
445 chip_pt.
x = ulChunkPt.
x;
448 for (
ossim_uint32 x_chip=0; x_chip<CHIPS_IN_SAMPLE_DIR; ++x_chip)
452 chip_pt.
x + CHIP_OFFSET_TO_END,
453 chip_pt.
y + CHIP_OFFSET_TO_END);
466 = ( ulChunkPt.
y / CHUNK_SIDE_SIZE * BYTES_PER_CHUNK *
467 CHUNKS_IN_SAMPLE_DIR ) +
468 ( ulChunkPt.
x / CHUNK_SIDE_SIZE * BYTES_PER_CHUNK );
470 streampos seek_position = startOfData + tmp_offset;
474 = ( y_chip * BYTES_PER_CHIP * CHIPS_IN_SAMPLE_DIR ) +
475 (x_chip * BYTES_PER_CHIP);
477 seek_position += tmp_offset;
490 cerr <<
"ossimCcfTileSource fillUshortBuffer READ ERROR!" 491 <<
"Returning from method." << endl;
501 for (
ossim_uint32 band=0; band<NUMBER_OF_INPUT_BANDS; band++)
509 band * CHIP_SIZE_PER_BAND +
510 (chip_clip_rect.
ul().
y - chip_rect.
ul().
y) *
511 SAMPLES_PER_CHIP + chip_clip_rect.
ul().
x -
520 band * TILE_SIZE_PER_BAND +
521 (chip_clip_rect.
ul().
y - tile_rect.
ul().
y) *
527 chip_line <= chip_clip_rect.
lr().
y;
533 chip_sample <= chip_clip_rect.
lr().
x;
542 d[i] = (s[i] << 8) | (s[i] >> 8);
553 s += SAMPLES_PER_CHIP;
561 chip_pt.
x += SAMPLES_PER_CHIP;
565 chip_pt.
y += LINES_PER_CHIP;
569 ulChunkPt.
x += CHUNK_SIDE_SIZE;
573 ulChunkPt.
y += CHUNK_SIDE_SIZE;
595 static const char MODULE[] =
"ossimCcfTileSource::setOutputBandList";
596 if (traceExec())
CLOG <<
"entering..." << endl;
610 cerr << MODULE <<
" ERROR:" 611 <<
"\nOutput band number in list is greater than the " 612 <<
"number of bands in the image source!" 613 <<
"\noutputBandList[" << i <<
"]: " 614 <<
"\nHighest availabe band: " 616 <<
"\nError status has been set! Returning..." 628 if (traceExec())
CLOG <<
"returning..." << endl;
636 const char* prefix)
const 664 static const char MODULE[] =
"ossimCcfTileSource::open";
665 if (traceExec())
CLOG <<
"entering..." << endl;
681 if (traceExec())
CLOG <<
"returning with error..." << endl;
701 cerr << MODULE <<
" ERROR!" 703 <<
"\nReturning..." << endl;
704 if (traceExec())
CLOG <<
"returning with error..." << endl;
732 <<
"\ntheTile:\n" << *
theTile << endl;
735 if (traceExec())
CLOG <<
"returning..." << endl;
794 const vector<ossimIpt>& validImageVertices
806 cout <<
"ossimCcfTileSource::initVerticesFromHeader DEBUG:" 807 <<
"\nValid image vertices:" 827 in.read((
char*)bytes, 3);
831 if(in&&(testEcg ==
"ecg"))
881 if(name ==
"file_type")
892 propertyNames.push_back(
"file_type");
ossim_uint32 samplesPerChip() const
16 bit unsigned integer (15 bits used)
const std::vector< ossimIpt > & getValidImageVertices() const
virtual ossim_uint32 getWidth() const
virtual bool isSourceEnabled() const
vector< ossim_uint32 > theOutputBandList
virtual ossim_uint32 getTileHeight() const
Returns the height of the output tile.
virtual ossim_uint32 getNumberOfBands() const
ossimFilename theImageFile
virtual void setImageRectangle(const ossimIrect &rect)
virtual ossim_uint32 getTileWidth() const
Returns the width of the output tile.
Represents serializable keyword/value map.
std::basic_ifstream< char > ifstream
Class for char input file streams.
virtual ossim_uint32 getNumberOfOutputBands() const
Returns the number of bands in a tile returned from this TileSource.
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
Method to the load (recreate) the state of an object from a keyword list.
ossimScalarType pixelType() const
This code was derived from https://gist.github.com/mshockwave.
ossim_uint32 numberOfReducedResSets() const
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...
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
virtual void close()
Deletes the overview and clears the valid image vertices.
16 bit unsigned integer (13 bits used)
bool intersects(const ossimIrect &rect) const
unsigned short ossim_uint16
ossim_uint32 bytesPerChunk() const
virtual bool isOpen() const
Derived classes must implement this method to be concrete.
virtual void initialize()
Initialize the data buffer.
void ref() const
increment the reference count by one, indicating that this object has another pointer which is refere...
bool fillUcharBuffer(const ossimIrect &tile_rect, const ossimIrect &clip_rect, const ossimIrect &image_rect, ossim_uint32 reduced_res_level, ossimImageData *tile)
Returns true on success, false on error.
bool setOutputBandList(const vector< ossim_uint32 > &outputBandList)
Set the output band list.
virtual ossimRefPtr< ossimImageData > getTile(const ossimIrect &rect, ossim_uint32 resLevel=0)
virtual ossim_uint32 getNumberOfSamples(ossim_uint32 reduced_res_level=0) const
Returns the number of samples in the image.
virtual ~ossimCcfTileSource()
virtual bool isValidRLevel(ossim_uint32 resLevel) const
Determines if the passed in reslution level is valid.
RTTI_DEF1(ossimCcfTileSource, "ossimCcfTileSource", ossimImageHandler)
bool completely_within(const ossimIrect &rect) const
virtual void getPropertyNames(std::vector< ossimString > &propertyNames) const
virtual bool getOverviewTile(ossim_uint32 resLevel, ossimImageData *result)
Method to get an overview tile.
static ossimImageDataFactory * instance()
bool fillBuffer(const ossimIrect &tile_rect, const ossimIrect &clip_rect, const ossimIrect &image_rect, ossim_uint32 reduced_res_level, ossimImageData *tile)
Returns true on success, false on error.
ossim_uint32 chunksInSampleDir(ossim_uint32 reduced_res_level) const
virtual ossimDataObjectStatus validate() const
bool parseCcfHeader(const char *ccf_file)
ossimRefPtr< ossimImageData > theTile
virtual ossim_uint32 getSizePerBand() const
Returns the number of pixels in a single band in a tile.
unsigned int ossim_uint32
virtual ossim_uint32 getNumberOfLines(ossim_uint32 reduced_res_level=0) const
Returns the number of lines in the image.
virtual ossimIrect getImageRectangle() const
virtual ossimString getShortName() const
vector< ossimIpt > theValidImageVertices
virtual ossim_uint32 getNumberOfDecimationLevels() const
Returns the number of reduced resolution data sets (rrds).
const ossimIpt & lr() const
static ossimString downcase(const ossimString &aString)
void initVerticesFromHeader()
ossim_uint32 chipSizePerBand() const
virtual ossimRefPtr< ossimImageData > create(ossimSource *owner, ossimScalarType scalar, ossim_uint32 bands=1) const
ossimErrorCode theErrorStatus
ossimIrect clipToRect(const ossimIrect &rect) const
ossim_uint32 numberOfSamples(ossim_uint32 reduced_res_level) const
std::streampos startOfData(ossim_uint32 reduced_res_level) 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.
void unref() const
decrement the reference count by one, indicating that a pointer to this object is referencing it...
virtual ossimRefPtr< ossimProperty > getProperty(const ossimString &name) const
virtual void makeBlank()
Initializes data to null pixel values.
virtual ossimString getLongName() const
virtual void completeOpen()
Will complete the opening process.
16 bit unsigned integer (11 bits used)
bool fillUshortBuffer(const ossimIrect &tile_rect, const ossimIrect &clip_rect, const ossimIrect &image_rect, ossim_uint32 reduced_res_level, ossimImageData *tile)
Returns true on success, false on error.
ossim_uint8 * theChipBuffer
ossim_uint32 bytesPerChip() const
ossim_uint32 numberOfLines(ossim_uint32 reduced_res_level) const
void adjustToStartOfChunk(ossimIpt &pt) const
Adjust point to even 256 boundary.
This class defines an abstract Handler which all image handlers(loaders) should derive from...
ossim_uint32 linesPerChip() const
virtual const void * getBuf() const
ossim_uint32 lineChipsPerChunk() const
virtual void setErrorStatus() const
ossimIrect imageRect(ossim_uint32 reduced_res_level) const
ossim_uint32 numberOfBands() const
const char * c_str() const
Returns a pointer to a null-terminated array of characters representing the string's contents...
virtual ossimScalarType getOutputScalarType() const
Returns the output pixel type of the tile source.
virtual ossim_uint32 getImageTileHeight() const
Returns the tile width of the image or 0 if the image is not tiled.
ossimFilename & setExtension(const ossimString &e)
Sets the extension of a file name.
ossim_uint32 sampleChipsPerChunk() const
virtual void getPropertyNames(std::vector< ossimString > &propertyNames) const
Gets a list of property names available.
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
Method to save the state of an object to a keyword list.
void adjustToStartOfChip(ossimIpt &pt) const
Adjust point to even 32 boundary.
unsigned char ossim_uint8
virtual ossimRefPtr< ossimProperty > getProperty(const ossimString &name) const
Gets a property for matching name.
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 getImageTileWidth() const
Returns the tile width of the image or 0 if the image is not tiled.
bool isEcgGeom(const ossimFilename &filename) const
16 bit unsigned integer (12 bits used)
virtual ossim_uint32 getNumberOfInputBands() const
Returns the number of bands in the image.