32 static ossimTrace traceDebug(
"ossimPointCloudImageHandler:debug");
33 static const char* GSD_FACTOR_KW =
"gsd_factor";
34 static const char* COMPONENT_KW =
"component";
38 static const char* INTENSITY_KW =
"INTENSITY";
39 static const char* HIGHEST_KW =
"HIGHEST";
40 static const char* LOWEST_KW =
"LOWEST";
41 static const char* RETURNS_KW =
"RETURNS";
42 static const char* RGB_KW =
"RGB";
236 const ossimIpt tile_offset (img_tile_rect.
ul());
242 ossimDpt dpt_ul (img_tile_rect.
ul().
x - 0.5, img_tile_rect.
ul().
y - 0.5);
243 ossimDpt dpt_lr (img_tile_rect.
lr().
x + 0.5, img_tile_rect.
lr().
y + 0.5);
254 <<
"ossimPointCloudImageHandler::getTile() ERROR: \n" 255 <<
"More bands were requested than was available from the point cloud source. Returning " 256 <<
"blank tile." << endl;
260 std::map<ossim_int32, PcrBucket*> accumulator;
275 pos = pointBlock[id]->getPosition();
277 ipt.
x = ossim::round<double,double>(ipt.
x) - tile_offset.x;
278 ipt.
y = ossim::round<double,double>(ipt.
y) - tile_offset.y;
281 if ((bucketIndex >= 0) && (bucketIndex < (
ossim_int32)tile_size))
282 addSample(accumulator, bucketIndex, pointBlock[
id]);
285 #else // using getFileBlock 300 pos = pointBlock[id]->getPosition();
304 ipt.
x = ossim::round<double,double>(ipt.
x) - tile_offset.x;
305 ipt.
y = ossim::round<double,double>(ipt.
y) - tile_offset.y;
308 if ((bucketIndex >= 0) && (bucketIndex < (
ossim_int32)tile_size))
309 addSample(accumulator, bucketIndex, pointBlock[
id]);
312 }
while (pointBlock.
size() == numPoints);
319 std::map<ossim_int32, PcrBucket*>::iterator accum_iter;
330 accum_iter = accumulator.find(index);
331 if (accum_iter != accumulator.end())
332 buf[band][index] = accum_iter->second->m_bucket[band];
334 buf[band][index] = null_pixel;
343 auto pcr_iter = accumulator.begin();
344 while (pcr_iter != accumulator.end())
346 delete pcr_iter->second;
364 auto iter = accumulator.find(index);
365 if (iter == accumulator.end())
378 accumulator[index] =
new PcrBucket(color, 3);
408 iter->second->m_numSamples++;
423 auto iter = accumulator.begin();
425 while (iter != accumulator.end())
427 for (
int i=0; i<numBands; i++)
429 avg = iter->second->m_bucket[i] / iter->second->m_numSamples;
430 iter->second->m_bucket[i] = avg;
459 result = image_size.
line;
461 result = (result >> resLevel);
472 result = image_size.
samp;
474 result = (result >> resLevel);
513 entryList.emplace_back(i);
567 return ossimString(
"ossim point cloud to image renderer");
592 while (largestImageDimension > STOP_DIMENSION)
594 largestImageDimension /= 2;
619 ossim_float64 d = std::pow(2.0, static_cast<double>(resLevel));
645 image_size.
x = ossim::round<ossim_int32,double>(ipt_lr.
x - ipt_ul.
x) + 1;
646 image_size.
y = ossim::round<ossim_int32,double>(ipt_lr.
y - ipt_ul.
y) + 1;
653 static const char MODULE[] =
"ossimPointCloudImageHandler::saveState()";
659 <<
" ERROR detected in keyword list! State not saved." << std::endl;
671 static const char MODULE[] =
"ossimPointCloudImageHandler::loadState()";
680 <<
"WARNING: error detected in keyword list! State not load." << std::endl;
698 bool good_open =
open();
707 validVertices.clear();
712 divisor = resLevel<<1;
719 validVertices.emplace_back(r0Pt);
721 validVertices.emplace_back(r0Pt);
723 validVertices.emplace_back(r0Pt);
725 validVertices.emplace_back(r0Pt);
729 for (
int i=3; i>=0; i--)
730 validVertices.emplace_back(validVertices[i]/divisor);
731 validVertices.erase(validVertices.begin(), validVertices.begin()+4);
737 if (!property.
valid())
741 property->valueToString(s);
752 else if ( property->
getName() == GSD_FACTOR_KW )
767 else if ( property->
getName() == COMPONENT_KW )
792 else if ( name == GSD_FACTOR_KW )
800 else if ( name == COMPONENT_KW )
void getValidImageVertices(std::vector< ossimIpt > &validVertices, ossimVertexOrdering ordering, ossim_uint32 resLevel) const override
ordering specifies how the vertices should be arranged.
ossimRefPtr< ossimImageGeometry > theGeometry
virtual ossim_uint32 getNumPoints() const =0
Returns the total number of points in the dataset (not just the block returned in getPoints) ...
void setProjection(ossimProjection *projection)
Sets the projection to be used for local-to-world coordinate transformation.
static ossimString upcase(const ossimString &aString)
virtual ossim_uint32 getNumberOfBands() const
ossimFilename theImageFile
virtual void setImageRectangle(const ossimIrect &rect)
ossimRefPtr< ossimProperty > getProperty(const ossimString &name) const override
const ossimIpt & getImageSize() const
ossimRefPtr< ossimPointCloudHandler > m_pch
void getEntryNames(std::vector< ossimString > &entryNames) const override
Represents serializable keyword/value map.
ossimRefPtr< ossimImageData > m_tile
virtual ossim_uint32 getNumberOfOutputBands() const
Returns the number of bands in a tile returned from this TileSource.
const char * find(const char *key) const
std::vector< ossimDpt > theDecimationFactors
ossimScalarType getOutputScalarType() const override
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
Method to the load (recreate) the state of an object from a keyword list.
ossim_uint32 getNumberOfSamples(ossim_uint32 resLevel=0) const override
Gets samples.
virtual ~ossimPointCloudImageHandler()
ossim_float32 getField(FIELD_CODES fc) const
Return the float value of the requested field.
virtual void setOrigin(const ossimGpt &origin)
Sets theOrigin to origin.
ossim_uint32 height() const
bool loadState(const ossimKeywordlist &kwl, const char *prefix) override
Method to the load (recreate) the state of an object from a keyword list.
Class used for rendering point cloud data into a raster tile.
static ossimString toString(bool aValue)
Numeric to string methods.
bool setPointCloudHandler(ossimPointCloudHandler *pch)
Permits backdoor for setting the input point cloud handler object.
OSSIM_DLL void defaultTileSize(ossimIpt &tileSize)
ossim_uint32 getNumberOfLines(ossim_uint32 resLevel=0) const override
Gets lines.
const ossimIpt & ul() const
virtual ossimDataObjectStatus getDataObjectStatus() const
virtual void getBounds(ossimGrect &bounds) const
ossim_float64 hgt
Height in meters above the ellipsiod.
static const ossimErrorCode OSSIM_ERROR
ossim_uint32 toUInt32() const
double getNullPixelValue(ossim_uint32 band) const override
ossimRefPtr< ossimImageData > getTile(const ossimIrect &rect, ossim_uint32 resLevel=0) override
Returns a pointer to a tile given an origin representing the upper left corner of the tile to grab fr...
virtual void setProperty(ossimRefPtr< ossimProperty > property)
void setImageSize(const ossimIpt &size)
void getGSD(ossimDpt &gsd, ossim_uint32 resLevel) const
Get the GSD for resLevel.
std::vector< ossimString > m_componentNames
virtual bool isOpen() const
is open method.
RTTI_DEF1(ossimPointCloudImageHandler, "ossimPointCloudImageHandler", ossimImageHandler)
virtual void initialize()
Initialize the data buffer.
virtual void setMetersPerPixel(const ossimDpt &gsd)
virtual void clear()
Resets any storage to empty.
virtual ossimPointCloudHandler * open(const ossimFilename &fileName) const
ossim_float64 widthMeters() const
Returns the width of a rectangle in meters using the center lat for scaling EW direction.
ossim_uint32 componentToFieldCode() const
ossim_uint32 getTileHeight() const override
ossimRefPtr< ossimImageGeometry > getImageGeometry() override
Returns the image geometry object associated with this tile source or NULL if non defined...
void add(const char *prefix, const ossimKeywordlist &kwl, bool overwrite=true)
virtual bool open()
open method.
bool pointWithin(const ossimGpt &gpt, bool considerHgt=false) const
METHOD: pointWithin(ossimGpt)
virtual void setNullPix(ossim_float64 null_pix)
ossim_uint32 getNumberOfInputBands() const override
Gets bands.
static ossim_uint32 DEFAULT_BLOCK_SIZE
void addSample(std::map< ossim_int32, PcrBucket *> &accumulator, ossim_int32 index, const ossimPointRecord *sample)
ossim_uint32 getNumberOfDecimationLevels() const override
virtual ossimDataObjectStatus validate() const
void setGSD(const ossim_float64 &gsd)
Sets m_gsd data member and projection if projection is set.
ossim_uint32 getImageTileWidth() const override
Gets tile width.
unsigned int ossim_uint32
ossim_float64 toFloat64() const
const ossimGpt & ul() const
ossimString getShortName() const override
virtual ossimIrect getImageRectangle() const
double getMaxPixelValue(ossim_uint32 band) const override
const ossimIpt & lr() const
virtual void close()
Deletes the overview and clears the valid image vertices.
void rnToWorld(const ossimDpt &rnPt, ossim_uint32 resolutionLevel, ossimGpt &wpt) const
rnToWorld is a utility method that takes a rn resolution image point and maps it to the world point...
void worldToRn(const ossimGpt &wpt, ossim_uint32 resolutionLevel, ossimDpt &rnPt) const
worldToRn is a utility method that takes a world point allows one to transform all the way back to an...
bool setCurrentEntry(ossim_uint32 entryIdx) override
ossim_uint32 width() const
virtual ossim_uint32 size() const
Returns allocated size.
double getMinPixelValue(ossim_uint32 band) const override
Container class that holds both 2D transform and 3D projection information for an image Only one inst...
virtual const ossimPointRecord * getMaxPoint() const
virtual const ossim_float32 * getFloatBuf() const
void setProperty(ossimRefPtr< ossimProperty > property) override
The reader properties are: – the GSD ("meters_per_pixel") which overrides computed nominal GSD – th...
static ossimPointCloudHandlerRegistry * instance()
ossimPointCloudImageHandler()
static const char * ENTRY_KW
virtual ossimRefPtr< ossimImageGeometry > getExternalImageGeometry() const
Returns the image geometry object associated with this tile source or NULL if non defined...
virtual ossimRefPtr< ossimProperty > getProperty(const ossimString &name) const
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).
virtual void completeOpen()
Will complete the opening process.
ossimString getLongName() const override
virtual void getBlock(const ossimGrect &bounds, ossimPointBlock &block) const
Fetches the block of points inside the block bounds.
Components m_activeComponent
ossim_float64 m_gsdFactor
virtual void rewind() const
virtual void setMaxPix(ossim_float64 max_pix)
This class defines an abstract Handler which all image handlers(loaders) should derive from...
virtual ossimErrorCode getErrorStatus() const
void getEntryList(std::vector< ossim_uint32 > &entryList) const override
Gets entry list.
bool saveState(ossimKeywordlist &kwl, const char *prefix) const override
Method to save the state of an object to a keyword list.
ossim_uint32 getTileWidth() const override
static const char * METERS_PER_PIXEL_KW
ossim_uint32 area() const
virtual const ossimPointRecord * getMinPoint() const
Assigns the two points with fields representing the extremes of the dataset.
virtual ossimProjection * createProjection(const ossimFilename &filename, ossim_uint32 entryIdx) const
STUB. Not implemented.
#define OSSIM_DEFAULT_NULL_PIX_FLOAT
ossim_float64 heightMeters() const
Returns the height of a rectangle in meters.
virtual void setUlTiePoints(const ossimGpt &gpt)
bool worldToLocal(const ossimGpt &world_pt, ossimDpt &local_pt) const
Exposes the 3D world-to-local image coordinate reverse projection.
const ossimGpt & getPosition() const
Returns the 3D position vector in the dataset's coodinate reference system (available from the ossimP...
Base class for all point-cloud file readers.
void setFieldCode(ossim_uint32 code)
Initializes the desired fields to be stored.
void normalize(std::map< ossim_int32, PcrBucket *> &accumulator)
virtual void close()
Close method.
virtual void close()=0
Closes the point cloud file(s).
virtual void setMinPix(ossim_float64 min_pix)
const ossimGpt & lr() const
ossim_uint32 getImageTileHeight() const override
Gets tile height.
static ossimEpsgProjectionFactory * instance()
Implements singleton pattern.
virtual void getNextFileBlock(ossimPointBlock &block, ossim_uint32 maxNumPoints=0xFFFFFFFF) const
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.
const ossimString & getName() const
ossim_uint32 getCurrentEntry() const override
bool isnan(const float &v)
isnan Test for floating point Not A Number (NAN) value.