76 std::vector<DataMetricPtr> MetricManager::getAllMetrics()
78 std::vector<DataMetricPtr> retval;
80 for (std::map<QString, DataPtr>::iterator iter=all.begin(); iter!=all.end(); ++iter)
84 retval.push_back(metric);
91 mSelection = selection;
96 mActiveLandmark = uid;
106 Vector3D p_r = metric->getRefCoord();;
107 this->setManualToolPosition(p_r);
110 void MetricManager::setManualToolPosition(
Vector3D p_r)
113 Vector3D p_pr = rMpr.inv().coord(p_r);
117 Vector3D offset = tool->get_prMt().vector(
Vector3D(0, 0, tool->getTooltipOffset()));
119 p_r = rMpr.coord(p_pr);
132 p1->setCoordinate(point);
145 this->addPointInDefaultPosition();
151 QColor color = QColor(240, 170, 255, 255);
157 return this->
addPoint(p_ref, ref,
"point%1", color);
162 ref = pointMetric->getSpace();
166 DataMetricPtr metric = boost::dynamic_pointer_cast<DataMetric>(data);
168 color = metric->getColor();
172 return this->
addPoint(p_ref, ref,
"point%1", color);
184 frame->setSpace(ref);
185 frame->setFrame(rMt);
187 this->installNewMetric(frame);
198 frame->setSpace(ref);
199 frame->setFrame(rMt);
201 frame->setToolOffset(
trackingService()->getActiveTool()->getTooltipOffset());
203 this->installNewMetric(frame);
211 std::vector<DataPtr> args = this->getSpecifiedNumberOfValidArguments(p1->getArguments());
212 for (
unsigned i=0; i<args.size(); ++i)
213 p1->getArguments()->set(i, args[i]);
215 this->installNewMetric(p1);
222 std::vector<DataPtr> MetricManager::refinePointArguments(std::vector<DataPtr> args,
unsigned argNo)
226 for (
unsigned i=0; i<args.size();)
228 if (args.size() <= argNo)
230 if (!mSelection.count(args[i]->getUid()))
231 args.erase(args.begin()+i);
236 while (args.size() > argNo)
237 args.erase(args.begin());
239 while (args.size() < argNo)
252 this->installNewMetric(d0);
261 std::vector<DataPtr> args = this->getSpecifiedNumberOfValidArguments(d0->getArguments());
262 for (
unsigned i=0; i<args.size(); ++i)
263 d0->getArguments()->set(i, args[i]);
265 this->installNewMetric(d0);
274 std::vector<DataPtr> args = this->getSpecifiedNumberOfValidArguments(d0->getArguments(), 3);
275 d0->getArguments()->set(0, args[0]);
276 d0->getArguments()->set(1, args[1]);
277 d0->getArguments()->set(2, args[1]);
278 d0->getArguments()->set(3, args[2]);
280 this->installNewMetric(d0);
287 std::vector<DataMetricPtr> metrics = this->getAllMetrics();
289 std::vector<DataPtr> args;
290 for (
unsigned i=0; i<metrics.size(); ++i)
292 if (arguments->validArgument(metrics[i]))
293 args.push_back(metrics[i]);
296 if (numberOfRequiredArguments<0)
297 numberOfRequiredArguments = arguments->getCount();
298 args = this->refinePointArguments(args, numberOfRequiredArguments);
307 std::vector<DataPtr> args = this->getSpecifiedNumberOfValidArguments(d0->getArguments());
308 d0->getArguments()->set(0, args[0]);
310 this->installNewMetric(d0);
317 std::vector<DataPtr> args = this->getSpecifiedNumberOfValidArguments(d0->getArguments());
318 d0->getArguments()->set(0, args[0]);
319 d0->getArguments()->set(1, args[1]);
321 this->installNewMetric(d0);
328 std::vector<DataPtr> args = this->getSpecifiedNumberOfValidArguments(d0->getArguments());
329 d0->getArguments()->set(0, args[0]);
330 d0->getArguments()->set(1, args[1]);
332 this->installNewMetric(d0);
340 metric->setColor(prevMetric->getColor());
345 viewService()->getGroup(0)->addData(metric->getUid());
353 reportDebug(
"No reference tool, cannot load reference points into the pointsampler");
357 std::map<int, Vector3D> referencePoints_s = refTool->getReferencePoints();
358 if(referencePoints_s.empty())
360 reportWarning(
"No referenceppoints in reference tool "+refTool->getName());
367 std::map<int, Vector3D>::iterator it = referencePoints_s.begin();
368 for(; it != referencePoints_s.end(); ++it)
378 QFile file(filename);
379 if (!file.open(QIODevice::WriteOnly | QIODevice::Text))
382 std::map<QString, DataPtr> dataMap =
patientService()->getDatas();
383 std::map<QString, DataPtr>::iterator iter;
384 for (iter = dataMap.begin(); iter != dataMap.end(); ++iter)
389 file.write(metric->getAsSingleLineString().toLatin1());
void addFrameButtonClickedSlot()
boost::shared_ptr< class FrameMetric > FrameMetricPtr
boost::shared_ptr< class ToolMetric > ToolMetricPtr
void addSphereButtonClickedSlot()
boost::shared_ptr< class DonutMetric > DonutMetricPtr
Transform3D Transform3D
Transform3D is a representation of an affine 3D transform.
boost::shared_ptr< DataMetric > DataMetricPtr
void addCustomButtonClickedSlot()
void addAngleButtonClickedSlot()
void addToolButtonClickedSlot()
csREF
the data reference space (r) using LPS (left-posterior-superior) coordinates.
boost::shared_ptr< class SphereMetric > SphereMetricPtr
Data class that represents a single frame (transform).
Data class representing a plane.
static CoordinateSystem reference()
boost::shared_ptr< class AngleMetric > AngleMetricPtr
Data class that represents a donut.
boost::shared_ptr< class PlaneMetric > PlaneMetricPtr
void loadReferencePointsSlot()
boost::shared_ptr< class Data > DataPtr
void setSelection(std::set< QString > selection)
virtual RegistrationHistoryPtr get_rMd_History()
void exportMetricsToFile(QString filename)
void reportWarning(QString msg)
void addPlaneButtonClickedSlot()
Data class that represents a custom.
Data class that represents a donut.
boost::shared_ptr< class MetricReferenceArgumentList > MetricReferenceArgumentListPtr
DataMetricPtr getMetric(QString uid)
Transform3D createTransformTranslate(const Vector3D &translation)
Identification of a Coordinate system.
boost::shared_ptr< class DistanceMetric > DistanceMetricPtr
Data class that represents a distance between two points, or a point and a plane. ...
boost::shared_ptr< class RegionOfInterestMetric > RegionOfInterestMetricPtr
void addPointButtonClickedSlot()
cxLogicManager_EXPORT SpaceProviderPtr spaceProvider()
Data class that represents a single point.
Eigen::Vector3d Vector3D
Vector3D is a representation of a point or vector in 3D.
cxLogicManager_EXPORT ViewServicePtr viewService()
void addDonutButtonClickedSlot()
cxLogicManager_EXPORT PatientModelServicePtr patientService()
PointMetricPtr addPoint(Vector3D point, CoordinateSystem space=CoordinateSystem(csREF), QString uid="point%1", QColor color=QColor(240, 170, 255, 255))
cxLogicManager_EXPORT TrackingServicePtr trackingService()
void addROIButtonClickedSlot()
void activeMetricChanged()
void addDistanceButtonClickedSlot()
Base class for all Data Metrics.
boost::shared_ptr< class CustomMetric > CustomMetricPtr
Data class that represents an angle between two lines.
void moveToMetric(QString uid)
void reportDebug(QString msg)
void setActiveUid(QString uid)
boost::shared_ptr< class PointMetric > PointMetricPtr
boost::shared_ptr< class Tool > ToolPtr