iRoCS Toolbox
1.1.0
|
The Marker class specifies the properties of an abstract Marker that can be contained in an AnnotationChannelSpecs. More...
#include "liblabelling_qt4/Marker.hh"
Public Types | |
enum | MarkerType { Point = 0x0000, Sphere = 0x0001, Nucleus = 0x0002, Cylinder = 0x0003, SHSurface = 0x0004, Surface = 0x005, Cell = 0x006 } |
Marker.hh "liblabelling_qt4/Marker.hh". More... | |
Public Slots | |
void | setUpdatesEnabled (bool enable) |
Enables/Disables cache updates for this marker. More... | |
void | update () |
Explicitely trigger a cache update for all associated renderers. More... | |
Public Member Functions | |
Marker (AnnotationChannelSpecs *channel=NULL) | |
Constructor. More... | |
Marker (blitz::TinyVector< double, 3 > const &positionUm, AnnotationChannelSpecs *channel=NULL) | |
Constructor. More... | |
Marker (Marker const &marker) | |
Copy constructor. More... | |
virtual | ~Marker () |
Destructor. More... | |
virtual MarkerRenderer * | addRenderer (ViewWidget *view)=0 |
Add a rendering engine for the given view to this marker. More... | |
blitz::TinyVector< double, 3 > | boundingBoxLowerBoundUm () const |
Get the lower bound of the marker's bounding box for all dimensions. More... | |
blitz::TinyVector< double, 3 > | boundingBoxUpperBoundUm () const |
Get the upper bound of the marker's bounding box for all dimensions. More... | |
AnnotationChannelSpecs * | channel () const |
Get the channel this marker belongs to. More... | |
virtual void | copyFromATBNucleus (atb::Nucleus const &nc) |
virtual void | copyToATBNucleus (atb::Nucleus &nc) const |
double & | feature (size_t index) |
const std::vector< double > & | features () const |
std::vector< double >::iterator | featuresBegin () |
std::vector< double >::iterator | featuresEnd () |
std::string | id () const |
Get the marker id. More... | |
virtual bool | inherits (MarkerType type) const =0 |
Checks whether this marker is of the given MarkerType or derives from it. More... | |
int | label () const |
virtual void | loadFromMap (std::map< std::string, std::string > const &values) |
bool | manual () const |
virtual MarkerType | markerType () const =0 |
Get the MarkerType enum value for this marker. More... | |
bool | needsFeatureUpdate () const |
virtual bool | occupiesPositionUm (blitz::TinyVector< double, 3 > const &positionUm) const =0 |
This methods checks whether the given micrometer world position is within the marker volume and is mainly used to test whether it needs to be drawn by its renderers. More... | |
Marker & | operator= (Marker const &marker) |
Copy assignment operator. More... | |
double | phi () const |
blitz::TinyVector< double, 3 > | positionUm () const |
Get the absolute marker world position in micrometers. More... | |
int | predictedLabel () const |
const std::map< int, double > & | probabilityMap () const |
std::map< int, double >::iterator | probabilityMapBegin () |
std::map< int, double >::iterator | probabilityMapEnd () |
std::map< int, double >::iterator | probabilityMapFind (int key) |
double | qcDistanceUm () const |
double | radialDistanceUm () const |
blitz::TinyVector< float, 3 > const & | randomColor () const |
If the view type is set to random use this color to obtain the marker color to use. More... | |
blitz::TinyVector< double, 3 > | relativePositionUm () const |
Get the marker position relative to the group transformation. More... | |
void | removeRenderer (ViewWidget *view) |
Remove the renderer for the given view. More... | |
MarkerRenderer * | renderer (ViewWidget *view) const |
Get the rendering engine for this Marker and the given view. More... | |
const std::map< ViewWidget *, MarkerRenderer * > & | renderers () const |
Get a map containing all ViewWidgets this Marker is currently drawn in and the corresponding MarkerRenderers. More... | |
virtual void | saveCSV (std::ofstream &out) const |
bool | selected () const |
void | setChannel (AnnotationChannelSpecs *channel) |
Add this marker to the given channel. More... | |
void | setId (const std::string &id) |
Set the marker id. More... | |
void | setLabel (const int label) |
void | setManual (const bool manual) |
void | setNeedsFeatureUpdate (bool needsFeatureUpdate) |
void | setPhi (const double phi) |
void | setPositionUm (const blitz::TinyVector< double, 3 > &positionUm) |
Set the absolute marker world position in micrometers. More... | |
void | setPredictedLabel (const int label) |
void | setQcDistanceUm (const double qcDistanceUm) |
void | setRadialDistanceUm (const double radialDistanceUm) |
void | setRelativePositionUm (const blitz::TinyVector< double, 3 > &positionUm) |
Set the marker position relative to the group transformation. More... | |
void | setSelected (bool selected) |
bool | updatesEnabled () const |
Check whether cache updates for this marker are enabled. More... | |
virtual void | writeCSVHeader (std::ofstream &out) const |
Static Public Member Functions | |
static void | load (AnnotationChannelSpecs *channel, BlitzH5File const &inFile, std::string const &group, iRoCS::ProgressReporter *pr=NULL) |
static MarkerType | markerTypeFromString (QString const &name) |
Get the MarkerType corresponding to the given string representation. More... | |
static QString | markerTypeToString (Marker::MarkerType m) |
Get the string representation of the given MarkerType. More... | |
static void | save (AnnotationChannelSpecs const *channel, BlitzH5File &outFile, std::string const &group, iRoCS::ProgressReporter *pr=NULL) |
static QStringList | supportedMarkerTypes () |
Get a QStringList containing string representations of all marker types. More... | |
Protected Member Functions | |
virtual void | _updateBoundingBox () const =0 |
void | setFeatures (const std::vector< double > &features) |
void | setProbabilityMap (const std::map< int, double > &probabilityMap) |
Static Protected Member Functions | |
static void | _loadFixedSize (blitz::Array< bool, 1 > &buf, BlitzH5File const &inFile, std::string const &dsName, bool showWarnings=false) |
template<typename DataT > | |
static void | _loadFixedSize (blitz::Array< DataT, 1 > &buf, BlitzH5File const &inFile, std::string const &dsName, bool showWarnings=false) |
Protected Attributes | |
blitz::TinyVector< double, 3 > | _boundingBoxLowerBoundUm |
This variable contains the lower bound of this marker in micrometers relative to its world position in micrometers. More... | |
blitz::TinyVector< double, 3 > | _boundingBoxUpperBoundUm |
This variable contains the lower bound of this marker in micrometers relative to its world position in micrometers. More... | |
bool | _boundingBoxUpToDate |
If this variable is set to false, the next query for the marker's bounding box will update it. More... | |
std::vector< double > | _features |
std::string | _id |
int | _label |
bool | _manual |
bool | _needsFeatureUpdate |
double | _phi |
blitz::TinyVector< double, 3 > | _positionUm |
int | _predictedLabel |
std::map< int, double > | _probabilityMap |
double | _qcDistance |
double | _radialDistance |
blitz::TinyVector< float, 3 > | _randomColor |
std::map< ViewWidget *, MarkerRenderer * > | _renderers |
AnnotationChannelSpecs * | p_channel |
Friends | |
class | AnnotationChannelSpecs |
class | MarkerControlWidget |
The Marker class specifies the properties of an abstract Marker that can be contained in an AnnotationChannelSpecs.
enum Marker::MarkerType |
Marker.hh "liblabelling_qt4/Marker.hh".
The MarkerType enumeration enumerates all available marker types.
If you want to add a new marker type you will have to add it to this enum and change supportedMarkerTypes(), markerTypeFromString() and markerTypeToString().
Enumerator | |
---|---|
Point | |
Sphere | |
Nucleus | |
Cylinder | |
SHSurface | |
Surface | |
Cell |
Marker::Marker | ( | AnnotationChannelSpecs * | channel = NULL | ) |
Constructor.
Creates a new marker at the origin and sets its parent (AnnotationChannelSpecs) to the channel given. If you create a marker in a currently displayed channel it might be a good idea to first create it without parent, set all its properties and then add it to the Channel using setChannel() to avoid view update cycles.
channel | The annotation channel to add this marker to. You can set this later using setChannel(). |
Marker::Marker | ( | blitz::TinyVector< double, 3 > const & | positionUm, |
AnnotationChannelSpecs * | channel = NULL |
||
) |
Constructor.
Creates a new marker at the specified position and sets its parent (AnnotationChannelSpecs) to the channel given. If you create a marker in a currently displayed channel it might be a good idea to first create it without parent, set all its properties and then add it to the Channel using setChannel() to avoid view update cycles.
positionUm | The marker position in micrometers |
channel | The annotation channel to add this marker to. You can set this later using setChannel(). |
Marker::Marker | ( | Marker const & | marker | ) |
Copy constructor.
Creates a new marker that is identical to the old marker. The new marker will be created without parent channel you have to manually add it to a channel using setChannel().
marker | The original marker |
|
virtual |
Destructor.
|
static |
Get a QStringList containing string representations of all marker types.
When the user selects to add a new Annotation channel, the items of this list are presented as choices for the marker type of the new annotation channel. So if you want to add a new marker type that is only automatically generated or don't want the user to be able to manually create an annotation channel of that marker type, just do not add it to the list.
|
static |
Get the MarkerType corresponding to the given string representation.
If the string has no corresponding MarkerType the program will report an error and immediately shut down!
name | The string representation of a MarkerType |
|
static |
Get the string representation of the given MarkerType.
m | The MarkerType |
Copy assignment operator.
Copies all attributes of the given Marker to this marker. Only the parent channel stays untouched.
marker | The marker to copy all attributes from |
|
pure virtual |
Get the MarkerType enum value for this marker.
This method must be implemented by all sub-classes.
Implemented in NucleusMarker, CellMarker, CylinderMarker, SphereMarker, SHSurfaceMarker, SurfaceMarker, and PointMarker.
|
pure virtual |
Checks whether this marker is of the given MarkerType or derives from it.
This method must be implemented by all sub-classes.
true
if this marker is of the given MarkerType or a descendent, false
otherwise Implemented in NucleusMarker, CellMarker, CylinderMarker, SphereMarker, SHSurfaceMarker, SurfaceMarker, and PointMarker.
void Marker::setChannel | ( | AnnotationChannelSpecs * | channel | ) |
Add this marker to the given channel.
This implies removing it from its old channel if there was one. You can pass NULL here if you want to remove any channel association from this marker.
channel | The new channel this marker belongs to |
AnnotationChannelSpecs* Marker::channel | ( | ) | const |
Get the channel this marker belongs to.
If the marker has no parent NULL is returned.
|
pure virtual |
Add a rendering engine for the given view to this marker.
For each marker type - view type pair such a Renderer must exist, that is responsible to get an appropriate visualization of the marker in the corresponding type of view. A marker can be rendered in arbitrarily many views simulataneously. This method, however, must take care that the marker is registered to a specific view at most once. Markers without associated renderers will not be drawn at all.
view | The ViewWidget to register this marker to for rendering |
Implemented in NucleusMarker, CellMarker, CylinderMarker, SphereMarker, SHSurfaceMarker, SurfaceMarker, and PointMarker.
void Marker::removeRenderer | ( | ViewWidget * | view | ) |
Remove the renderer for the given view.
view | The view to remove this Marker from |
MarkerRenderer* Marker::renderer | ( | ViewWidget * | view | ) | const |
Get the rendering engine for this Marker and the given view.
view | The view to get the renderer for this marker for |
const std::map<ViewWidget*, MarkerRenderer*>& Marker::renderers | ( | ) | const |
Get a map containing all ViewWidgets this Marker is currently drawn in and the corresponding MarkerRenderers.
std::string Marker::id | ( | ) | const |
void Marker::setId | ( | const std::string & | id | ) |
Set the marker id.
This attribute is never stored and only used for visualization in the current session.
id | The session id of this marker |
blitz::TinyVector<double,3> Marker::positionUm | ( | ) | const |
Get the absolute marker world position in micrometers.
The result is just the relative position transformed by the channel transformation matrix.
void Marker::setPositionUm | ( | const blitz::TinyVector< double, 3 > & | positionUm | ) |
Set the absolute marker world position in micrometers.
Internally this alters the relative position by applying the inverse channel transformation to the given position.
positionUm | The absolute world position in micrometers |
blitz::TinyVector<double,3> Marker::relativePositionUm | ( | ) | const |
Get the marker position relative to the group transformation.
void Marker::setRelativePositionUm | ( | const blitz::TinyVector< double, 3 > & | positionUm | ) |
Set the marker position relative to the group transformation.
positionUm | The marker position in micrometers in the coordinate system defined by the channel transformation |
bool Marker::manual | ( | ) | const |
void Marker::setManual | ( | const bool | manual | ) |
bool Marker::needsFeatureUpdate | ( | ) | const |
void Marker::setNeedsFeatureUpdate | ( | bool | needsFeatureUpdate | ) |
int Marker::label | ( | ) | const |
void Marker::setLabel | ( | const int | label | ) |
int Marker::predictedLabel | ( | ) | const |
void Marker::setPredictedLabel | ( | const int | label | ) |
const std::vector<double>& Marker::features | ( | ) | const |
double& Marker::feature | ( | size_t | index | ) |
std::vector<double>::iterator Marker::featuresBegin | ( | ) |
std::vector<double>::iterator Marker::featuresEnd | ( | ) |
const std::map<int,double>& Marker::probabilityMap | ( | ) | const |
std::map<int,double>::iterator Marker::probabilityMapFind | ( | int | key | ) |
std::map<int,double>::iterator Marker::probabilityMapBegin | ( | ) |
std::map<int,double>::iterator Marker::probabilityMapEnd | ( | ) |
double Marker::qcDistanceUm | ( | ) | const |
void Marker::setQcDistanceUm | ( | const double | qcDistanceUm | ) |
double Marker::radialDistanceUm | ( | ) | const |
void Marker::setRadialDistanceUm | ( | const double | radialDistanceUm | ) |
double Marker::phi | ( | ) | const |
void Marker::setPhi | ( | const double | phi | ) |
blitz::TinyVector<float,3> const& Marker::randomColor | ( | ) | const |
If the view type is set to random use this color to obtain the marker color to use.
|
static |
|
static |
|
virtual |
Reimplemented in NucleusMarker, CellMarker, CylinderMarker, SHSurfaceMarker, SphereMarker, and SurfaceMarker.
|
virtual |
Reimplemented in NucleusMarker, CellMarker, CylinderMarker, SHSurfaceMarker, SphereMarker, SurfaceMarker, and PointMarker.
|
virtual |
Reimplemented in NucleusMarker, CellMarker, CylinderMarker, SHSurfaceMarker, SphereMarker, SurfaceMarker, and PointMarker.
void Marker::setSelected | ( | bool | selected | ) |
bool Marker::selected | ( | ) | const |
|
pure virtual |
This methods checks whether the given micrometer world position is within the marker volume and is mainly used to test whether it needs to be drawn by its renderers.
It need not be exact, but should at least respect the bounding box of the Marker.
positionUm | The world position in micrometers to check for intersection with this marker |
true
if the position is within the marker, false
otherwise Implemented in CylinderMarker, SHSurfaceMarker, SphereMarker, SurfaceMarker, and PointMarker.
blitz::TinyVector<double,3> Marker::boundingBoxLowerBoundUm | ( | ) | const |
Get the lower bound of the marker's bounding box for all dimensions.
blitz::TinyVector<double,3> Marker::boundingBoxUpperBoundUm | ( | ) | const |
Get the upper bound of the marker's bounding box for all dimensions.
bool Marker::updatesEnabled | ( | ) | const |
Check whether cache updates for this marker are enabled.
|
virtual |
Reimplemented in NucleusMarker, SHSurfaceMarker, and SphereMarker.
|
virtual |
Reimplemented in NucleusMarker, SHSurfaceMarker, and SphereMarker.
|
slot |
Enables/Disables cache updates for this marker.
If you programmatically apply many subsequent changes to a marker disable cache updates, otherwise each operation triggers a cache update.
enable | true to enable cache updates, false to disable cache updates |
|
slot |
Explicitely trigger a cache update for all associated renderers.
This is only necessary if updates were disabled and after all changes the cache has to be updated. If updates are disabled a call to this function is a noop.
|
protected |
|
protected |
|
staticprotected |
|
inlinestaticprotected |
|
protectedpure virtual |
Implemented in CylinderMarker, SphereMarker, and PointMarker.
Referenced by _loadFixedSize().
|
friend |
|
friend |
|
protected |
|
protected |
|
mutableprotected |
|
mutableprotected |
|
mutableprotected |