NorMIT-nav  2023.01.05-dev+develop.0da12
An IGT application
cxPrepareVesselsWidget.cpp
Go to the documentation of this file.
1 /*=========================================================================
2 This file is part of CustusX, an Image Guided Therapy Application.
3 
4 Copyright (c) SINTEF Department of Medical Technology.
5 All rights reserved.
6 
7 CustusX is released under a BSD 3-Clause license.
8 
9 See Lisence.txt (https://github.com/SINTEFMedtek/CustusX/blob/master/License.txt) for details.
10 =========================================================================*/
11 
12 #include "cxPrepareVesselsWidget.h"
13 
14 #include <QVBoxLayout>
15 #include <QPushButton>
17 #include "cxTypeConversions.h"
18 #include "cxColorSelectButton.h"
19 #include "cxMesh.h"
20 #include "cxProfile.h"
21 
22 #include "cxPipelineWidget.h"
23 #include "cxHelperWidgets.h"
24 #include "cxColorProperty.h"
25 
26 #include "cxResampleImageFilter.h"
27 #include "cxSmoothingImageFilter.h"
31 
32 namespace cx
33 {
34 //------------------------------------------------------------------------------
36  RegistrationBaseWidget(services, parent, "org_custusx_registration_method_vessel_prepare_widget", "PrepareVesselsWidget")
37 {
38  this->setToolTip("Prepare data for vessel I2I registration");
39 
40  XmlOptionFile options = profile()->getXmlSettings().descend("registration").descend("PrepareVesselsWidget");
41  // fill the pipeline with filters:
42  mPipeline.reset(new Pipeline(services->patient()));
43  FilterGroupPtr filters(new FilterGroup(options.descend("pipeline")));
44  filters->append(FilterPtr(new ResampleImageFilter(services)));
45  filters->append(FilterPtr(new SmoothingImageFilter(services)));
46  filters->append(FilterPtr(new BinaryThresholdImageFilter(services)));
47  filters->append(FilterPtr(new BinaryThinningImageFilter3DFilter(services)));
48  mPipeline->initialize(filters);
49 
50 // mPipeline->getNodes()[0]->setValueName("US Image:");
51 // mPipeline->getNodes()[0]->setHelp("Select an US volume acquired from the wire phantom.");
52  mPipeline->setOption("Color", QVariant(QColor("red")));
53 
54  mLayout = new QVBoxLayout(this);
55 
56  mPipelineWidget = new PipelineWidget(services->view(), services->patient(), NULL, mPipeline);
57  mLayout->addWidget(mPipelineWidget);
58 
60  "Color of all generated data.",
61  QColor("green"), options.getElement());
62  connect(mColorProperty.get(), SIGNAL(changed()), this, SLOT(setColorSlot()));
63 
64  QPushButton* fixedButton = new QPushButton("Set as Fixed");
65  fixedButton->setToolTip("Set output of centerline generation as the Fixed Data in Registration");
66  connect(fixedButton, SIGNAL(clicked()), this, SLOT(toFixedSlot()));
67  QPushButton* movingButton = new QPushButton("Set as Moving");
68  movingButton->setToolTip("Set output of centerline generation as the Moving Data in Registration");
69  connect(movingButton, SIGNAL(clicked()), this, SLOT(toMovingSlot()));
70 
71  QLayout* buttonsLayout = new QHBoxLayout;
72  buttonsLayout->addWidget(fixedButton);
73  buttonsLayout->addWidget(movingButton);
74 
75  mLayout->addWidget(sscCreateDataWidget(this, mColorProperty));
76  mLayout->addWidget(mPipelineWidget);
77  mLayout->addStretch();
78  mLayout->addLayout(buttonsLayout);
79 // mLayout->addStretch();
80 
81  this->setColorSlot();
82 
83 }
84 
85 void PrepareVesselsWidget::setColorSlot()
86 {
87  mPipeline->setOption(mColorProperty->getDisplayName(), QVariant(mColorProperty->getValue()));
88 }
89 
90 void PrepareVesselsWidget::toMovingSlot()
91 {
92  DataPtr data = mPipeline->getNodes().back()->getData();
93  if (data)
94  mServices->registration()->setMovingData(data);
95 }
96 
97 void PrepareVesselsWidget::toFixedSlot()
98 {
99  DataPtr data = mPipeline->getNodes().back()->getData();
100  if (data)
101  mServices->registration()->setFixedData(data);
102 }
103 
105 {}
106 
107 
108 //------------------------------------------------------------------------------
109 }//namespace cx
cx::SmoothingImageFilter
Definition: cxSmoothingImageFilter.h:26
cx::XmlOptionFile
Helper class for xml files used to store ssc/cx data.
Definition: cxXmlOptionItem.h:78
cx::BinaryThinningImageFilter3DFilter
Definition: cxBinaryThinningImageFilter3DFilter.h:27
cxPipelineWidget.h
cx::PrepareVesselsWidget::~PrepareVesselsWidget
virtual ~PrepareVesselsWidget()
Definition: cxPrepareVesselsWidget.cpp:104
cx::PrepareVesselsWidget::mColorProperty
ColorPropertyBasePtr mColorProperty
Definition: cxPrepareVesselsWidget.h:54
cx::BinaryThresholdImageFilter
Definition: cxBinaryThresholdImageFilter.h:31
cx
Namespace for all CustusX production code.
Definition: cx_dev_group_definitions.h:13
cxPrepareVesselsWidget.h
cx::PrepareVesselsWidget::mPipelineWidget
class PipelineWidget * mPipelineWidget
Definition: cxPrepareVesselsWidget.h:52
cx::XmlOptionFile::descend
XmlOptionFile descend(QString element) const
step one level down in the xml tree
Definition: cxXmlOptionItem.cpp:271
cxLabeledComboBoxWidget.h
cxBinaryThresholdImageFilter.h
cx::RegistrationBaseWidget
Definition: cxRegistrationBaseWidget.h:28
cx::FilterGroup
Definition: cxFilterGroup.h:30
cxHelperWidgets.h
cx::ColorProperty::initialize
static ColorPropertyPtr initialize(const QString &uid, QString name, QString help, QColor value, QDomNode root=QDomNode())
Definition: cxColorProperty.cpp:24
cx::PipelineWidget
Definition: cxPipelineWidget.h:59
cx::PrepareVesselsWidget::mPipeline
PipelinePtr mPipeline
Definition: cxPrepareVesselsWidget.h:53
cx::RegistrationBaseWidget::mServices
RegServicesPtr mServices
Definition: cxRegistrationBaseWidget.h:35
cxBinaryThinningImageFilter3DFilter.h
cxProfile.h
cx::XmlOptionFile::getElement
QDomElement getElement()
return the current element
Definition: cxXmlOptionItem.cpp:365
cx::PrepareVesselsWidget::mLayout
QVBoxLayout * mLayout
Definition: cxPrepareVesselsWidget.h:44
cxTypeConversions.h
cx::ResampleImageFilter
Definition: cxResampleImageFilter.h:26
cx::DataPtr
boost::shared_ptr< class Data > DataPtr
Definition: cxRegistrationApplicator.h:22
cxResampleImageFilter.h
cxSmoothingImageFilter.h
cx::FilterPtr
boost::shared_ptr< class Filter > FilterPtr
Definition: cxForwardDeclarations.h:155
cx::RegServicesPtr
boost::shared_ptr< class RegServices > RegServicesPtr
Definition: cxRegServices.h:20
cx::profile
cxResource_EXPORT ProfilePtr profile()
Definition: cxProfile.cpp:160
cx::FilterGroupPtr
boost::shared_ptr< FilterGroup > FilterGroupPtr
Definition: cxFilterGroup.h:65
cxRegistrationServiceProxy.h
cx::sscCreateDataWidget
QWidget * sscCreateDataWidget(QWidget *parent, PropertyPtr data, QGridLayout *gridLayout, int row)
Create a widget capable of displaying the input data.
Definition: cxHelperWidgets.cpp:59
cxColorSelectButton.h
cx::Pipeline
Definition: cxPipeline.h:78
cxMesh.h
cxColorProperty.h
cx::PrepareVesselsWidget::PrepareVesselsWidget
PrepareVesselsWidget(RegServicesPtr services, QWidget *parent)
Definition: cxPrepareVesselsWidget.cpp:35