Structural deformable models
|
#include <Sensor.h>
Public Types | |
enum | UpdateParam { UPD_NOTHING =0, UPD_DATA =1, UPD_SCALE =2, UPD_CWEIGHTS =4, UPD_DIR =8, UPD_MINMAX =16, UPD_LAST =32, UPD_ALL =0xffffffff } |
Public Member Functions | |
virtual | ~Sensor () |
sensor_cptr | getSource () |
virtual void | changeSource (sensor_cptr _source) |
void | replaceBy (sensor_ptr target) |
bool | assignRef (sensor_cptr rhs) |
virtual Sensor & | assign (const Sensor &rhs) |
virtual float | getValue (int x, int y) const |
get value at discrete position More... | |
float | getValue (const Point &p) const |
get value at position p using nearest neighbour interpolation More... | |
virtual std::vector< float > | getMValue (int x, int y) const |
get multi-channel value More... | |
virtual Point2D | getGradient (int x, int y) const |
get gradient at discrete position More... | |
Point2D | getGradient (const Point2D &p) const |
get gradient at position p using nearest neighbor interpolation More... | |
float | getMax () const |
float | getMin () const |
float | getMinMaxRange () const |
float | getWeightedValue (int x, int y) const |
get max normalized value at discrete position range [0,1] More... | |
Point2D | getWeightedGradient (int x, int y) const |
get range weighted gradient at discrete position More... | |
void | setCWeights (const std::vector< float > &weights) |
const std::vector< float > & | getCWeights () const |
void | setDirection (const Point &dir) |
const Point & | getDirection () const |
void | setScale (float _scale) |
float | getScale () const |
bool | isModified (dword mask=UPD_ALL) const |
void | setModified (dword mask=UPD_ALL) |
void | unsetModified (dword mask=UPD_ALL) |
bool | isUpdate (dword udMask) const |
void | enableUpdate (dword udMask) |
void | disableUpdate (dword udMask) |
virtual bool | performUpdate () |
virtual int | getDim1Size () const |
virtual int | getDim2Size () const |
virtual int | getDim3Size () const |
virtual int | getNChannels () const |
virtual int | getSkip () const |
bool | isValid (int x, int y) const |
virtual Image< float > | createSensorImage () const |
const std::string & | getID () const |
void | setID (const std::string &id) |
virtual std::ostream & | hprint (std::ostream &os, SensorCollection *sc) const |
virtual std::ostream & | print (std::ostream &os) const |
void | refSuperSensor (sensor_ptr super) |
void | unrefSuperSensor (sensor_ptr super) |
void | invalidateSource () |
template<typename Derived > | |
std::shared_ptr< Derived > | shared_from_base () |
Static Public Member Functions | |
static dword | getStringNumber (const char *sid) |
static void | getNumberString (char sid[5], dword id) |
Protected Member Functions | |
Sensor (dword updateMask) | |
Sensor () | |
virtual float | calcValue (int x, int y) const =0 |
virtual std::vector< float > | calcMValue (int x, int y) const |
virtual Point | calcGradient (int x, int y) const |
virtual void | calcMinMax () |
Protected Attributes | |
sensor_cptr | source |
float | scale |
std::vector< float > | cweights |
multi-channel weights ('color') More... | |
Point | dir |
direction parameter More... | |
float | maxval |
float | minval |
overall minimum and maximum More... | |
float | mean |
float | stdev |
overall mean and stdev More... | |
dword | toupdate |
bitflag for updates More... | |
dword | updateMask |
bitflag to mask unimportant updates More... | |
std::string | m_ID |
int | m_Skip |
int | m_AddSkip |
enum Sensor::UpdateParam |
Enumerator | |
---|---|
UPD_NOTHING | |
UPD_DATA | |
UPD_SCALE | |
UPD_CWEIGHTS | |
UPD_DIR | |
UPD_MINMAX | |
UPD_LAST | |
UPD_ALL |
Definition at line 26 of file Sensor.h.
|
protected |
Definition at line 13 of file Sensor.cpp.
References cweights.
|
protected |
Definition at line 23 of file Sensor.cpp.
References cweights, and setModified().
|
virtual |
Destructor
Definition at line 34 of file Sensor.cpp.
References getZeroSensor(), source, and unrefSuperSensor().
Reimplemented in MappingSensor, MahalSensor, CombiSensor, and PPSensor.
Definition at line 54 of file Sensor.cpp.
References changeSource(), cweights, dir, m_AddSkip, m_ID, m_Skip, scale, setCWeights(), setDirection(), setScale(), and source.
Referenced by PPSensor::assign(), assignRef(), MahalSensor::getNChannels(), MappingSensor::getNChannels(), getSource(), and CombiSensor::setSource().
bool Sensor::assignRef | ( | sensor_cptr | rhs | ) |
|
inlineprotectedvirtual |
Calculates the gradient using central differencing.
Reimplemented in ZeroSensor, and MCGSensor.
Definition at line 149 of file Sensor.h.
References calcMinMax(), getValue(), invalidateSource(), refSuperSensor(), and unrefSuperSensor().
Referenced by PPSensor::calcAllGradients(), getGradient(), and PPSensor::getGradient().
|
protectedvirtual |
Reimplemented in Dataset.
Definition at line 152 of file Sensor.cpp.
References dmutil::avg(), getValue(), maxval, mean, minval, source, dmutil::sqrt(), and stdev.
Referenced by calcGradient(), and performUpdate().
|
inlineprotectedvirtual |
Calculate a multi-valued sensor result. The size of the returned vector is the same as getNChannels().
Reimplemented in CombiSensor, and Dataset.
Definition at line 145 of file Sensor.h.
References calcValue(), and getNChannels().
Referenced by getMValue().
|
protectedpure virtual |
Compute a sensed value at position x,y. This function is essential for all derived sensors.
Implemented in MappingSensor, MahalSensor, CombiSensor, CornerSensor, ZeroSensor, GradMagSensor, SmoothIntensitySensor, CRSensor, Dataset, MCGSensor, MCIntensitySensor, PPIntensitySensor, and IntensitySensor.
Referenced by PPSensor::calcAllValues(), calcMValue(), getValue(), PPSensor::getValue(), and setID().
|
virtual |
Reimplemented in CombiSensor, and ZeroSensor.
Definition at line 96 of file Sensor.cpp.
References cweights, getZeroSensor(), refSuperSensor(), setModified(), source, unrefSuperSensor(), and UPD_DATA.
Referenced by assign(), CombiSensor::changeSource(), CombiSensor::getSkip(), and getSource().
|
virtual |
Definition at line 203 of file Sensor.cpp.
References getDim1Size(), getDim2Size(), getWeightedValue(), and Image< T >::setPixel().
Referenced by getSkip().
|
inline |
|
inline |
Definition at line 113 of file Sensor.h.
Referenced by CombiSensor::changeSource(), CombiSensor::CombiSensor(), CornerSensor::CornerSensor(), GradMagSensor::GradMagSensor(), and CombiSensor::setSource().
|
inline |
Definition at line 97 of file Sensor.h.
References cweights, dir, and setDirection().
Referenced by CombiSensor::assign().
|
inlinevirtual |
the real dataset will override these
Reimplemented in ZeroSensor, and Dataset.
Definition at line 120 of file Sensor.h.
References source.
Referenced by createSensorImage(), and isValid().
|
inlinevirtual |
Reimplemented in ZeroSensor, and Dataset.
Definition at line 121 of file Sensor.h.
References source.
Referenced by createSensorImage(), and isValid().
|
inlinevirtual |
Reimplemented in ZeroSensor, and Dataset.
Definition at line 122 of file Sensor.h.
References source.
|
inline |
|
inlinevirtual |
get gradient at discrete position
Reimplemented in PPSensor.
Definition at line 53 of file Sensor.h.
References calcGradient().
Referenced by getGradient(), and getWeightedGradient().
get gradient at position p using nearest neighbor interpolation
Definition at line 57 of file Sensor.h.
References getGradient(), Point2D::x, and Point2D::y.
|
inline |
|
inline |
Definition at line 63 of file Sensor.h.
References isModified(), and maxval.
|
inline |
Definition at line 67 of file Sensor.h.
References isModified(), and minval.
|
inline |
Definition at line 71 of file Sensor.h.
References isModified(), maxval, and minval.
Referenced by getWeightedGradient(), and getWeightedValue().
|
inlinevirtual |
get multi-channel value
Definition at line 49 of file Sensor.h.
References calcMValue().
Referenced by ImageWindow::onKeyPress().
|
inlinevirtual |
Reimplemented in MappingSensor, MahalSensor, CombiSensor, ZeroSensor, CRSensor, MCGSensor, Dataset, and MCIntensitySensor.
Definition at line 123 of file Sensor.h.
References source.
Referenced by calcMValue(), and CombiSensor::calcMValue().
|
static |
Definition at line 88 of file Sensor.cpp.
Referenced by setID().
|
inline |
Definition at line 101 of file Sensor.h.
References scale.
Referenced by SmoothIntensitySensor::print().
|
inlinevirtual |
Reimplemented in CombiSensor.
Definition at line 124 of file Sensor.h.
References createSensorImage(), isValid(), and m_Skip.
|
inline |
Definition at line 34 of file Sensor.h.
References assign(), assignRef(), changeSource(), replaceBy(), and source.
|
static |
|
inlinevirtual |
get value at discrete position
Reimplemented in PPSensor.
Definition at line 41 of file Sensor.h.
References calcValue().
Referenced by calcGradient(), calcMinMax(), getValue(), and getWeightedValue().
|
inline |
get value at position p using nearest neighbour interpolation
Definition at line 45 of file Sensor.h.
References getValue(), Point2D::x, and Point2D::y.
|
inline |
get range weighted gradient at discrete position
Definition at line 90 of file Sensor.h.
References getGradient(), getMinMaxRange(), and setCWeights().
|
inline |
get max normalized value at discrete position range [0,1]
Definition at line 76 of file Sensor.h.
References getMinMaxRange(), getValue(), minval, SENSOR_GAUSS_NORMALIZATION_RANGE, and stdev.
Referenced by createSensorImage().
|
virtual |
Reimplemented in CombiSensor.
Definition at line 222 of file Sensor.cpp.
References getZeroSensor(), SensorCollection::isPrinted(), m_ID, print(), SensorCollection::setPrinted(), and source.
Referenced by CombiSensor::getSkip(), and setID().
void Sensor::invalidateSource | ( | ) |
Definition at line 190 of file Sensor.cpp.
References getZeroSensor(), source, and unrefSuperSensor().
Referenced by calcGradient().
Check whether something is marked as modified. enum Sensor::UpdateParam is used. Also, mask is filtered through internal updateMask. So only the properties that matter to the current sensor will take effect.
Definition at line 108 of file Sensor.h.
References toupdate.
Referenced by PPSensor::calcAllGradients(), PPSensor::getGradient(), getMax(), getMin(), getMinMaxRange(), PPSensor::getValue(), performUpdate(), GradMagSensor::performUpdate(), CornerSensor::performUpdate(), PPSensor::performUpdate(), and MappingSensor::performUpdate().
|
inline |
bool Sensor::isValid | ( | int | x, |
int | y | ||
) | const |
Definition at line 197 of file Sensor.cpp.
References getDim1Size(), getDim2Size(), and m_Skip.
Referenced by GradMagSensor::calcValue(), CornerSensor::calcValue(), and getSkip().
|
virtual |
Perform an update if isModified()
Reimplemented in MappingSensor, PPSensor, CornerSensor, GradMagSensor, and SmoothIntensitySensor.
Definition at line 123 of file Sensor.cpp.
References calcMinMax(), isModified(), m_AddSkip, m_Skip, source, unsetModified(), UPD_DATA, UPD_MINMAX, and updateMask.
Referenced by PPSensor::calcAllGradients(), Dataset::clear(), Dataset::copyData(), disableUpdate(), PPSensor::getGradient(), MappingSensor::getMappingID(), PPSensor::getValue(), GradMagSensor::GradMagSensor(), Dataset::load(), and PPSensor::performUpdate().
|
virtual |
Reimplemented in MappingSensor, MahalSensor, CombiSensor, ZeroSensor, CornerSensor, GradMagSensor, SmoothIntensitySensor, CRSensor, MCGSensor, Dataset, MCIntensitySensor, and IntensitySensor.
Definition at line 213 of file Sensor.cpp.
References getZeroSensor(), m_ID, and source.
Referenced by hprint(), IntensitySensor::print(), MCIntensitySensor::print(), MCGSensor::print(), CRSensor::print(), SmoothIntensitySensor::print(), GradMagSensor::print(), CornerSensor::print(), ZeroSensor::print(), MahalSensor::print(), MappingSensor::print(), and setID().
void Sensor::refSuperSensor | ( | sensor_ptr | super | ) |
Definition at line 182 of file Sensor.cpp.
References getZeroSensor().
Referenced by calcGradient(), and changeSource().
void Sensor::replaceBy | ( | sensor_ptr | target | ) |
Definition at line 44 of file Sensor.cpp.
Referenced by getSource(), and SensorCollection::merge().
void Sensor::setCWeights | ( | const std::vector< float > & | weights | ) |
Definition at line 109 of file Sensor.cpp.
References cweights, setModified(), and UPD_CWEIGHTS.
Referenced by assign(), and getWeightedGradient().
void Sensor::setDirection | ( | const Point & | dir | ) |
Definition at line 115 of file Sensor.cpp.
References dir, setModified(), and UPD_DIR.
Referenced by assign(), and getCWeights().
|
inline |
Definition at line 129 of file Sensor.h.
References calcValue(), getNumberString(), getStringNumber(), hprint(), m_ID, and print().
Referenced by Dataset::Dataset(), and ZeroSensor::ZeroSensor().
Definition at line 110 of file Sensor.h.
References toupdate.
Referenced by PPSensor::calcAllGradients(), changeSource(), CombiSensor::changeSource(), Dataset::clear(), CombiSensor::clearSources(), Dataset::copyData(), Dataset::load(), Sensor(), setCWeights(), setDirection(), CombiSensor::setNSources(), setScale(), and CombiSensor::setSource().
void Sensor::setScale | ( | float | _scale | ) |
Definition at line 119 of file Sensor.cpp.
References scale, setModified(), and UPD_SCALE.
Referenced by assign(), and getDirection().
|
inline |
void Sensor::unrefSuperSensor | ( | sensor_ptr | super | ) |
Definition at line 186 of file Sensor.cpp.
References getZeroSensor().
Referenced by calcGradient(), changeSource(), invalidateSource(), and ~Sensor().
Definition at line 111 of file Sensor.h.
References toupdate.
Referenced by PPSensor::calcAllGradients(), performUpdate(), and ZeroSensor::ZeroSensor().
|
protected |
multi-channel weights ('color')
Definition at line 174 of file Sensor.h.
Referenced by assign(), CombiSensor::calcMValue(), MCIntensitySensor::calcValue(), CombiSensor::calcValue(), changeSource(), CombiSensor::clearSources(), getCWeights(), MCIntensitySensor::print(), CombiSensor::print(), Sensor(), setCWeights(), CombiSensor::setNSources(), and CombiSensor::setSource().
|
protected |
direction parameter
Definition at line 175 of file Sensor.h.
Referenced by assign(), getCWeights(), getDirection(), and setDirection().
|
protected |
Definition at line 183 of file Sensor.h.
Referenced by assign(), CornerSensor::CornerSensor(), CRSensor::CRSensor(), GradMagSensor::GradMagSensor(), MahalSensor::MahalSensor(), MappingSensor::MappingSensor(), MCGSensor::MCGSensor(), performUpdate(), GradMagSensor::performUpdate(), and CornerSensor::performUpdate().
|
protected |
|
protected |
Definition at line 182 of file Sensor.h.
Referenced by assign(), getSkip(), CombiSensor::getSkip(), isValid(), performUpdate(), GradMagSensor::performUpdate(), and CornerSensor::performUpdate().
|
protected |
Definition at line 176 of file Sensor.h.
Referenced by Dataset::calcMinMax(), calcMinMax(), getMax(), and getMinMaxRange().
|
protected |
Definition at line 177 of file Sensor.h.
Referenced by calcMinMax(), makeNoiseImage(), MahalSensor::saveConfig(), and MahalSensor::setMean().
|
protected |
overall minimum and maximum
Definition at line 176 of file Sensor.h.
Referenced by Dataset::calcMinMax(), calcMinMax(), getMin(), getMinMaxRange(), and getWeightedValue().
|
protected |
Scale of filter (log2 scale –> 0 means 'full' resolution)
Definition at line 173 of file Sensor.h.
Referenced by assign(), getScale(), and setScale().
|
protected |
Handle of the source
Definition at line 170 of file Sensor.h.
Referenced by assign(), PPSensor::calcAllGradients(), PPSensor::calcAllValues(), MCGSensor::calcGradient(), calcMinMax(), IntensitySensor::calcValue(), PPIntensitySensor::calcValue(), MCIntensitySensor::calcValue(), MCGSensor::calcValue(), CRSensor::calcValue(), SmoothIntensitySensor::calcValue(), GradMagSensor::calcValue(), CornerSensor::calcValue(), MahalSensor::calcValue(), MappingSensor::calcValue(), changeSource(), CombiSensor::changeSource(), PPSensor::fitSheets(), getDim1Size(), getDim2Size(), getDim3Size(), getNChannels(), getSource(), hprint(), invalidateSource(), performUpdate(), GradMagSensor::performUpdate(), CornerSensor::performUpdate(), MappingSensor::performUpdate(), print(), CombiSensor::setSource(), and ~Sensor().
|
protected |
overall mean and stdev
Definition at line 177 of file Sensor.h.
Referenced by calcMinMax(), and getWeightedValue().
|
protected |
bitflag for updates
Definition at line 179 of file Sensor.h.
Referenced by PPSensor::calcAllGradients(), isModified(), setModified(), and unsetModified().
|
protected |
bitflag to mask unimportant updates
Definition at line 180 of file Sensor.h.
Referenced by performUpdate(), and ZeroSensor::ZeroSensor().