2015-07-01 70 views
2

在custusX中的自定义插件中,我使用mServices->patientModelService->getPatientLandmarks()->setLandmark以编程方式更改某些地标。我想用已有的音量进行注册。如何访问CustusX插件中的registrationService?

LandmarkPatientRegistrationWidget in org.custusx.registration.method.landmarkperformRegistration()要求mServices.registrationService->doPatientRegistration()

但是,我不确定我的方法是否可以获得registrationService实例。

我到目前为止已将org_custusx_registration添加到CMakeLists.txt文件中,并添加了"cxRegistrationService.h"<cxRegServices.h>作为包含。

现在我可以定义一个RegServices mRegServices并使用插件的mContext在构造函数中初始化它。

但是,我要创建一个自己的注册服务还是可以访问已经存在的?我如何访问已经运行的注册服务?

回答

2

您的方法正确地重用了现有的运行注册服务。

CustusX的默认设置注册了一个单实例(对象)实现了cx::RegistrationService接口。 cx::RegServices辅助类包含一个cx::RegistrationServiceProxy,它充当引用该对象的智能指针。服务对象只能由实现它们的插件创建:用户只需访问这些对象。

RegistrationServiceProxy使用ctkServiceTracker和相关的类来实现此目的,例如参见this tutorial on OSGi,第5.4节(在java中,但适用的原则)。

相关问题