9. Scalar Fields
9.1. ccScalarField
All the inherited members are given here for convenience. Most of the time, this class is used rather than the bases classes.
- class cloudComPy.ccScalarField
Bases:
ScalarField
A scalar field associated to display-related parameters. Extends the CCCoreLib::ScalarField object.
- __init__(self: _cloudComPy.ccScalarField, name: str = None) None
Default constructor
- Parameters:
name (string,optional) – scalarField name
- addElement(self: _cloudComPy.ScalarField, arg0: float) None
Add a value at the end of the vector.
- Parameters:
value (float) – the value to add
- computeMeanAndVariance(self: _cloudComPy.ScalarField) tuple
Returns a tuple (mean, variance).
- Returns:
(mean, variance)
- Return type:
tuple
- computeMinAndMax(self: _cloudComPy.ScalarField) None
Should be called before getMin or getMax, for instance after modifying the scalar field with Numpy.
No return!
- currentSize(self: _cloudComPy.ScalarField) int
Returns the vector size.
- Returns:
the vector size
- Return type:
int
- fill(self: _cloudComPy.ScalarField, arg0: float) None
Fills the array with a particular value.
- Parameters:
value (float) – the value to use to fill the array
- flagValueAsInvalid(self: _cloudComPy.ScalarField, arg0: int) None
Sets the value as ‘invalid’ (i.e. CCCoreLib::NAN_VALUE).
No check on index validity!
- Parameters:
index (int) – the index in the ScalarField to set as ‘invalid’
- fromNpArrayCopy(self: _cloudComPy.ScalarField, arg0: numpy.ndarray[numpy.float32]) None
Copy data from numpy array into an existing ScalarField.
Checks if the numpy array is of PyScalarType, one dimension, same size as the ScalarField, before overwriting ScalarField data.
- Parameters:
nparray (ndarray) – the data source to use to overwrite the ScalarField
- getGlobalShift(self: _cloudComPy.ccScalarField) float
Returns Global Shift if any. Used for instance for LAS GPS time shift
- Returns:
global shift
- Return type:
float
- getMax(self: _cloudComPy.ScalarField) float
Returns maximal value of the ScalarField.
You should call computeMinAndMax before, after a modification of the ScalarField with Numpy!
- Returns:
max value
- Return type:
float
- getMin(self: _cloudComPy.ScalarField) float
Returns minimal value of the ScalarField.
You should call call computeMinAndMax before, after a modification of the ScalarField with Numpy!
- Returns:
min value
- Return type:
float
- getName(self: _cloudComPy.ScalarField) str
Returns the name of the ScalarField.
- Returns:
ScalarField name
- Return type:
str
- getValue(*args, **kwargs)
Overloaded function.
getValue(self: _cloudComPy.ScalarField, arg0: int) -> float
Returns the ScalarField value at a given index.
No check on index validity!
- Parameters:
index (int) – the index
- Returns:
value at index
- Return type:
float
getValue(self: _cloudComPy.ScalarField, arg0: int) -> float
Returns the ScalarField value at a given index.
No check on index validity!
- Parameters:
index (int) – the index
- Returns:
value at index
- Return type:
float
- isSerializable(self: _cloudComPy.ccScalarField) bool
- reserveSafe(self: _cloudComPy.ScalarField, arg0: int) bool
Reserves memory (no exception thrown).
- Parameters:
count (int) – number of elements to reserve in the ScalarField
- Returns:
success
- Return type:
bool
- resizeSafe(self: _cloudComPy.ScalarField, arg0: int, arg1: bool, arg2: float) bool
Resizes memory (no exception thrown).
- Parameters:
count (int) – number of elements to keep/reserve in the ScalarField
init (bool) – whether to initialize new elements
value (float) – value for new elements
- Returns:
success
- Return type:
bool
- setColorScale(self: _cloudComPy.ccScalarField, arg0: _cloudComPy.ccColorScale) None
Sets associated color scale
- Parameters:
scale (ccColorScale) – the color scale
- setName(self: _cloudComPy.ScalarField, arg0: str) None
Sets the name of the ScalarField. No control is done on the uniqueness of the name. It is your responsability to ensure this uniqueness.
- Parameters:
name (str) – new name for the ScalarField
- setValue(self: _cloudComPy.ScalarField, arg0: int, arg1: float) None
Set the value at the given index.
No check on index validity!
- Parameters:
index (int) – index in the ScalarField
value (float) – value to set at index
- swap(self: _cloudComPy.ScalarField, arg0: int, arg1: int) None
Swap values between two indices.
No check on indices validity!
- Parameters:
index1 (int) – first index
index2 (int) – second index
- toNpArray(self: _cloudComPy.ScalarField) numpy.ndarray
Wrap the ScalarField data into a numpy Array.
Returns a numpy array: a one dimension array of (number of Points). Data is not copied, the numpy array object does not own the data.
WARNING No automatic action on the Python side on the variables referencing the C++ object in case of destruction!
- Returns:
numpy Array pointing to the ScalarField data
- Return type:
ndarray
- toNpArrayCopy(self: _cloudComPy.ScalarField) numpy.ndarray
Wrap the ScalarField data into a numpy Array.
Returns a numpy array: a one dimension array of (number of Points). Data is copied, the numpy array object owns its data. Ownership is transfered to Python: the numpy array object and its data will be handled by the Python Garbage Collector.
- Returns:
numpy Array with data copied from the ScalarField data
- Return type:
ndarray
9.2. bases classes for ccScalarField
- class cloudComPy.ScalarField
Bases:
pybind11_object
A simple scalar field (to be associated to a point cloud).
A monodimensional array of scalar values. Invalid values can be represented by CCCoreLib::NAN_VALUE.
- __init__(self: _cloudComPy.ScalarField, name: str = None) None
Default constructor
- Parameters:
name (string,optional) – scalarField name
- addElement(self: _cloudComPy.ScalarField, arg0: float) None
Add a value at the end of the vector.
- Parameters:
value (float) – the value to add
- computeMeanAndVariance(self: _cloudComPy.ScalarField) tuple
Returns a tuple (mean, variance).
- Returns:
(mean, variance)
- Return type:
tuple
- computeMinAndMax(self: _cloudComPy.ScalarField) None
Should be called before getMin or getMax, for instance after modifying the scalar field with Numpy.
No return!
- currentSize(self: _cloudComPy.ScalarField) int
Returns the vector size.
- Returns:
the vector size
- Return type:
int
- fill(self: _cloudComPy.ScalarField, arg0: float) None
Fills the array with a particular value.
- Parameters:
value (float) – the value to use to fill the array
- flagValueAsInvalid(self: _cloudComPy.ScalarField, arg0: int) None
Sets the value as ‘invalid’ (i.e. CCCoreLib::NAN_VALUE).
No check on index validity!
- Parameters:
index (int) – the index in the ScalarField to set as ‘invalid’
- fromNpArrayCopy(self: _cloudComPy.ScalarField, arg0: numpy.ndarray[numpy.float32]) None
Copy data from numpy array into an existing ScalarField.
Checks if the numpy array is of PyScalarType, one dimension, same size as the ScalarField, before overwriting ScalarField data.
- Parameters:
nparray (ndarray) – the data source to use to overwrite the ScalarField
- getMax(self: _cloudComPy.ScalarField) float
Returns maximal value of the ScalarField.
You should call computeMinAndMax before, after a modification of the ScalarField with Numpy!
- Returns:
max value
- Return type:
float
- getMin(self: _cloudComPy.ScalarField) float
Returns minimal value of the ScalarField.
You should call call computeMinAndMax before, after a modification of the ScalarField with Numpy!
- Returns:
min value
- Return type:
float
- getName(self: _cloudComPy.ScalarField) str
Returns the name of the ScalarField.
- Returns:
ScalarField name
- Return type:
str
- getValue(*args, **kwargs)
Overloaded function.
getValue(self: _cloudComPy.ScalarField, arg0: int) -> float
Returns the ScalarField value at a given index.
No check on index validity!
- Parameters:
index (int) – the index
- Returns:
value at index
- Return type:
float
getValue(self: _cloudComPy.ScalarField, arg0: int) -> float
Returns the ScalarField value at a given index.
No check on index validity!
- Parameters:
index (int) – the index
- Returns:
value at index
- Return type:
float
- reserveSafe(self: _cloudComPy.ScalarField, arg0: int) bool
Reserves memory (no exception thrown).
- Parameters:
count (int) – number of elements to reserve in the ScalarField
- Returns:
success
- Return type:
bool
- resizeSafe(self: _cloudComPy.ScalarField, arg0: int, arg1: bool, arg2: float) bool
Resizes memory (no exception thrown).
- Parameters:
count (int) – number of elements to keep/reserve in the ScalarField
init (bool) – whether to initialize new elements
value (float) – value for new elements
- Returns:
success
- Return type:
bool
- setName(self: _cloudComPy.ScalarField, arg0: str) None
Sets the name of the ScalarField. No control is done on the uniqueness of the name. It is your responsability to ensure this uniqueness.
- Parameters:
name (str) – new name for the ScalarField
- setValue(self: _cloudComPy.ScalarField, arg0: int, arg1: float) None
Set the value at the given index.
No check on index validity!
- Parameters:
index (int) – index in the ScalarField
value (float) – value to set at index
- swap(self: _cloudComPy.ScalarField, arg0: int, arg1: int) None
Swap values between two indices.
No check on indices validity!
- Parameters:
index1 (int) – first index
index2 (int) – second index
- toNpArray(self: _cloudComPy.ScalarField) numpy.ndarray
Wrap the ScalarField data into a numpy Array.
Returns a numpy array: a one dimension array of (number of Points). Data is not copied, the numpy array object does not own the data.
WARNING No automatic action on the Python side on the variables referencing the C++ object in case of destruction!
- Returns:
numpy Array pointing to the ScalarField data
- Return type:
ndarray
- toNpArrayCopy(self: _cloudComPy.ScalarField) numpy.ndarray
Wrap the ScalarField data into a numpy Array.
Returns a numpy array: a one dimension array of (number of Points). Data is copied, the numpy array object owns its data. Ownership is transfered to Python: the numpy array object and its data will be handled by the Python Garbage Collector.
- Returns:
numpy Array with data copied from the ScalarField data
- Return type:
ndarray
9.3. color scales for scalar fields
- class cloudComPy.ccColorScale
Bases:
pybind11_object
A color scale is defined by several ‘steps’ corresponding to given colors. The color between each step is linearly interpolated. A valid color scale must have at least 2 steps, one at relative position 0.0 (scale start) and one at relative position 1.0 (scale end). Steps can’t be defined outside this interval. For faster access, an array of interpolated colors is maintained internally.
- static Create(name: QString, Uuid: QString = '') _cloudComPy.ccColorScale
Static method to create a new color scale.
Steps must be defined with the insert method.
- Parameters:
name (string) – the scale name
Uuid (string,optional) – a unique Id for the scale. default empty, automatically generated.
- Returns:
the new scale
- Return type:
- __init__(*args, **kwargs)
- getName(self: _cloudComPy.ccColorScale) QString
Get the scale name.
- Returns:
the scale name
- Return type:
string
- getUuid(self: _cloudComPy.ccColorScale) QString
Get the scale unique Id.
- Returns:
the unique Id
- Return type:
string
- insert(self: _cloudComPy.ccColorScale, arg0: float, arg1: _cloudComPy.QColor) int
Insert a color step, with a relative position between 0 and 1, and the associated color.
- Parameters:
relative_position (float) – relative position between 0 and 1
color (QColor) – the color associated to the step
- setName(self: _cloudComPy.ccColorScale, arg0: QString) None
Set the Scale name.
- Parameters:
name (string) – the new scale name.
- class cloudComPy.ccColorScalesManager
Bases:
pybind11_object
ccColorScale container and manager, useful to get the defaults color scales.
- GetUniqueInstance() _cloudComPy.ccColorScalesManager
Get the Unique instance of the ccColorScalesManager.
- Returns:
the Unique instance of the ccColorScalesManager
- Return type:
- __init__(*args, **kwargs)
- addScale(self: _cloudComPy.ccColorScalesManager, arg0: _cloudComPy.ccColorScale) None
Add a new color scale.
This operation is only useful to store the color scale in the container if you want to save it to persistent settings (not yet working properly).
- Parameters:
scale (ccColorScale) – the color scale to add
- getDefaultScale(self: _cloudComPy.ccColorScalesManager, arg0: _cloudComPy.DEFAULT_SCALES) _cloudComPy.ccColorScale
Get one of the default color scales.
- Parameters:
scale (DEFAULT_SCALES) – the color scale id
- Returns:
the color scale
- Return type:
- getScale(self: _cloudComPy.ccColorScalesManager, arg0: QString) _cloudComPy.ccColorScale
Retrieve a color scale with its universal Id.
- Parameters:
UUID (string) – the universal Id of the color scale to find
- Returns:
the color scale
- Return type:
- removeScale(self: _cloudComPy.ccColorScalesManager, arg0: QString) None
Remove a Color scale from the container.
- Parameters:
UUID (string) – the universal Id of the color scale to remove
- toPersistentSettings(self: _cloudComPy.ccColorScalesManager) None
Save custom color scales to persistent settings (not yet working properly).
- class cloudComPy.DEFAULT_SCALES
There are 16 predefined color scales
Members:
BGYR
GREY
BWR
RY
RW
ABS_NORM_GREY
HSV_360_DEG
VERTEX_QUALITY
DIP_BRYW
DIP_DIR_REPEAT
VIRIDIS
BROWN_YELLOW
YELLOW_BROWN
TOPO_LANDSERF
HIGH_CONTRAST
CIVIDIS
- ABS_NORM_GREY = <DEFAULT_SCALES.ABS_NORM_GREY: 5>
- BGYR = <DEFAULT_SCALES.BGYR: 0>
- BROWN_YELLOW = <DEFAULT_SCALES.BROWN_YELLOW: 11>
- BWR = <DEFAULT_SCALES.BWR: 2>
- CIVIDIS = <DEFAULT_SCALES.CIVIDIS: 15>
- DIP_BRYW = <DEFAULT_SCALES.DIP_BRYW: 8>
- DIP_DIR_REPEAT = <DEFAULT_SCALES.DIP_DIR_REPEAT: 9>
- GREY = <DEFAULT_SCALES.GREY: 1>
- HIGH_CONTRAST = <DEFAULT_SCALES.HIGH_CONTRAST: 14>
- HSV_360_DEG = <DEFAULT_SCALES.HSV_360_DEG: 6>
- RW = <DEFAULT_SCALES.RW: 4>
- RY = <DEFAULT_SCALES.RY: 3>
- TOPO_LANDSERF = <DEFAULT_SCALES.TOPO_LANDSERF: 13>
- VERTEX_QUALITY = <DEFAULT_SCALES.VERTEX_QUALITY: 7>
- VIRIDIS = <DEFAULT_SCALES.VIRIDIS: 10>
- YELLOW_BROWN = <DEFAULT_SCALES.YELLOW_BROWN: 12>
- __init__(self: _cloudComPy.DEFAULT_SCALES, value: int) None
- property name
- property value