46 DataMetric(uid, name, dataManager, spaceProvider)
48 mUseSimpleVisualization =
false;
49 mArguments.reset(
new MetricReferenceArgumentList(QStringList() <<
"point 0" <<
"point 1" <<
"point 2" <<
"point 3"));
50 mArguments->setValidArgumentTypes(QStringList() <<
"pointMetric");
51 connect(mArguments.get(), SIGNAL(argumentsChanged()),
this, SLOT(resetCachedValues()));
52 connect(mArguments.get(), SIGNAL(argumentsChanged()),
this, SIGNAL(
transformChanged()));
74 mArguments->addXml(dataNode);
75 dataNode.toElement().setAttribute(
"useSimpleVisualization", QString::number(mUseSimpleVisualization));
84 mUseSimpleVisualization = dataNode.toElement().attribute(
"useSimpleVisualization", QString::number(mUseSimpleVisualization)).toInt();
85 this->resetCachedValues();
88 void AngleMetric::resetCachedValues()
90 mCachedEndPoints.
reset();
100 if (!mCachedEndPoints.
isValid())
102 mCachedEndPoints.
set(mArguments->getRefCoords());
104 return mCachedEndPoints.
get();
119 Vector3D a = (p[0] - p[1]).normalized();
120 Vector3D b = (p[3] - p[2]).normalized();
122 double angle = acos(
dot(a, b) / a.length() / b.length());
128 return QString(
"%1*").arg(this->
getAngle() /
M_PI * 180, 0,
'f', 1);
138 return QString(
"%1 %2")
145 return mUseSimpleVisualization;
150 mUseSimpleVisualization = val;
boost::shared_ptr< class SpaceProvider > SpaceProviderPtr
QString qstring_cast(const T &val)
void addXml(QDomNode &dataNode)
adds xml information about the data and its variabels
virtual void parseXml(QDomNode &dataNode)
Use a XML node to load data.
static AngleMetricPtr create(QString uid, QString name, PatientModelServicePtr dataManager, SpaceProviderPtr spaceProvider)
virtual void addXml(QDomNode &dataNode)
adds xml information about the data and its variabels
void propertiesChanged()
emitted when one of the metadata properties (uid, name etc) changes
virtual Vector3D getRefCoord() const
PatientModelServicePtr mDataManager
boost::shared_ptr< class AngleMetric > AngleMetricPtr
virtual QString getValueAsString() const
static DoubleBoundingBox3D fromCloud(std::vector< Vector3D > cloud)
bool getUseSimpleVisualization() const
void parseXml(QDomNode &dataNode)
Use a XML node to load data.
virtual bool isValid() const
virtual DoubleBoundingBox3D boundingBox() const
boost::shared_ptr< class PatientModelService > PatientModelServicePtr
QString getSingleLineHeader() const
double dot(const Vector3D &a, const Vector3D &b)
compute inner product (or dot product) of a and b.
Representation of a floating-point bounding box in 3D. The data are stored as {xmin,xmax,ymin,ymax,zmin,zmax}, in order to simplify communication with vtk.
void setUseSimpleVisualization(bool val)
cxLogicManager_EXPORT SpaceProviderPtr spaceProvider()
Eigen::Vector3d Vector3D
Vector3D is a representation of a point or vector in 3D.
std::vector< Vector3D > getEndpoints() const
virtual QString getAsSingleLineString() const
Data class that represents an angle between two lines.