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.

  1. 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

  1. 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

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.

  1. 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

  1. 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