35 #include <ctkPluginContext.h>
36 #include <vtkImageData.h>
60 this->createInterconnectedDataAndSpace();
75 void PatientModelImplService::createInterconnectedDataAndSpace()
86 mActiveData.reset(
new ActiveData(patientModelService, session));
93 mDataService->setDataFactory(mDataFactory);
95 mPatientData.reset(
new PatientData(mDataService, session));
98 void PatientModelImplService::shutdownInterconnectedDataAndSpace()
101 mPatientData.reset();
106 mDataService->clear();
109 mDataFactory.reset();
112 mDataService.reset();
127 this->shutdownInterconnectedDataAndSpace();
132 QString outputBasePath = this->patientData()->getActivePatientFolder();
134 this->dataService()->loadData(data);
135 data->save(outputBasePath);
140 return dataService()->getDataFactory()->create(type, uid, name);
145 return dataService()->getData();
150 std::map<QString, DataPtr> dataMap = this->
getData();
151 std::map<QString, DataPtr>::const_iterator iter = dataMap.find(uid);
152 if (iter == dataMap.end())
159 return dataService()->getPatientLandmarks();
164 return dataService()->getLandmarkProperties();
169 dataService()->setLandmarkName(uid, name);
174 return dataService()->get_rMpr();
179 this->patientData()->autoSave();
189 return dataService()->getClinicalApplication();
194 dataService()->setClinicalApplication(application);
199 dataService()->loadData(data);
204 return dataService()->getStreams();
209 return this->patientData()->getActivePatientFolder();
214 return this->patientData()->isPatientValid();
219 return this->patientData()->importData(fileName, infoText);
224 this->patientData()->exportPatient(externalSpace);
229 this->patientData()->removeData(uid);
234 return dataService()->getPresetTransferFunctions3D();
239 this->dataService()->setCenter(center);
244 return this->dataService()->getCenter();
250 return dataService()->addLandmark();
255 dataService()->setLandmarkActive(uid, active);
260 return this->dataService()->get_rMpr_History();
278 void PatientModelImplService::probesChanged()
280 this->disconnectProbes();
282 this->connectProbes();
285 void PatientModelImplService::disconnectProbes()
287 for (std::map<QString, ToolPtr>::const_iterator iter = mProbeTools.begin(); iter != mProbeTools.end(); ++iter)
289 ProbePtr probe = iter->second->getProbe();
293 CX_LOG_WARNING() <<
"PatientModelImplService::disconnectProbes: Tool is not a probe: " << iter->second->getUid();
297 void PatientModelImplService::connectProbes()
299 ToolMap tools = mTrackingService->getTools();
300 for (ToolMap::const_iterator iter = tools.begin(); iter != tools.end(); ++iter)
306 mProbeTools[iter->first] = tool;
312 void PatientModelImplService::videoSourceAdded(
VideoSourcePtr source)
314 ToolPtr tool = this->getProbeTool(source->getUid());
318 QString uid = source->getUid() + tool->getUid();
319 QString name = source->getName() +
" - " + tool->getName();
320 TrackedStreamPtr trackedStream = this->dataService()->getTrackedStream(uid);
322 trackedStream = this->createSpecificData<TrackedStream>(uid, name);
323 trackedStream->setProbeTool(tool);
324 trackedStream->setVideoSource(source);
325 trackedStream->setSpaceProvider(mDataService->getSpaceProvider());
328 this->dataService()->loadData(trackedStream);
330 this->reEmitActiveTrackedStream(trackedStream);
333 void PatientModelImplService::reEmitActiveTrackedStream(
TrackedStreamPtr trackedStream)
335 if(mActiveData->getActive<TrackedStream>() == trackedStream)
336 mActiveData->setActive(trackedStream);
339 ToolPtr PatientModelImplService::getProbeTool(QString videoSourceUid)
341 for (std::map<QString, ToolPtr>::const_iterator iter = mProbeTools.begin(); iter != mProbeTools.end(); ++iter)
345 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
virtual PresetTransferFunctions3DPtr getPresetTransferFunctions3D() const
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)
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)
void centerChanged()
emitted when center is changed.
boost::shared_ptr< class DataManager > DataServicePtr
boost::shared_ptr< class Landmarks > LandmarksPtr
virtual void insertData(DataPtr data)
static TrackingServicePtr create(ctkPluginContext *pluginContext)
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)
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 void loadData(DataPtr data)
virtual LandmarksPtr getPatientLandmarks() const
landmark defined in patient space
cxLogicManager_EXPORT SpaceProviderPtr spaceProvider()
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()
PatientModelImplService(ctkPluginContext *context)
virtual RegistrationHistoryPtr get_rMpr_History() const
boost::shared_ptr< class DataFactory > DataFactoryPtr
virtual std::map< QString, DataPtr > getData() const
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
boost::shared_ptr< class Tool > ToolPtr