74 std::vector<DataMetricPtr> MetricManager::getAllMetrics()
76 std::vector<DataMetricPtr> retval;
78 for (std::map<QString, DataPtr>::iterator iter=all.begin(); iter!=all.end(); ++iter)
82 retval.push_back(metric);
89 mSelection = selection;
94 mActiveLandmark = uid;
104 Vector3D p_r = metric->getRefCoord();;
105 this->setManualToolPosition(p_r);
108 void MetricManager::setManualToolPosition(
Vector3D p_r)
111 Vector3D p_pr = rMpr.inv().coord(p_r);
115 Vector3D offset = tool->get_prMt().vector(
Vector3D(0, 0, tool->getTooltipOffset()));
117 p_r = rMpr.coord(p_pr);
125 PointMetricPtr MetricManager::addPoint(
Vector3D point, CoordinateSystem space, QString name, QColor color)
128 p1->get_rMd_History()->setParentSpace(
"reference");
130 p1->setCoordinate(point);
143 this->addPointInDefaultPosition();
149 QColor color = QColor(240, 170, 255, 255);
155 return this->addPoint(p_ref, ref,
"point%1", color);
160 ref = pointMetric->getSpace();
164 DataMetricPtr metric = boost::dynamic_pointer_cast<DataMetric>(data);
166 color = metric->getColor();
170 return this->addPoint(p_ref, ref,
"point%1", color);
182 frame->setSpace(ref);
183 frame->setFrame(rMt);
185 this->installNewMetric(frame);
196 frame->setSpace(ref);
197 frame->setFrame(rMt);
199 frame->setToolOffset(
trackingService()->getActiveTool()->getTooltipOffset());
201 this->installNewMetric(frame);
209 std::vector<DataPtr> args = this->getSpecifiedNumberOfValidArguments(p1->getArguments());
210 for (
unsigned i=0; i<args.size(); ++i)
211 p1->getArguments()->set(i, args[i]);
213 this->installNewMetric(p1);
220 std::vector<DataPtr> MetricManager::refinePointArguments(std::vector<DataPtr> args,
unsigned argNo)
224 for (
unsigned i=0; i<args.size();)
226 if (args.size() <= argNo)
228 if (!mSelection.count(args[i]->getUid()))
229 args.erase(args.begin()+i);
234 while (args.size() > argNo)
235 args.erase(args.begin());
237 while (args.size() < argNo)
252 std::vector<DataPtr> args = this->getSpecifiedNumberOfValidArguments(d0->getArguments());
253 for (
unsigned i=0; i<args.size(); ++i)
254 d0->getArguments()->set(i, args[i]);
256 this->installNewMetric(d0);
265 std::vector<DataPtr> args = this->getSpecifiedNumberOfValidArguments(d0->getArguments(), 3);
266 d0->getArguments()->set(0, args[0]);
267 d0->getArguments()->set(1, args[1]);
268 d0->getArguments()->set(2, args[1]);
269 d0->getArguments()->set(3, args[2]);
271 this->installNewMetric(d0);
278 std::vector<DataMetricPtr> metrics = this->getAllMetrics();
280 std::vector<DataPtr> args;
281 for (
unsigned i=0; i<metrics.size(); ++i)
283 if (arguments->validArgument(metrics[i]))
284 args.push_back(metrics[i]);
287 if (numberOfRequiredArguments<0)
288 numberOfRequiredArguments = arguments->getCount();
289 args = this->refinePointArguments(args, numberOfRequiredArguments);
298 std::vector<DataPtr> args = this->getSpecifiedNumberOfValidArguments(d0->getArguments());
299 d0->getArguments()->set(0, args[0]);
301 this->installNewMetric(d0);
308 std::vector<DataPtr> args = this->getSpecifiedNumberOfValidArguments(d0->getArguments());
309 d0->getArguments()->set(0, args[0]);
310 d0->getArguments()->set(1, args[1]);
312 this->installNewMetric(d0);
320 metric->setColor(prevMetric->getColor());
325 viewService()->getGroup(0)->addData(metric->getUid());
333 reportDebug(
"No reference tool, cannot load reference points into the pointsampler");
337 std::map<int, Vector3D> referencePoints_s = refTool->getReferencePoints();
338 if(referencePoints_s.empty())
340 reportWarning(
"No referenceppoints in reference tool "+refTool->getName());
347 std::map<int, Vector3D>::iterator it = referencePoints_s.begin();
348 for(; it != referencePoints_s.end(); ++it)
358 QFile file(filename);
359 if (!file.open(QIODevice::WriteOnly | QIODevice::Text))
363 std::map<QString, DataPtr>::iterator iter;
364 for (iter = dataMap.begin(); iter != dataMap.end(); ++iter)
369 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 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 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. ...
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()
cxLogicManager_EXPORT TrackingServicePtr trackingService()
void activeMetricChanged()
void addDistanceButtonClickedSlot()
Base class for all Data Metrics.
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