void ImageLandmarksWidget::importPointMetricsToLandmarkButtonClickedSlot() { DataPtr image = this->getCurrentData(); if(!image) return; std::map<QString, DataPtr> point_metrics = mServices->patient()->getChildren(image->getUid(), "pointMetric"); std::map<QString, DataPtr>::iterator it = point_metrics.begin(); //Make sure we have enough landmarks int number_of_landmarks = mServices->patient()->getLandmarkProperties().size(); int number_of_metrics = point_metrics.size(); for(int i=number_of_landmarks; i<number_of_metrics; ++i) { QString uid = mServices->patient()->addLandmark(); } for(; it != point_metrics.end(); ++it) { PointMetricPtr point_metric = boost::static_pointer_cast<PointMetric>(it->second); if(!point_metric) continue; Vector3D pos_x = point_metric->getCoordinate(); //Transform3D d_M_x = mServices->spaceProvider()->get_toMfrom(CoordinateSystem::fromString(image->getSpace()), point_metric->getSpace()); //Vector3D pos_d = d_M_x.coord(pos_x); QString point_metric_name = point_metric->getName(); image->getLandmarks()->setLandmark(Landmark(point_metric_name, pos_x)); this->activateLandmark(point_metric_name); } }
QString StringPropertyRegistrationMovingImage::getValue() const { DataPtr image = mRegistrationService->getMovingData(); if (!image) return ""; return qstring_cast(image->getUid()); }
void ClipperWidget::updateCheckBoxFromClipper(QCheckBox *checkbox, DataPtr data) { if(!mClipper) return; std::map<QString, DataPtr> datas = mClipper->getDatas(); bool checked = datas.count(data->getUid()); checkbox->setChecked(checked); }
boost::shared_ptr<QWidget> WidgetTypeRepository::findMetricWidget(DataPtr data) { for (unsigned i=0; i<mWidgets.size(); ++i) { boost::shared_ptr<SingleMetricWidget> w = boost::dynamic_pointer_cast<SingleMetricWidget>(mWidgets[i]); if(w && w->getData() && data && w->getData()->getUid() == data->getUid()) return w; } return boost::shared_ptr<QWidget>(); }
void TreeRepository::insertDataNode(DataPtr data) { if (this->getNode(data->getUid())) return; this->appendNode(new DataTreeNode(mSelf, data)); this->appendNode(new ShowVolumeDataTreeNode(mSelf, data)); this->appendNode(new ShowSlice2DDataTreeNode(mSelf, data)); this->appendNode(new ShowSlice3DDataTreeNode(mSelf, data)); }
void RegistrationImplService::addXml(QDomNode& parentNode) { QDomDocument doc = parentNode.ownerDocument(); QDomElement base = doc.createElement("registrationManager"); parentNode.appendChild(base); QDomElement fixedDataNode = doc.createElement("fixedDataUid"); DataPtr fixedData = this->getFixedData(); if(fixedData) { fixedDataNode.appendChild(doc.createTextNode(fixedData->getUid())); } base.appendChild(fixedDataNode); QDomElement movingDataNode = doc.createElement("movingDataUid"); DataPtr movingData = this->getMovingData(); if(movingData) { movingDataNode.appendChild(doc.createTextNode(movingData->getUid())); } base.appendChild(movingDataNode); }
void ViewWrapper3D::addVolumeDataRep(DataPtr data) { if (!data) return; ImagePtr image = boost::dynamic_pointer_cast<Image>(data); if (image) { mMultiVolume3DRepProducer->addImage(image); } else { if (!mDataReps.count(data->getUid())) { RepPtr rep = this->createDataRep3D(data); if (rep) { mDataReps[data->getUid()] = rep; mView->addRep(rep); } } } }
void DataManagerImpl::loadData(DataPtr data) { if (data->getUid().contains('%')) { QString uid = data->getUid(); QString name = data->getName(); this->generateUidAndName(&uid, &name); data->setName(name); data->setUid(uid); } if (data) { if (mData.count(data->getUid()) && mData[data->getUid()]!=data) reportError(QString("Overwriting Data with uid=%1 with new object into PasM").arg(data->getUid())); // this->verifyParentFrame(data); mData[data->getUid()] = data; emit dataAddedOrRemoved(); } }
void RegistrationImplService::setFixedData(DataPtr data) { this->setFixedData((data) ? data->getUid() : ""); }