![]() |
ACloudViewer
3.9.4
A Modern Library for 3D Data Processing
|
Raster grid type. More...
#include <ecvRasterGrid.h>
Public Types | |
| enum | ExportableFields { PER_CELL_VALUE, PER_CELL_COUNT, PER_CELL_MIN_VALUE, PER_CELL_MAX_VALUE, PER_CELL_AVG_VALUE, PER_CELL_VALUE_STD_DEV, PER_CELL_VALUE_RANGE, PER_CELL_MEDIAN_VALUE, PER_CELL_PERCENTILE_VALUE, PER_CELL_UNIQUE_COUNT_VALUE, PER_CELL_INVALID } |
| Exportable fields. More... | |
| enum | ProjectionType { PROJ_MINIMUM_VALUE = 0, PROJ_AVERAGE_VALUE = 1, PROJ_MAXIMUM_VALUE = 2, PROJ_MEDIAN_VALUE = 3, PROJ_INVERSE_VAR_VALUE = 4, INVALID_PROJECTION_TYPE = 255 } |
| Types of projection. More... | |
| enum | InterpolationType { InterpolationType::NONE = 0, InterpolationType::DELAUNAY = 1 } |
| Types of interpolation. More... | |
| enum | EmptyCellFillOption { LEAVE_EMPTY = 0, FILL_MINIMUM_HEIGHT = 1, FILL_MAXIMUM_HEIGHT = 2, FILL_CUSTOM_HEIGHT = 3, FILL_AVERAGE_HEIGHT = 4, INTERPOLATE_DELAUNAY = 5, KRIGING = 6 } |
| Option for handling empty cells. More... | |
| using | Row = std::vector< ccRasterCell > |
| Row. More... | |
| using | SF = std::vector< double > |
| Scalar field. More... | |
Public Member Functions | |
| ccRasterGrid () | |
| Default constructor. More... | |
| virtual | ~ccRasterGrid () |
| Destructor. More... | |
| bool | init (unsigned w, unsigned h, double gridStep, const CCVector3d &minCorner) |
| Initializes / resets the grid. More... | |
| void | clear () |
| Clears the grid. More... | |
| void | reset () |
| Resets the grid. More... | |
| ccPointCloud * | convertToCloud (const std::vector< ExportableFields > &exportedFields, bool interpolateSF, bool interpolateColors, bool resampleInputCloudXY, bool resampleInputCloudZ, ccGenericPointCloud *inputCloud, unsigned char Z, const ccBBox &box, bool fillEmptyCells, double emptyCellsHeight, bool exportToOriginalCS) const |
| Converts the grid to a cloud with scalar field(s) More... | |
| bool | fillWith (ccGenericPointCloud *cloud, unsigned char projectionDimension, ProjectionType projectionType, bool interpolateEmptyCells, ProjectionType sfInterpolation=INVALID_PROJECTION_TYPE, ecvProgressDialog *progressDialog=nullptr) |
| Fills the grid with a point cloud. More... | |
| void | fillEmptyCells (EmptyCellFillOption fillEmptyCellsStrategy, double customCellHeight=0) |
| Fills the empty cell (for all strategies but 'INTERPOLATE_DELAUNAY') More... | |
| unsigned | updateNonEmptyCellCount () |
| Updates the number of non-empty cells. More... | |
| void | updateCellStats () |
| Updates the statistics about the cells. More... | |
| void | setValid (bool state) |
| Sets valid. More... | |
| bool | isValid () const |
| Returns whether the grid is 'valid' or not. More... | |
| std::pair< int, int > | computeCellPos (const CCVector3 &P, unsigned char X, unsigned char Y) const |
| Computes the position of the cell that includes a given point. More... | |
| CCVector2d | computeCellCenter (int i, int j, unsigned char X, unsigned char Y) const |
| Computes the position of the center of a given cell. More... | |
Static Public Member Functions | |
| static bool | ComputeGridSize (unsigned char Z, const ccBBox &box, double gridStep, unsigned &width, unsigned &height) |
| Computes the raster size for a given bounding-box. More... | |
| static QString | GetDefaultFieldName (ExportableFields field) |
| Returns the default name of a given field. More... | |
| static InterpolationType | InterpolationTypeFromEmptyCellFillOption (EmptyCellFillOption option) |
Public Attributes | |
| std::vector< Row > | rows |
| All cells. More... | |
| std::vector< SF > | scalarFields |
| Associated scalar fields. More... | |
| unsigned | width |
| Number of columns. More... | |
| unsigned | height |
| Number of rows. More... | |
| double | gridStep |
| Grid step ('pixel' size) More... | |
| CCVector3d | minCorner |
| Min corner (3D) More... | |
| double | minHeight |
| Min height (computed on the NON-EMPTY or INTERPOLATED cells) More... | |
| double | maxHeight |
| Max height (computed on the NON-EMPTY or INTERPOLATED cells) More... | |
| double | meanHeight |
| Average height (computed on the NON-EMPTY or INTERPOLATED cells) More... | |
| unsigned | nonEmptyCellCount |
| Number of NON-EMPTY cells. More... | |
| unsigned | validCellCount |
| Number of VALID cells. More... | |
| bool | hasColors |
| Whether the (average) colors are available or not. More... | |
| bool | valid |
| Whether the grid is valid/up-to-date. More... | |
Raster grid type.
| using ccRasterGrid::Row = std::vector<ccRasterCell> |
Row.
| using ccRasterGrid::SF = std::vector<double> |
Scalar field.
|
strong |
| ccRasterGrid::ccRasterGrid | ( | ) |
Default constructor.
|
virtual |
Destructor.
References clear().
| void ccRasterGrid::clear | ( | ) |
Clears the grid.
References hasColors, height, maxHeight, meanHeight, minHeight, nonEmptyCellCount, rows, scalarFields, setValid(), validCellCount, and width.
Referenced by init(), and ~ccRasterGrid().
|
inline |
Computes the position of the center of a given cell.
References Tuple3Tpl< Type >::u, and X.
Referenced by define_ccRasterGrid().
|
inline |
Computes the position of the cell that includes a given point.
References Vector3Tpl< double >::fromArray(), Tuple3Tpl< Type >::u, and X.
Referenced by define_ccRasterGrid().
|
static |
Computes the raster size for a given bounding-box.
References Vector3Tpl< double >::fromArray(), gridStep, cloudViewer::BoundingBoxTpl< T >::isValid(), cloudViewer::BoundingBoxTpl< T >::maxCorner(), cloudViewer::BoundingBoxTpl< T >::minCorner(), Tuple3Tpl< Type >::u, CVLog::Warning(), and X.
Referenced by define_ccRasterGrid(), cc2Point5DimEditor::getGridSize(), CommandRasterize::process(), and CommandVolume25D::process().
| ccPointCloud * ccRasterGrid::convertToCloud | ( | const std::vector< ExportableFields > & | exportedFields, |
| bool | interpolateSF, | ||
| bool | interpolateColors, | ||
| bool | resampleInputCloudXY, | ||
| bool | resampleInputCloudZ, | ||
| ccGenericPointCloud * | inputCloud, | ||
| unsigned char | Z, | ||
| const ccBBox & | box, | ||
| bool | fillEmptyCells, | ||
| double | emptyCellsHeight, | ||
| bool | exportToOriginalCS | ||
| ) | const |
Converts the grid to a cloud with scalar field(s)
References cloudViewer::ScalarField::addElement(), cloudViewer::PointCloudTpl< T >::addPoint(), cloudViewer::ReferenceCloud::addPointIndex(), ccPointCloud::addRGBColor(), ccPointCloud::addScalarField(), ccRasterCell::avgHeight, ecvColor::black(), cloudViewer::PointCloudTpl< T >::capacity(), ccRasterCell::color, ccScalarField::computeMinAndMax(), cloudViewer::ScalarField::currentSize(), CVLog::Error(), fillEmptyCells(), ccPointCloud::From(), GetDefaultFieldName(), cloudViewer::ScalarField::getName(), ccObject::getName(), cloudViewer::PointCloudTpl< T >::getNumberOfScalarFields(), cloudViewer::PointCloudTpl< T >::getPoint(), cloudViewer::PointCloudTpl< T >::getScalarField(), cloudViewer::PointCloudTpl< T >::getScalarFieldIndexByName(), gridStep, ccRasterCell::h, hasColors, ccPointCloud::hasColors(), height, ccScalarField::importParametersFrom(), ccEntityAction::interpolateColors(), ccObject::isA(), isValid(), cloudViewer::BoundingBoxTpl< T >::isValid(), ccRasterCell::maxHeight, cloudViewer::BoundingBoxTpl< T >::minCorner(), ccRasterCell::minHeight, cloudViewer::ScalarField::NaN(), NAN_VALUE, ccRasterCell::nbPoints, nonEmptyCellCount, PER_CELL_AVG_VALUE, PER_CELL_COUNT, PER_CELL_MAX_VALUE, PER_CELL_MEDIAN_VALUE, PER_CELL_MIN_VALUE, PER_CELL_PERCENTILE_VALUE, PER_CELL_UNIQUE_COUNT_VALUE, PER_CELL_VALUE, PER_CELL_VALUE_RANGE, PER_CELL_VALUE_STD_DEV, CV_TYPES::POINT_CLOUD, ccRasterCell::pointIndex, cloudViewer::ReferenceCloud::reserve(), ccPointCloud::reserve(), ccPointCloud::reserveTheRGBTable(), cloudViewer::ScalarField::resizeSafe(), rows, scalarFields, ccObject::setName(), ccGenericPointCloud::setPointSize(), cloudViewer::ScalarField::setValue(), cloudViewer::GenericCloud::size(), cloudViewer::PointCloudTpl< T >::size(), cloudViewer::ReferenceCloud::size(), size, ccRasterCell::stdDevHeight, Tuple3Tpl< Type >::u, ccPointCloud::unallocateColors(), validCellCount, CVLog::Warning(), width, X, Tuple3Tpl< Type >::x, Tuple3Tpl< Type >::y, and Tuple3Tpl< Type >::z.
Referenced by cc2Point5DimEditor::convertGridToCloud(), ccVolumeCalcTool::ConvertGridToCloud(), define_ccRasterGrid(), and CommandRasterize::process().
| void ccRasterGrid::fillEmptyCells | ( | EmptyCellFillOption | fillEmptyCellsStrategy, |
| double | customCellHeight = 0 |
||
| ) |
Fills the empty cell (for all strategies but 'INTERPOLATE_DELAUNAY')
References FILL_AVERAGE_HEIGHT, FILL_CUSTOM_HEIGHT, FILL_MAXIMUM_HEIGHT, FILL_MINIMUM_HEIGHT, height, INTERPOLATE_DELAUNAY, LEAVE_EMPTY, maxHeight, meanHeight, minHeight, rows, and width.
Referenced by ccVolumeCalcTool::ComputeVolume(), convertToCloud(), define_ccRasterGrid(), and CommandRasterize::process().
| bool ccRasterGrid::fillWith | ( | ccGenericPointCloud * | cloud, |
| unsigned char | projectionDimension, | ||
| ProjectionType | projectionType, | ||
| bool | interpolateEmptyCells, | ||
| ProjectionType | sfInterpolation = INVALID_PROJECTION_TYPE, |
||
| ecvProgressDialog * | progressDialog = nullptr |
||
| ) |
Fills the grid with a point cloud.
Since version 2.8, we now use the "PixelIsArea" convention by default (as GDAL) This means that the height is computed at the center of the grid cell.
References ccRasterCell::avgHeight, ecvColor::RgbTpl< Type >::b, cloudViewer::Delaunay2dMesh::buildMesh(), ccRasterCell::color, Vector3Tpl< double >::fromArray(), ecvColor::RgbTpl< Type >::g, cloudViewer::Delaunay2dMesh::getNextTriangleVertIndexes(), cloudViewer::PointCloudTpl< T >::getNumberOfScalarFields(), cloudViewer::GenericIndexedCloud::getPoint(), ccGenericPointCloud::getPointColor(), cloudViewer::PointCloudTpl< T >::getScalarField(), cloudViewer::ScalarField::getValue(), gridStep, ccRasterCell::h, ccDrawableObject::hasColors(), hasColors, ccPointCloud::hasScalarFields(), height, cloudViewer::VerticesIndexes::i, INVALID_PROJECTION_TYPE, ccObject::isA(), ccRasterCell::maxHeight, maxHeight, meanHeight, minCorner, ccRasterCell::minHeight, minHeight, ccRasterCell::nbPoints, nonEmptyCellCount, nProgress, cloudViewer::NormalizedProgress::oneStep(), cloudViewer::Delaunay2dMesh::placeIteratorAtBeginning(), CV_TYPES::POINT_CLOUD, ccRasterCell::pointIndex, PROJ_AVERAGE_VALUE, PROJ_MAXIMUM_VALUE, PROJ_MINIMUM_VALUE, ecvColor::RgbTpl< Type >::r, rows, scalarFields, ecvProgressDialog::setInfo(), ecvProgressDialog::setMethodTitle(), setValid(), cloudViewer::GenericCloud::size(), cloudViewer::Delaunay2dMesh::size(), size, ecvProgressDialog::start(), ccRasterCell::stdDevHeight, Tuple3Tpl< Type >::u, cloudViewer::Delaunay2dMesh::USE_ALL_POINTS, validCellCount, cloudViewer::ScalarField::ValidValue(), CVLog::Warning(), width, Vector2Tpl< Type >::x, X, and Vector2Tpl< Type >::y.
Referenced by ccVolumeCalcTool::ComputeVolume(), define_ccRasterGrid(), CommandRasterize::process(), and ccRasterizeTool::updateGrid().
|
static |
Returns the default name of a given field.
References s_defaultFieldNames.
Referenced by ccRasterizeTool::ccRasterizeTool(), convertToCloud(), and define_ccRasterGrid().
| bool ccRasterGrid::init | ( | unsigned | w, |
| unsigned | h, | ||
| double | gridStep, | ||
| const CCVector3d & | minCorner | ||
| ) |
Initializes / resets the grid.
References clear(), gridStep, height, minCorner, rows, and width.
Referenced by ccVolumeCalcTool::ComputeVolume(), CommandRasterize::process(), and ccRasterizeTool::updateGrid().
|
static |
Converts the empty cells fill option to the corresponding interpolation type
|
inline |
Returns whether the grid is 'valid' or not.
Referenced by ccRasterizeTool::convertGridToCloud(), convertToCloud(), define_ccRasterGrid(), ccVolumeCalcTool::exportGridAsCloud(), ccRasterizeTool::generateASCIIMatrix(), ccRasterizeTool::generateCloud(), ccRasterizeTool::generateContours(), ccRasterizeTool::generateHillshade(), ccRasterizeTool::generateImage(), ccRasterizeTool::generateRaster(), and cc2Point5DimEditor::update2DDisplayZoom().
| void ccRasterGrid::reset | ( | ) |
Resets the grid.
References hasColors, maxHeight, meanHeight, minHeight, nonEmptyCellCount, rows, setValid(), and validCellCount.
Referenced by define_ccRasterGrid().
|
inline |
Sets valid.
Referenced by clear(), ccVolumeCalcTool::ComputeVolume(), define_ccRasterGrid(), fillWith(), and reset().
| void ccRasterGrid::updateCellStats | ( | ) |
Updates the statistics about the cells.
References height, maxHeight, meanHeight, minHeight, rows, validCellCount, and width.
Referenced by define_ccRasterGrid().
| unsigned ccRasterGrid::updateNonEmptyCellCount | ( | ) |
Updates the number of non-empty cells.
References height, nonEmptyCellCount, rows, and width.
Referenced by define_ccRasterGrid().
| double ccRasterGrid::gridStep |
Grid step ('pixel' size)
Referenced by ComputeGridSize(), ccVolumeCalcTool::ComputeVolume(), convertToCloud(), define_ccRasterGrid(), ccRasterizeTool::ExportGeoTiff(), fillWith(), ccRasterizeTool::generateContours(), ccRasterizeTool::generateHillshade(), init(), cc2Point5DimEditor::update2DDisplayZoom(), and ccRasterizeTool::updateGrid().
| bool ccRasterGrid::hasColors |
Whether the (average) colors are available or not.
Referenced by clear(), convertToCloud(), define_ccRasterGrid(), fillWith(), ccRasterizeTool::generateRaster(), and reset().
| unsigned ccRasterGrid::height |
Number of rows.
Referenced by clear(), ccVolumeCalcTool::ComputeVolume(), convertToCloud(), define_ccRasterGrid(), ccRasterizeTool::ExportGeoTiff(), fillEmptyCells(), fillWith(), ccRasterizeTool::generateASCIIMatrix(), ccRasterizeTool::generateContours(), ccRasterizeTool::generateHillshade(), ccRasterizeTool::generateImage(), ccRasterizeTool::generateRaster(), ccRasterizeTool::getFillEmptyCellsStrategyExt(), init(), CommandRasterize::process(), cc2Point5DimEditor::update2DDisplayZoom(), updateCellStats(), ccRasterizeTool::updateGrid(), and updateNonEmptyCellCount().
| double ccRasterGrid::maxHeight |
Max height (computed on the NON-EMPTY or INTERPOLATED cells)
Referenced by clear(), ccVolumeCalcTool::ComputeVolume(), ccRasterizeTool::convertGridToCloud(), define_ccRasterGrid(), ccRasterizeTool::ExportGeoTiff(), fillEmptyCells(), fillWith(), ccRasterizeTool::generateASCIIMatrix(), ccRasterizeTool::generateImage(), ccRasterizeTool::getFillEmptyCellsStrategyExt(), CommandRasterize::process(), reset(), updateCellStats(), and ccRasterizeTool::updateGrid().
| double ccRasterGrid::meanHeight |
Average height (computed on the NON-EMPTY or INTERPOLATED cells)
Referenced by clear(), define_ccRasterGrid(), ccRasterizeTool::ExportGeoTiff(), fillEmptyCells(), fillWith(), ccRasterizeTool::getFillEmptyCellsStrategyExt(), reset(), and updateCellStats().
| CCVector3d ccRasterGrid::minCorner |
Min corner (3D)
Referenced by define_ccRasterGrid(), fillWith(), and init().
| double ccRasterGrid::minHeight |
Min height (computed on the NON-EMPTY or INTERPOLATED cells)
Referenced by clear(), ccVolumeCalcTool::ComputeVolume(), ccRasterizeTool::convertGridToCloud(), define_ccRasterGrid(), ccRasterizeTool::ExportGeoTiff(), fillEmptyCells(), fillWith(), ccRasterizeTool::generateASCIIMatrix(), ccRasterizeTool::generateImage(), ccRasterizeTool::getFillEmptyCellsStrategyExt(), CommandRasterize::process(), reset(), updateCellStats(), and ccRasterizeTool::updateGrid().
| unsigned ccRasterGrid::nonEmptyCellCount |
Number of NON-EMPTY cells.
Referenced by clear(), ccVolumeCalcTool::ComputeVolume(), convertToCloud(), define_ccRasterGrid(), fillWith(), reset(), and updateNonEmptyCellCount().
| std::vector<Row> ccRasterGrid::rows |
All cells.
Referenced by clear(), ccVolumeCalcTool::ComputeVolume(), convertToCloud(), ccRasterizeTool::ExportGeoTiff(), fillEmptyCells(), fillWith(), ccRasterizeTool::generateASCIIMatrix(), ccRasterizeTool::generateContours(), ccRasterizeTool::generateHillshade(), ccRasterizeTool::generateImage(), init(), reset(), updateCellStats(), ccRasterizeTool::updateGrid(), and updateNonEmptyCellCount().
| std::vector<SF> ccRasterGrid::scalarFields |
Associated scalar fields.
Referenced by clear(), convertToCloud(), ccRasterizeTool::ExportGeoTiff(), fillWith(), and ccRasterizeTool::generateRaster().
| bool ccRasterGrid::valid |
Whether the grid is valid/up-to-date.
Referenced by define_ccRasterGrid().
| unsigned ccRasterGrid::validCellCount |
Number of VALID cells.
Referenced by clear(), ccVolumeCalcTool::ComputeVolume(), convertToCloud(), define_ccRasterGrid(), ccRasterizeTool::ExportGeoTiff(), fillWith(), ccRasterizeTool::getFillEmptyCellsStrategyExt(), reset(), and updateCellStats().
| unsigned ccRasterGrid::width |
Number of columns.
Referenced by clear(), ccVolumeCalcTool::ComputeVolume(), convertToCloud(), define_ccRasterGrid(), ccRasterizeTool::ExportGeoTiff(), fillEmptyCells(), fillWith(), ccRasterizeTool::generateASCIIMatrix(), ccRasterizeTool::generateContours(), ccRasterizeTool::generateHillshade(), ccRasterizeTool::generateImage(), ccRasterizeTool::generateRaster(), ccRasterizeTool::getFillEmptyCellsStrategyExt(), init(), CommandRasterize::process(), cc2Point5DimEditor::update2DDisplayZoom(), updateCellStats(), ccRasterizeTool::updateGrid(), and updateNonEmptyCellCount().