20 std::unique_ptr<cloudViewer::ScalarField>>
21 scalarfieldBase(m,
"ScalarField",
22 "A simple scalar field (to be associated to a "
26 .def(py::init([](
const std::string&
name) {
29 "name"_a =
"ScalarField")
33 "ScalarField ({}) with {} scalars and range ({}, "
44 "Sets scalar field name.",
"name"_a)
48 return std::string(sf.
getName());
50 "Returns scalar field name.")
52 "compute_mean_variance",
54 ScalarType mean, variance;
56 return std::make_tuple(mean, variance);
58 "Computes the mean value (and optionally the variance "
59 "value) of the scalar field.")
61 "Determines the min and max values")
63 "Sets the value as 'invalid' (i.e. NAN_VALUE).",
"index"_a)
65 "Returns the minimum value.")
67 "Returns the maximum value.")
69 "Returns the maximum value.",
"fill_value"_a = 0)
71 "Reserves memory (no exception thrown).",
"count"_a)
73 "Resizes memory (no exception thrown).",
"count"_a,
74 "is_fill"_a =
false,
"value"_a = 0)
76 py::overload_cast<std::size_t>(
78 "Gets value.",
"index"_a)
80 py::overload_cast<std::size_t>(
82 "Gets value(const version).",
"index"_a)
84 "Sets value.",
"index"_a,
"value"_a)
86 "Adds element.",
"value"_a)
88 "Returns current size.")
91 "Decrease counter and deletes object when 0.")
93 "Returns the current link count.")
97 "Returns whether a scalar value is valid or not.",
100 "Returns the specific NaN value");
122 py::class_<ccScalarField::Range, std::shared_ptr<ccScalarField::Range>>
123 range(m,
"Range",
"Scalar field range structure.");
124 py::detail::bind_default_constructor<ccScalarField::Range>(range);
125 py::detail::bind_copy_functions<ccScalarField::Range>(range);
126 range.def(py::init<>())
130 "Range with ({}, {}) in ({}, {})", rg.
start(),
137 "Returns the current start value (in [min,max])")
139 "Returns the current stop value (in [min,max])")
141 "Returns the actual range: start-stop (but can't be ZERO!)")
143 "Returns the maximum range")
145 "Sets the bounds",
"min_val"_a,
"max_val"_a,
146 "reset_start_stop"_a =
true)
148 "Sets the current start value",
"value"_a)
150 "Sets the current stop value",
"value"_a)
152 "Returns the nearest inbound value",
"value"_a)
154 "Returns whether a value is inbound or not",
"value"_a)
156 "Returns whether a value is inside range or not",
"value"_a);
171 py::class_<ccScalarField, std::unique_ptr<ccScalarField, py::nodelete>,
175 "A scalar field associated to display-related parameters.");
178 .def(py::init([](
const std::string&
name) {
181 "Simplified constructor",
"name"_a =
"ScalarField")
185 "ScalarField ({}) with {} scalars and range ({}, "
192 "Access to the range of displayed values.")
194 "Access to the range of saturation values.")
196 "Access to the range of log scale saturation values.")
198 "Sets the minimum displayed value.",
"value"_a)
200 "Sets the maximum displayed value.",
"value"_a)
202 "Sets the value at which to start color gradient.",
"value"_a)
204 "Sets the value at which to stop color gradient.",
"value"_a)
210 "Returns the color corresponding to a given value (wrt to "
211 "the current display parameters).",
214 "get_color_by_index",
218 "Shortcut to getColor.",
"index"_a)
220 "Sets whether NaN/out of displayed range values should be "
221 "displayed in gray or hidden.")
222 .def(
"are_nan_shown_in_grey",
224 "Returns whether NaN values are displayed in gray or hidden.")
226 "Sets whether 0 should always appear in associated color ramp "
229 "Returns whether 0 should always appear in associated color "
232 "Sets whether the color scale should be symmetrical or not.")
234 "Returns whether the color scale s symmetrical or not.")
236 "Sets whether scale is logarithmic or not.")
238 "Returns whether scalar field is logarithmic or not.")
240 "Returns number of color ramp steps.")
242 "Sets number of color ramp steps used for display.")
244 "Returns whether the scalar field in its current "
245 "configuration MAY have 'hidden' values or not.")
247 "Sets modification flag state.",
"state"_a)
249 "Returns modification flag state.")
251 "Returns the global shift (if any).")
253 "Sets the global shift.")
255 "Returns whether object is serializable of not.")
261 if (!out.open(QIODevice::WriteOnly)) {
264 return sf.toFile(out, dataVersion);
266 "Saves data to binary stream",
"filename"_a,
269 "Returns the minimum file version required to save this "
274 short data_version,
int flags) {
276 if (!in.open(QIODevice::ReadOnly)) {
280 return sf.fromFile(in, data_version, flags,
283 "Loads data from binary stream",
"filename"_a,
284 "data_version"_a,
"flags"_a)
286 "import_parameters_from",
288 sf.importParametersFrom(&source);
290 "Imports the parameters from another scalar field",
304 "are_nan_shown_in_grey");
308 "set_symmetrical_scale");
315 "may_have_hidden_values");
317 "set_modification_flag");
319 "get_modification_flag");
326 "import_parameters_from");
filament::Texture::InternalFormat format
virtual void link()
Increase counter.
virtual void release()
Decrease counter and deletes object when 0.
virtual unsigned getLinkCount() const
Returns the current link count.
Scalar field range structure.
void setStop(ScalarType value)
bool isInbound(ScalarType val) const
Returns whether a value is inbound or not.
ScalarType maxRange() const
ScalarType inbound(ScalarType val) const
Returns the nearest inbound value.
bool isInRange(ScalarType val) const
Returns whether a value is inside range or not.
void setBounds(ScalarType minVal, ScalarType maxVal, bool resetStartStop=true)
void setStart(ScalarType value)
A scalar field associated to display-related parameters.
void setSaturationStop(ScalarType val)
Sets the value at which to stop color gradient.
void setColorRampSteps(unsigned steps)
Sets number of color ramp steps used for display.
bool getModificationFlag() const
Returns modification flag state.
short minimumFileVersion() const override
Returns the minimum file version required to save this instance.
void setMinDisplayed(ScalarType val)
Sets the minimum displayed value.
bool isSerializable() const override
Returns whether object is serializable of not.
bool logScale() const
Returns whether scalar field is logarithmic or not.
void alwaysShowZero(bool state)
Sets whether 0 should always appear in associated color ramp or not.
void setGlobalShift(double shift)
Sets the global shift.
unsigned getColorRampSteps() const
Returns number of color ramp steps.
void setLogScale(bool state)
Sets whether scale is logarithmic or not.
double getGlobalShift() const
Returns the global shift (if any)
void setSymmetricalScale(bool state)
Sets whether the color scale should be symmetrical or not.
const Range & saturationRange() const
Access to the range of saturation values.
void showNaNValuesInGrey(bool state)
const Range & displayRange() const
Access to the range of displayed values.
void setModificationFlag(bool state)
Sets modification flag state.
bool symmetricalScale() const
Returns whether the color scale s symmetrical or not.
const Range & logSaturationRange() const
Access to the range of log scale saturation values.
bool mayHaveHiddenValues() const
void setSaturationStart(ScalarType val)
Sets the value at which to start color gradient.
void setMaxDisplayed(ScalarType val)
Sets the maximum displayed value.
bool areNaNValuesShownInGrey() const
Returns whether NaN values are displayed in gray or hidden.
bool isZeroAlwaysShown() const
Returns whether 0 should always appear in associated color ramp or not.
QMultiMap< unsigned, unsigned > LoadedIDMap
Map of loaded unique IDs (old ID --> new ID)
A simple scalar field (to be associated to a point cloud)
void fill(ScalarType fillValue=0)
Fills the array with a particular value.
virtual void computeMinAndMax()
Determines the min and max values.
ScalarType getMin() const
Returns the minimum value.
void addElement(ScalarType value)
static ScalarType NaN()
Returns the specific NaN value.
ScalarType & getValue(std::size_t index)
void computeMeanAndVariance(ScalarType &mean, ScalarType *variance=nullptr) const
void setValue(std::size_t index, ScalarType value)
void flagValueAsInvalid(std::size_t index)
Sets the value as 'invalid' (i.e. NAN_VALUE)
const char * getName() const
Returns scalar field name.
bool reserveSafe(std::size_t count)
Reserves memory (no exception thrown)
void setName(const char *name)
Sets scalar field name.
bool resizeSafe(std::size_t count, bool initNewElements=false, ScalarType valueForNewElements=0)
Resizes memory (no exception thrown)
static bool ValidValue(ScalarType value)
Returns whether a scalar value is valid or not.
void swap(std::size_t i1, std::size_t i2)
unsigned currentSize() const
ScalarType getMax() const
Returns the maximum value.
static Eigen::Vector3d ToEigen(const Type col[3])
void ClassMethodDocInject(py::module &pybind_module, const std::string &class_name, const std::string &function_name, const std::unordered_map< std::string, std::string > &map_parameter_body_docs)
void pybind_scalarfield(py::module &m)
Generic file read and write utility for python interface.