39 Range() : m_min(0), m_start(0), m_stop(0), m_max(0), m_range(1) {}
42 inline ScalarType
min()
const {
return m_min; }
43 inline ScalarType
start()
const {
return m_start; }
44 inline ScalarType
stop()
const {
return m_stop; }
45 inline ScalarType
max()
const {
return m_max; }
46 inline ScalarType
range()
const {
return m_range; }
47 inline ScalarType
maxRange()
const {
return m_max - m_min; }
52 bool resetStartStop =
true) {
53 assert(minVal <= maxVal);
60 m_start = inbound(m_start);
61 m_stop = inbound(m_stop);
67 m_start = inbound(value);
68 if (m_stop < m_start) m_stop = m_start;
72 m_stop = inbound(value);
73 if (m_stop < m_start) m_start = m_stop;
78 inline ScalarType
inbound(ScalarType val)
const {
79 return (val < m_min ? m_min : (val > m_max ? m_max : val));
83 return (val >= m_min && val <= m_max);
87 return (val >= m_start && val <= m_stop);
115 return m_logScale ? m_logSaturationRange : m_saturationRange;
123 return m_logSaturationRange;
140 assert(m_colorScale);
141 return m_colorScale->getColorByRelativePos(
157 return m_showNaNValuesInGrey;
180 inline bool logScale()
const {
return m_logScale; }
202 unsigned maxValue = 0;
226 bool toFile(QFile& out,
short dataVersion)
const override;
constexpr ScalarType ZERO_TOLERANCE_SCALAR
QSharedPointer< ccColorScale > Shared
Shared pointer type.
Scalar field range structure.
Range()
Default constructor.
void setStop(ScalarType value)
bool isInbound(ScalarType val) const
Returns whether a value is inbound or not.
ScalarType maxRange() const
void updateRange()
Updates actual range.
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.
const ccColorScale::Shared & getColorScale() const
Returns associated color scale.
Range m_logSaturationRange
saturation values range (log scale mode)
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.
double m_globalShift
Global shift.
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.
ccScalarField(const ccScalarField &sf)
Copy constructor.
bool m_showNaNValuesInGrey
Whether NaN values are shown in grey or are hidden.
void updateSaturationBounds()
Updates saturation values.
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.
Range m_displayRange
Displayed values range.
void setLogScale(bool state)
Sets whether scale is logarithmic or not.
void setColorScale(ccColorScale::Shared scale)
Sets associated color scale.
bool toFile(QFile &out, short dataVersion) const override
Saves data to binary stream.
double getGlobalShift() const
Returns the global shift (if any)
Histogram m_histogram
Associated histogram values (for display)
void setSymmetricalScale(bool state)
Sets whether the color scale should be symmetrical or not.
bool fromFile(QFile &in, short dataVersion, int flags, LoadedIDMap &oldToNewIDMap) override
Loads data from binary stream.
unsigned m_colorRampSteps
Number of color ramps steps (for display)
bool m_alwaysShowZero
Whether 0 should always appear in associated color ramp.
const Range & saturationRange() const
Access to the range of saturation values.
const Histogram & getHistogram() const
Returns associated histogram values (for display)
ScalarType normalize(ScalarType val) const
Normalizes a scalar value between 0 and 1 (wrt to current parameters)
bool m_symmetricalScale
Whether color scale is symmetrical or not.
void showNaNValuesInGrey(bool state)
~ccScalarField() override=default
Default destructor.
const Range & displayRange() const
Access to the range of displayed values.
const ecvColor::Rgb * getColor(ScalarType value) const
bool m_logScale
Whether scale is logarithmic or not.
void setModificationFlag(bool state)
Sets modification flag state.
void computeMinAndMax() override
Determines the min and max values.
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.
void importParametersFrom(const ccScalarField *sf)
Imports the parameters from another scalar field.
bool m_modified
Modification flag.
bool mayHaveHiddenValues() const
const ecvColor::Rgb * getValueColor(unsigned index) const
Shortcut to getColor.
void setSaturationStart(ScalarType val)
Sets the value at which to start color gradient.
void setMaxDisplayed(ScalarType val)
Sets the maximum displayed value.
Range m_saturationRange
Saturation values range.
ccScalarField(const char *name=nullptr)
Default constructor.
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.
ccColorScale::Shared m_colorScale
Active color ramp (for display)
Serializable object interface.
QMultiMap< unsigned, unsigned > LoadedIDMap
Map of loaded unique IDs (old ID --> new ID)
A simple scalar field (to be associated to a point cloud)
ScalarType & getValue(std::size_t index)
__host__ __device__ float2 normalize(float2 v)
constexpr Rgb lightGrey(static_cast< ColorCompType >(MAX *0.8), static_cast< ColorCompType >(MAX *0.8), static_cast< ColorCompType >(MAX *0.8))
Simple histogram structure.