14 #include <ctkPluginContext.h> 15 #include <vtkImageData.h> 40 this->createInterconnectedDataAndSpace();
55 mUnavailableData.clear();
58 void PatientModelImplService::createInterconnectedDataAndSpace()
70 mActiveData.reset(
new ActiveData(patientModelService, session));
74 mDataService->setServices(spaceProvider, mFileManagerService);
76 mDataFactory.reset(
new DataFactory(patientModelService, spaceProvider));
77 mDataService->setDataFactory(mDataFactory);
79 mPatientData.reset(
new PatientData(mDataService, session, mFileManagerService));
82 void PatientModelImplService::shutdownInterconnectedDataAndSpace()
90 mDataService->clear();
111 this->shutdownInterconnectedDataAndSpace();
116 QString outputBasePath = this->patientData()->getActivePatientFolder();
118 this->dataService()->loadData(data, overWrite);
119 data->save(outputBasePath, mFileManagerService);
124 return dataService()->getDataFactory()->create(type, uid, name);
129 std::map<QString, DataPtr> retval = dataService()->getData();
133 for(
int i = 0; i < mUnavailableData.size(); ++i)
135 if (retval.count(mUnavailableData[i]))
136 retval.erase(mUnavailableData[i]);
146 std::map<QString, DataPtr>::const_iterator iter = dataMap.find(uid);
147 if (iter == dataMap.end())
154 std::map<QString, DataPtr> retval;
156 std::map<QString, DataPtr>::const_iterator iter = dataMap.begin();
157 for ( ; iter != dataMap.end(); ++iter)
159 if((iter->second->getParentSpace() == parent_uid))
160 if((of_type ==
"") || (iter->second->getType() == of_type))
161 retval[iter->first] = iter->second;
169 return dataService()->getPatientLandmarks();
174 return dataService()->getLandmarkProperties();
179 dataService()->setLandmarkName(uid, name);
184 return dataService()->get_rMpr();
189 this->patientData()->autoSave();
200 mUnavailableData.push_back(uid);
203 std::vector<QString>::iterator iter = std::find(mUnavailableData.begin(), mUnavailableData.end(), uid);
204 if(iter != mUnavailableData.end())
205 mUnavailableData.erase(iter);
211 return dataService()->getClinicalApplication();
216 dataService()->setClinicalApplication(application);
221 return dataService()->getStreams();
226 return this->patientData()->getActivePatientFolder();
231 return this->patientData()->isPatientValid();
236 return this->patientData()->importData(fileName, infoText);
241 this->patientData()->exportPatient(externalSpace);
246 this->patientData()->removeData(uid);
251 return dataService()->getPresetTransferFunctions3D();
256 this->dataService()->setCenter(center);
261 return this->dataService()->getCenter();
266 this->dataService()->setOperatingTable(ot);
271 return this->dataService()->getOperatingTable();
276 return dataService()->addLandmark();
281 return dataService()->deleteLandmarks();
286 dataService()->setLandmarkActive(uid, active);
291 return this->dataService()->get_rMpr_History();
309 void PatientModelImplService::probesChanged()
311 this->disconnectProbes();
313 this->connectProbes();
316 void PatientModelImplService::disconnectProbes()
318 for (std::map<QString, ToolPtr>::const_iterator iter = mProbeTools.begin(); iter != mProbeTools.end(); ++iter)
320 ProbePtr probe = iter->second->getProbe();
324 CX_LOG_WARNING() <<
"PatientModelImplService::disconnectProbes: Tool is not a probe: " << iter->second->getUid();
328 void PatientModelImplService::connectProbes()
330 ToolMap tools = mTrackingService->getTools();
331 for (ToolMap::const_iterator iter = tools.begin(); iter != tools.end(); ++iter)
337 mProbeTools[iter->first] = tool;
343 void PatientModelImplService::videoSourceAdded(
VideoSourcePtr source)
345 ToolPtr tool = this->getProbeTool(source->getUid());
349 QString uid = source->getUid() + tool->getUid();
350 QString name = source->getName() +
" - " + tool->getName();
351 TrackedStreamPtr trackedStream = this->dataService()->getTrackedStream(uid);
353 trackedStream = this->createSpecificData<TrackedStream>(uid, name);
354 trackedStream->setProbeTool(tool);
355 trackedStream->setVideoSource(source);
356 trackedStream->setSpaceProvider(mDataService->getSpaceProvider());
359 this->dataService()->loadData(trackedStream);
361 this->reEmitActiveTrackedStream(trackedStream);
364 void PatientModelImplService::reEmitActiveTrackedStream(
TrackedStreamPtr trackedStream)
367 mActiveData->setActive(trackedStream);
370 ToolPtr PatientModelImplService::getProbeTool(QString videoSourceUid)
372 for (std::map<QString, ToolPtr>::const_iterator iter = mProbeTools.begin(); iter != mProbeTools.end(); ++iter)
376 if(probe && probe->getAvailableVideoSources().contains(videoSourceUid))
boost::shared_ptr< class SpaceProvider > SpaceProviderPtr
boost::shared_ptr< class FileManagerService > FileManagerServicePtr
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)
virtual void insertData(DataPtr data, bool overWrite=false)
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()
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)
static FileManagerServicePtr create(ctkPluginContext *context)
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