14 #include <ctkPluginContext.h> 15 #include <vtkImageData.h> 39 this->createInterconnectedDataAndSpace();
54 mUnavailableData.clear();
57 void PatientModelImplService::createInterconnectedDataAndSpace()
68 mActiveData.reset(
new ActiveData(patientModelService, session));
72 mDataService->setSpaceProvider(spaceProvider);
74 mDataFactory.reset(
new DataFactory(patientModelService, spaceProvider));
75 mDataService->setDataFactory(mDataFactory);
77 mPatientData.reset(
new PatientData(mDataService, session));
80 void PatientModelImplService::shutdownInterconnectedDataAndSpace()
88 mDataService->clear();
109 this->shutdownInterconnectedDataAndSpace();
114 QString outputBasePath = this->patientData()->getActivePatientFolder();
116 this->dataService()->loadData(data);
117 data->save(outputBasePath);
122 return dataService()->getDataFactory()->create(type, uid, name);
127 std::map<QString, DataPtr> retval = dataService()->getData();
131 for(
int i = 0; i < mUnavailableData.size(); ++i)
133 if (retval.count(mUnavailableData[i]))
134 retval.erase(mUnavailableData[i]);
144 std::map<QString, DataPtr>::const_iterator iter = dataMap.find(uid);
145 if (iter == dataMap.end())
152 std::map<QString, DataPtr> retval;
154 std::map<QString, DataPtr>::const_iterator iter = dataMap.begin();
155 for ( ; iter != dataMap.end(); ++iter)
157 if((iter->second->getParentSpace() == parent_uid))
158 if((of_type ==
"") || (iter->second->getType() == of_type))
159 retval[iter->first] = iter->second;
167 return dataService()->getPatientLandmarks();
172 return dataService()->getLandmarkProperties();
177 dataService()->setLandmarkName(uid, name);
182 return dataService()->get_rMpr();
187 this->patientData()->autoSave();
198 mUnavailableData.push_back(uid);
201 std::vector<QString>::iterator iter = std::find(mUnavailableData.begin(), mUnavailableData.end(), uid);
202 if(iter != mUnavailableData.end())
203 mUnavailableData.erase(iter);
209 return dataService()->getClinicalApplication();
214 dataService()->setClinicalApplication(application);
219 return dataService()->getStreams();
224 return this->patientData()->getActivePatientFolder();
229 return this->patientData()->isPatientValid();
234 return this->patientData()->importData(fileName, infoText);
239 this->patientData()->exportPatient(externalSpace);
244 this->patientData()->removeData(uid);
249 return dataService()->getPresetTransferFunctions3D();
254 this->dataService()->setCenter(center);
259 return this->dataService()->getCenter();
264 this->dataService()->setOperatingTable(ot);
269 return this->dataService()->getOperatingTable();
274 return dataService()->addLandmark();
279 return dataService()->deleteLandmarks();
284 dataService()->setLandmarkActive(uid, active);
289 return this->dataService()->get_rMpr_History();
307 void PatientModelImplService::probesChanged()
309 this->disconnectProbes();
311 this->connectProbes();
314 void PatientModelImplService::disconnectProbes()
316 for (std::map<QString, ToolPtr>::const_iterator iter = mProbeTools.begin(); iter != mProbeTools.end(); ++iter)
318 ProbePtr probe = iter->second->getProbe();
322 CX_LOG_WARNING() <<
"PatientModelImplService::disconnectProbes: Tool is not a probe: " << iter->second->getUid();
326 void PatientModelImplService::connectProbes()
328 ToolMap tools = mTrackingService->getTools();
329 for (ToolMap::const_iterator iter = tools.begin(); iter != tools.end(); ++iter)
335 mProbeTools[iter->first] = tool;
341 void PatientModelImplService::videoSourceAdded(
VideoSourcePtr source)
343 ToolPtr tool = this->getProbeTool(source->getUid());
347 QString uid = source->getUid() + tool->getUid();
348 QString name = source->getName() +
" - " + tool->getName();
349 TrackedStreamPtr trackedStream = this->dataService()->getTrackedStream(uid);
351 trackedStream = this->createSpecificData<TrackedStream>(uid, name);
352 trackedStream->setProbeTool(tool);
353 trackedStream->setVideoSource(source);
354 trackedStream->setSpaceProvider(mDataService->getSpaceProvider());
357 this->dataService()->loadData(trackedStream);
359 this->reEmitActiveTrackedStream(trackedStream);
362 void PatientModelImplService::reEmitActiveTrackedStream(
TrackedStreamPtr trackedStream)
365 mActiveData->setActive(trackedStream);
368 ToolPtr PatientModelImplService::getProbeTool(QString videoSourceUid)
370 for (std::map<QString, ToolPtr>::const_iterator iter = mProbeTools.begin(); iter != mProbeTools.end(); ++iter)
374 if(probe && probe->getAvailableVideoSources().contains(videoSourceUid))
boost::shared_ptr< class SpaceProvider > SpaceProviderPtr
void rMprChanged()
emitted when the transformation between patient reference and (data) reference is set ...
virtual void setCenter(const Vector3D ¢er)
boost::shared_ptr< class RegistrationHistory > RegistrationHistoryPtr
OperatingTable getOperatingTable() const
virtual PresetTransferFunctions3DPtr getPresetTransferFunctions3D() const
void operatingTableChanged()
void dataAddedOrRemoved()
virtual bool isPatientValid() const
void landmarkPropertiesChanged()
emitted when global info about a landmark changed
boost::shared_ptr< class TrackedStream > TrackedStreamPtr
virtual Transform3D get_rMpr() const
get the patient registration transform
Provides the last active data of warious types.
Transform3D Transform3D
Transform3D is a representation of an affine 3D transform.
virtual DataPtr importData(QString fileName, QString &infoText)
boost::shared_ptr< class TransferFunctions3DPresets > PresetTransferFunctions3DPtr
virtual DataPtr createData(QString type, QString uid, QString name)
virtual void deleteLandmarks()
Functionality for storing patient data in a folder on the disk and access to these data...
static SessionStorageServicePtr create(ctkPluginContext *pluginContext)
boost::shared_ptr< class ActiveData > ActiveDataPtr
void landmarkPropertiesChanged()
emitted when global info about a landmark changed
virtual ActiveDataPtr getActiveData() const
void centerChanged()
emitted when center is changed.
static VideoServicePtr create(ctkPluginContext *pluginContext)
A data set for video streams (2D/3D).
void centerChanged()
emitted when center is changed.
boost::shared_ptr< class DataManager > DataServicePtr
boost::shared_ptr< class Landmarks > LandmarksPtr
virtual void makeAvailable(const QString &uid, bool available)
Exclude this data from getDatas()
virtual void insertData(DataPtr data)
static TrackingServicePtr create(ctkPluginContext *pluginContext)
void setOperatingTable(const OperatingTable &ot)
boost::shared_ptr< Probe > ProbePtr
static PatientModelServicePtr create(ctkPluginContext *pluginContext)
boost::shared_ptr< class Data > DataPtr
void videoSourceAdded(VideoSourcePtr source)
static DataManagerImplPtr create(ActiveDataPtr activeData)
virtual void removeData(QString uid)
virtual std::map< QString, DataPtr > getChildren(QString parent_uid, QString of_type="") const
void reportWarning(QString msg)
void dataAddedOrRemoved()
std::map< QString, ToolPtr > ToolMap
boost::shared_ptr< class PatientModelService > PatientModelServicePtr
boost::shared_ptr< class VideoSource > VideoSourcePtr
virtual QString addLandmark()
void clinicalApplicationChanged()
void videoAddedToTrackedStream()
virtual Vector3D getCenter() const
current common center point for user viewing.
virtual QString getActivePatientFolder() const
virtual LandmarksPtr getPatientLandmarks() const
landmark defined in patient space
void operatingTableChanged()
Eigen::Vector3d Vector3D
Vector3D is a representation of a point or vector in 3D.
virtual CLINICAL_VIEW getClinicalApplication() const
virtual void setLandmarkActive(QString uid, bool active)
virtual std::map< QString, VideoSourcePtr > getStreams() const
virtual void exportPatient(PATIENT_COORDINATE_SYSTEM externalSpace)
boost::shared_ptr< PatientData > PatientDataPtr
virtual ~PatientModelImplService()
virtual std::map< QString, DataPtr > getDatas(DataFilter filter) const
PatientModelImplService(ctkPluginContext *context)
virtual RegistrationHistoryPtr get_rMpr_History() const
The OperatingTable class.
boost::shared_ptr< class DataFactory > DataFactoryPtr
virtual std::map< QString, LandmarkProperty > getLandmarkProperties() const
virtual void setLandmarkName(QString uid, QString name)
void requireUnique(int use_count, QString objectName)
void clinicalApplicationChanged()
virtual void setClinicalApplication(CLINICAL_VIEW application)
boost::shared_ptr< class SessionStorageService > SessionStorageServicePtr
virtual DataPtr getData(const QString &uid) const
Namespace for all CustusX production code.
boost::shared_ptr< class Tool > ToolPtr