Skip to content

Commit

Permalink
Merge pull request #1 in MT/org.custusx.virtualbronchoscopy from bugf…
Browse files Browse the repository at this point in the history
…ix/CUSTUSX-40-make-fraxinus-build-scripts-use to develop

* commit '8ee8fa11f901e987a2290556cc013c39bdf91d0a':
  CUSTUSX-40: Fraxinus installer fix
  Changed VB widget to vertical layout
  Removed unnecessary code
  Save/load routeToTarget in VirtualBronchoscopy widget.
  • Loading branch information
Jon Eiesland committed Apr 14, 2016
2 parents 6187600 + 8ee8fa1 commit 42c8457
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 41 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ ctkMacroBuildPlugin(
RESOURCES ${PLUGIN_resources}
TARGET_LIBRARIES ${PLUGIN_target_libraries}
OUTPUT_DIR ${PLUGIN_OUTPUT_DIR}
${CX_CTK_PLUGIN_NO_INSTALL}
)

target_include_directories(org_custusx_virtualbronchoscopy
Expand Down
4 changes: 3 additions & 1 deletion cxVBPluginActivator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

#include "cxVBService.h"
#include "cxRegisteredService.h"
#include "cxVisServices.h"

namespace cx
{
Expand All @@ -53,7 +54,8 @@ VBPluginActivator::~VBPluginActivator()

void VBPluginActivator::start(ctkPluginContext* context)
{
mVBregistration = RegisteredService::create<VBGUIExtenderService>(context, GUIExtenderService_iid);
VisServicesPtr services = VisServices::create(context);
mVBregistration = RegisteredServicePtr(new RegisteredService(context, new VBGUIExtenderService(services), GUIExtenderService_iid));
}

void VBPluginActivator::stop(ctkPluginContext* context)
Expand Down
7 changes: 4 additions & 3 deletions cxVBService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,20 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "cxVBService.h"
#include "ctkPluginContext.h"
#include "cxVBWidget.h"
#include "cxVisServices.h"

namespace cx
{

VBGUIExtenderService::VBGUIExtenderService(ctkPluginContext *context) :
mContext(context)
VBGUIExtenderService::VBGUIExtenderService(VisServicesPtr services) :
mServices(services)
{
}
std::vector<GUIExtenderService::CategorizedWidget> VBGUIExtenderService::createWidgets() const
{
std::vector<CategorizedWidget> retval;
retval.push_back(GUIExtenderService::CategorizedWidget(
new VBWidget(mContext, NULL),
new VBWidget(mServices, NULL),
"Utility"));

return retval;
Expand Down
5 changes: 3 additions & 2 deletions cxVBService.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class ctkPluginContext;

namespace cx
{
typedef boost::shared_ptr<class VisServices> VisServicesPtr;

/**
* Virtual Bronchoscopy service interface.
Expand All @@ -52,13 +53,13 @@ class org_custusx_virtualbronchoscopy_EXPORT VBGUIExtenderService : public GUIEx
{
Q_INTERFACES(cx::GUIExtenderService)
public:
VBGUIExtenderService(ctkPluginContext *context);
VBGUIExtenderService(VisServicesPtr services);
virtual ~VBGUIExtenderService() {}
std::vector<CategorizedWidget> createWidgets() const;

// virtual QString getWidgetName() {return QString("org_custusx_virtualbronchoscopy_widget");}
private:
ctkPluginContext* mContext;
VisServicesPtr mServices;
};
typedef boost::shared_ptr<VBGUIExtenderService> VBGUIExtenderServicePtr;

Expand Down
45 changes: 22 additions & 23 deletions cxVBWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,37 +46,39 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "cxDataSelectWidget.h"
#include "cxTrackingServiceProxy.h"
#include "cxView.h"

#include "cxSessionStorageServiceProxy.h"
#include "cxPatientStorage.h"
#include "cxVisServices.h"



namespace cx
{

VBWidget::VBWidget(ctkPluginContext *context, QWidget *parent) :
VBWidget::VBWidget(VisServicesPtr services, QWidget *parent) :
QWidget(parent),
mHorizontalLayout(new QHBoxLayout(this)),
mControlsEnabled(false)
mVerticalLayout(new QVBoxLayout(this)),
mControlsEnabled(false),
mStorage(new PatientStorage(services->session(), "VirtualBronchoscopy"))
{
this->setObjectName("Virtual Bronchoscopy Widget");
this->setWindowTitle("Virtual Bronchoscopy");
this->setWhatsThis(this->defaultWhatsThis());

this->setFocusPolicy(Qt::StrongFocus); // Widget needs focus to handle Key events

mPatientModelService = PatientModelServicePtr(new PatientModelServiceProxy(context));
mViewService = ViewServicePtr(new ViewServiceProxy(context));
mTrackingService = TrackingServiceProxy::create(context);

mRouteToTarget = StringPropertySelectMesh::New(mPatientModelService);
mRouteToTarget = StringPropertySelectMesh::New(services->patient());
mRouteToTarget->setValueName("Route to target path: ");
mStorage->storeVariable("routeToTarget",
boost::bind(&StringPropertySelectMesh::getValue, mRouteToTarget),
boost::bind(&StringPropertySelectMesh::setValue, mRouteToTarget, _1));

// Selector for route to target
QVBoxLayout *inputVbox = new QVBoxLayout;
inputVbox->addWidget(new DataSelectWidget(mViewService, mPatientModelService, this,mRouteToTarget));
inputVbox->addWidget(new DataSelectWidget(services->view(), services->patient(), this,mRouteToTarget));
QGroupBox *inputBox = new QGroupBox(tr("Input"));
inputBox->setLayout(inputVbox);
mHorizontalLayout->addWidget(inputBox);
mVerticalLayout->addWidget(inputBox);

// Selectors for position along path and play/pause
QHBoxLayout *playbackHBox = new QHBoxLayout;
Expand All @@ -88,40 +90,36 @@ VBWidget::VBWidget(ctkPluginContext *context, QWidget *parent) :
playbackHBox->addWidget(mPlaybackSlider);
playbackHBox->addWidget(labelTarget);
playbackBox->setLayout(playbackHBox);
mHorizontalLayout->addWidget(playbackBox);
mVerticalLayout->addWidget(playbackBox);
mPlaybackSlider->setMinimum(0);
mPlaybackSlider->setMaximum(100);

// Selectors for virtual endoscope control
QGroupBox *endoscopeBox = new QGroupBox(tr("Endoscope"));
QGridLayout *endoscopeControlLayout = new QGridLayout;
QLabel *labelRot = new QLabel(tr("Rotate"));
QLabel *labelView = new QLabel(tr("View Direction (degrees left/right)"));
QLabel *label1 = new QLabel(tr("-90 "));
QLabel *label2 = new QLabel(tr(" 90"));
QLabel *labelView = new QLabel(tr("Left/right (30 deg)"));
mRotateDial = new QDial;
mRotateDial->setMinimum(-180);
mRotateDial->setMaximum(180);
mViewSlider = new QSlider(Qt::Horizontal);
mViewSlider->setMinimum(-90);
mViewSlider->setMaximum(90);
mViewSlider = new QDial;
mViewSlider->setMinimum(-30);
mViewSlider->setMaximum(30);


endoscopeControlLayout->addWidget(labelRot,0,0,Qt::AlignHCenter);
endoscopeControlLayout->addWidget(labelView,0,2,Qt::AlignHCenter);
endoscopeControlLayout->addWidget(mRotateDial,1,0);
endoscopeControlLayout->addWidget(label1,1,1);
endoscopeControlLayout->addWidget(mViewSlider,1,2);
endoscopeControlLayout->addWidget(label2,1,3);
endoscopeBox->setLayout(endoscopeControlLayout);
mHorizontalLayout->addWidget(endoscopeBox);
mVerticalLayout->addWidget(endoscopeBox);

this->setLayout(mHorizontalLayout);
this->setLayout(mVerticalLayout);


this->enableControls(false);

mCameraPath = new CXVBcameraPath(mTrackingService, mPatientModelService, mViewService);
mCameraPath = new CXVBcameraPath(services->tracking(), services->patient(), services->view());

connect(mRouteToTarget.get(), &SelectDataStringPropertyBase::dataChanged,
this, &VBWidget::inputChangedSlot);
Expand All @@ -130,6 +128,7 @@ VBWidget::VBWidget(ctkPluginContext *context, QWidget *parent) :
connect(mViewSlider, &QSlider::valueChanged, mCameraPath, &CXVBcameraPath::cameraViewAngleSlot);
connect(mRotateDial, &QDial::valueChanged, mCameraPath, &CXVBcameraPath::cameraRotateAngleSlot);

mVerticalLayout->addStretch();
}

VBWidget::~VBWidget()
Expand Down
14 changes: 7 additions & 7 deletions cxVBWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,15 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "cxVBcameraPath.h"


class QHBoxLayout;
class QVBoxLayout;
class QDial;
class QSlider;

namespace cx
{

typedef boost::shared_ptr<class StringPropertySelectMesh> StringPropertySelectMeshPtr;
typedef boost::shared_ptr<class PatientStorage> PatientStoragePtr;

/**
* Widget for Virtual Bronchoscopy
Expand All @@ -63,25 +64,24 @@ class VBWidget : public QWidget
{
Q_OBJECT
public:
VBWidget(ctkPluginContext *context, QWidget *parent = 0);
VBWidget(VisServicesPtr services, QWidget *parent = 0);
virtual ~VBWidget();

private:
QString defaultWhatsThis() const;
QHBoxLayout* mHorizontalLayout;
QVBoxLayout* mVerticalLayout;
QSlider* mPlaybackSlider;
QDial* mRotateDial;
QSlider* mViewSlider;
QDial* mViewSlider;

StringPropertySelectMeshPtr mRouteToTarget;
PatientModelServicePtr mPatientModelService;
ViewServicePtr mViewService;
TrackingServicePtr mTrackingService;
CXVBcameraPath* mCameraPath;
bool mControlsEnabled;

void enableControls(bool enable);

PatientStoragePtr mStorage;

signals:
void cameraPathChanged(MeshPtr pathMesh);

Expand Down
5 changes: 0 additions & 5 deletions cxVBcameraPath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "cxPatientModelService.h"
#include "cxViewServiceProxy.h"
#include "cxView.h"
#include "cxRegistrationTransform.h"



namespace cx {

Expand Down Expand Up @@ -158,14 +155,12 @@ void CXVBcameraPath::cameraViewAngleSlot(int angle)
{
mLastCameraViewAngle = static_cast<double>(angle) * (M_PI / 180.0);
this->updateManualToolPosition();
mViewService->get3DView()->setModified();
}

void CXVBcameraPath::cameraRotateAngleSlot(int angle)
{
mLastCameraRotAngle = static_cast<double>(angle) * (M_PI / 180.0);
this->updateManualToolPosition();
mViewService->get3DView()->setModified();
}

} /* namespace cx */

0 comments on commit 42c8457

Please sign in to comment.