src.utils.ctransf.class_transformer

Classes

ClassTransformer(**kwargs)

Exceptions

ClassTransformerException([message])

exception src.utils.ctransf.class_transformer.ClassTransformerException(message='')
Author:

Alberto M. Esmoris Pena

Class for exceptions related to class transformation components. See VL3DException.

__init__(message='')
class src.utils.ctransf.class_transformer.ClassTransformer(**kwargs)
Author:

Alberto M. Esmoris Pena

Class (code) for class (classification) transformation operations.

Variables:
  • on_predictions (bool) – Flag controlling whether the transformation must be applied to classification or prediction.

  • num_classes (int) – The number of input classes

  • input_class_names (list of str) – The list of names corresponding to input classes. For example [0] is the name of the first class, i.e., that represented with index 0.

  • report_path (str) – The path to write the report file reporting the consequences of the class transformation.

  • plot_path (str) – The path to write the plot file reporting the consequences of the class transformation.

  • cti (dict) – The dictionary mapping the string-like names of the input classes (keys) to their corresponding integer index (values).

static extract_ctransf_args(spec)

Extract the arguments to initialize/instantiate a ClassTransformer from a key-word specification.

Parameters:

spec – The key-word specification containing the arguments.

Returns:

The arguments to initialize/instantiate a ClassTransformer.

__init__(**kwargs)

Initialize/instantiate a ClassTransformer.

Parameters:

kwargs – The attributes for the ClassTransformer.

abstractmethod transform(y, out_prefix=None)

The fundamental transformation logic defining the class transformer.

Parameters:
  • y (np.ndarray) – The vector of classes.

  • out_prefix (str) – The output prefix (OPTIONAL). It might be used by a report to particularize the output path.

Returns:

The transformed vector of classes.

Return type:

np.ndarray

transform_pcloud(pcloud, out_prefix=None)

Apply the transform method to a point cloud.

See class_transformer.ClassTransformer.transform()

Parameters:
  • pcloud (PointCloud) – The point cloud to be transformed.

  • out_prefix (str) – The output prefix (OPTIONAL). It might be used by a report to particularize the output path.

Returns:

A new point cloud that is the transformed version of the input point cloud.

Return type:

PointCloud

report(report, out_prefix=None)

Handle the way a report is reported. First, it will be reported using the logging system. Then, it will be written to a file if the transformer has a not None report_path.

Parameters:
  • report – The report to be reported.

  • out_prefix – The output prefix in case the output path must be expanded.

Returns:

Nothing.

build_new_las_header(pcloud)

Build the LAS header for the output point cloud.

See PointCloud and class_transformer.ClassTransformer.transform_pcloud().

Parameters:

pcloud (PointCloud) – The input point cloud as reference to build the header for the new point cloud.

Returns:

The LAS header for the output point cloud.