MeVisLab Toolbox Reference
|
The class defines a first order linear transformation. More...
#include <mlScaleShiftData.h>
Public Types | |
enum | ReorderMode { NoReordering = 0 , ReorderColorPlanesToInterleaved = 1 } |
Mode that indicates whether copySubImage should reorder the color from planes (from x,y,z,c,t,u) to interleaved format (c,x,y,z,c,t,u). More... | |
Public Member Functions | |
ReorderMode | getReorderMode () const |
Returns the reorder mode. | |
void | setReorderMode (ReorderMode mode) |
Sets the reorder mode. | |
Initialization | |
TScaleShiftData () | |
Default constructor, i.e., builds identity transformation. | |
TScaleShiftData (const TScaleShiftData< DT > &ssd) | |
Copy constructor. | |
TScaleShiftData (DT scale, DT shift) | |
Constructor: sets scale and shift to define a transformation so that a scaled value v' is v' = v*scale + shift. | |
TScaleShiftData (DT fromMin, DT fromMax, DT toMin, DT toMax) | |
Values from interval [fromMin , fromMax ] are transformed linearly into [toMin , toMax ]. | |
Assignment. | |
TScaleShiftData & | operator= (const TScaleShiftData< DT > &ssd) |
Assignment operator from an existing object to get an identical copy. | |
Comparison. | |
bool | operator== (const TScaleShiftData< DT > &ssd) const |
Returns true if all members are equal. | |
bool | operator!= (const TScaleShiftData< DT > &ssd) const |
Returns true if any members differ. | |
Set transformation | |
void | setScaleOffset (DT scale, DT shift) |
Sets scale and shift: values are multiplied with scale and then shift is added. | |
void | setFromMinMaxToMinMax (DT fromMin, DT fromMax, DT toMin, DT toMax) |
Values from interval [fromMin , fromMax ] are transformed linearly into [toMin , toMax ]. | |
void | setFromMinMaxToMinMax (MLDataType fromType, DT fromMin, DT fromMax, MLDataType toType, DT toMin, DT toMax) |
Values from interval [fromMin , fromMax ] are transformed linearly into [toMin , toMax ]. | |
void | unset () |
Sets the default, i.e., identity transformation. | |
Query transformation values. | |
DT | getScale () const |
Returns the scale constant of the transformation y=scale*x+offset. | |
DT | getShift () const |
Returns the addition constant of the transformation y=scale*x+shift. | |
The class defines a first order linear transformation.
It is used as a container for the parameters scale and shift of a linear transformation y=scale*x+shift.
Notes:
Definition at line 54 of file mlScaleShiftData.h.
enum ml::TScaleShiftData::ReorderMode |
Mode that indicates whether copySubImage should reorder the color from planes (from x,y,z,c,t,u) to interleaved format (c,x,y,z,c,t,u).
Note that a SubImage with interleaved color data will not be fully functional, since it will not have correct internal strides, etc. Typically ReorderMode::ReorderColorPlanesToInterleaved is used to convert color images for usage with OpenGL or other APIs that require RGBRGBRGB... or RGBARGBA... data.
Enumerator | |
---|---|
NoReordering | < No reodering is done. |
ReorderColorPlanesToInterleaved | < Reorders the color planes to interleaved format. |
Definition at line 65 of file mlScaleShiftData.h.
|
inline |
Default constructor, i.e., builds identity transformation.
Definition at line 76 of file mlScaleShiftData.h.
|
inline |
Copy constructor.
Definition at line 84 of file mlScaleShiftData.h.
|
inline |
Constructor: sets scale
and shift
to define a transformation so that a scaled value v' is v' = v*scale + shift.
Definition at line 93 of file mlScaleShiftData.h.
|
inline |
Values from interval [fromMin
, fromMax
] are transformed linearly into [toMin
, toMax
].
If necessary, interval borders are swapped to guarantee that minimum values are smaller or equal than maximum values. In case that fromMin
and fromMax
are identical, _scale is set to 1 and _shift is set to toMin
- fromMin
. This way, the only value from that interval is projected to the minimum value of the target interval. ATTENTION: This transformation defines no clipping/clamping. If values outside [fromMin
, fromMax
] are transformed, they will be transformed to values outside [toMin
, toMax
].
Definition at line 107 of file mlScaleShiftData.h.
References mlrange_cast().
|
inline |
Returns the reorder mode.
Definition at line 304 of file mlScaleShiftData.h.
|
inline |
Returns the scale constant of the transformation y=scale*x+offset.
Definition at line 297 of file mlScaleShiftData.h.
|
inline |
Returns the addition constant of the transformation y=scale*x+shift.
Definition at line 300 of file mlScaleShiftData.h.
|
inline |
Returns true
if any members differ.
Definition at line 145 of file mlScaleShiftData.h.
References mlrange_cast().
|
inline |
Assignment operator from an existing object to get an identical copy.
Definition at line 121 of file mlScaleShiftData.h.
References mlrange_cast().
|
inline |
Returns true
if all members are equal.
Definition at line 138 of file mlScaleShiftData.h.
References mlrange_cast(), and MLValuesAreEqualWOM().
|
inline |
Values from interval [fromMin
, fromMax
] are transformed linearly into [toMin
, toMax
].
If necessary, then interval borders are swapped to guarantee that minimum values are smaller or equal than maximum values. In case that fromMin
and fromMax
are identical, _scale is set to 1 and _shift is set to toMin
- fromMin
. This way, the only value from that interval is projected to the minimum value of the target interval. ATTENTION: This transformation defines no clipping/clamping. If values outside [fromMin
, fromMax
] are transformed they will be transformed to values outside [toMin
, toMax
].
Definition at line 175 of file mlScaleShiftData.h.
References mlrange_cast().
|
inline |
Values from interval [fromMin
, fromMax
] are transformed linearly into [toMin
, toMax
].
If necessary, then interval borders are swapped to guarantee that minimum values are smaller or equal than maximum values.
This method handles float/integer data type combinations differently:
Float -> Integer
Adds 0.99 to the integer toMax, since that is almost the same as adding 1.0 and avoids having to clamp the result to the integer maximum value. (as described in 'Zen of Graphics Programming, Michael Abrash').
Integer -> Integer
Adds 1 to the fromMax and toMax ranges, which is the same as shifting for power-of-two differences in range, if input range is greater than output range. Otherwise, leaves as is, so that fromMax maps to toMax.
Integer -> Float
Use range as given. Rationale: use fromMax integer value, and not fromMax+1, so that the maximum integer value will get the maximum float value (as in OpenGL, where the maximum integer value is mapped to 1.0)
Float -> Float
Use range as given.
In case that fromMin
and fromMax
are identical, _scale is set to 1 and _shift is set to toMin
- fromMin
. This way, the only value from that interval is projected to the minimum value of the target interval. ATTENTION: This transformation defines no clipping/clamping. If values outside [fromMin
, fromMax
] are transformed, they will be transformed to values outside [toMin
, toMax
].
Definition at line 231 of file mlScaleShiftData.h.
References MLIsIntType(), and mlrange_cast().
|
inline |
Sets the reorder mode.
Definition at line 307 of file mlScaleShiftData.h.
|
inline |
Sets scale
and shift:
values are multiplied with scale
and then shift
is added.
Definition at line 159 of file mlScaleShiftData.h.
|
inline |
Sets the default, i.e., identity transformation.
Definition at line 282 of file mlScaleShiftData.h.