14 #include <QPushButton> 15 #include "boost/bind.hpp" 16 #include "boost/function.hpp" 35 this->createActions();
37 QVBoxLayout* topLayout =
new QVBoxLayout(
this);
38 QHBoxLayout* buttonLayout =
new QHBoxLayout;
40 topLayout->addWidget(mBrowser);
41 topLayout->addLayout(buttonLayout);
43 buttonLayout->addStretch(1);
44 this->addToolButtonFor(buttonLayout, mImportAction);
45 this->addToolButtonFor(buttonLayout, mPreviousAction);
46 CXToolButton* button = this->addToolButtonFor(buttonLayout, mCurrentAction);
47 button->setToolButtonStyle(Qt::ToolButtonIconOnly);
49 this->addToolButtonFor(buttonLayout, mNextAction);
51 connect(mImportAction, &QAction::triggered,
this, &TrainingWidget::onImportSimulatedPatient);
52 connect(mPreviousAction, &QAction::triggered, boost::function<
void()>(boost::bind(&TrainingWidget::onStep,
this, -1)));
53 connect(mCurrentAction, &QAction::triggered, boost::function<
void()>(boost::bind(&TrainingWidget::onStep,
this, 0)));
54 connect(mNextAction, &QAction::triggered, boost::function<
void()>(boost::bind(&TrainingWidget::onStep,
this, +1)));
57 func_t welcome = boost::bind(&TrainingWidget::toWelcomeStep,
this);
73 mTransitions.push_back(transition);
74 int numberOfSteps = mTransitions.size();
75 this->createSteps(numberOfSteps);
78 void TrainingWidget::createActions()
81 QIcon(
":/icons/open_icon_library/document-open-7.png"),
82 "Import new training dataset",
"Clear current data and import new training patient folder",
87 QIcon(
":/icons/open_icon_library/arrow-left-3.png"),
88 "Previous",
"Go to previous training step",
93 QIcon(
":/icons/open_icon_library/button-green.png"),
94 "Reload",
"Reload the current training step",
98 QIcon(
":/icons/open_icon_library/arrow-right-3.png"),
99 "Next",
"Go to next training step",
104 void TrainingWidget::createSteps(
unsigned numberOfSteps)
109 for (
unsigned i=1; i<=numberOfSteps; ++i)
110 mSessionIDs << QString(
"org_custusx_training_sessionA_step%1").arg(i);
115 CXToolButton* TrainingWidget::addToolButtonFor(QHBoxLayout* layout, QAction* action)
118 button->setDefaultAction(action);
119 button->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
121 layout->addWidget(button);
125 void TrainingWidget::toWelcomeStep()
130 void TrainingWidget::onImportSimulatedPatient()
139 void TrainingWidget::onStep(
int delta)
141 this->stepTo(mCurrentStep+delta);
144 void TrainingWidget::stepTo(
int step)
147 step = std::min<int>(step, mSessionIDs.size()-1);
148 step = std::max<int>(step, 0);
155 this->transitionToStep(step);
158 void TrainingWidget::transitionToStep(
int step)
161 int transitionNumber = step;
162 if(transitionNumber >= 0)
165 func_t transition = mTransitions.at(transitionNumber);
177 std::map<QString, DataPtr> datas =
mServices->patient()->getDatas();
178 std::map<QString, DataPtr>::iterator iter = datas.begin();
180 for(; iter != datas.end(); ++iter)
185 if (image && image->getModality().contains(
"US"))
193 std::map<QString, MeshPtr> datas =
mServices->patient()->getDataOfType<
Mesh>();
194 std::map<QString, MeshPtr>::iterator iter = datas.begin();
195 for(; iter != datas.end(); ++iter)
198 if(mesh && mesh->getUid().contains(uidPart))
206 std::map<QString, DataPtr> datas =
mServices->patient()->getDatas();
207 this->setAvailability(datas,
false, uidPart, makeModalityUnavailable);
214 this->setAvailability(datas,
true, uidPart, makeModalityUnavailable);
217 void TrainingWidget::setAvailability(std::map<QString, DataPtr> datas,
bool available, QString uidPart,
bool makeModalityUnavailable)
219 std::map<QString, DataPtr>::iterator iter = datas.begin();
221 for(; iter != datas.end(); ++iter)
226 if (makeModalityUnavailable && image && image->getModality().contains(uidPart))
227 mServices->patient()->makeAvailable(image->getUid(), available);
228 else if (data && data->getUid().contains(uidPart))
229 mServices->patient()->makeAvailable(data->getUid(), available);
boost::shared_ptr< class Image > ImagePtr
void triggerMainWindowActionWithObjectName(QString actionName)
virtual QString getUid() const
boost::shared_ptr< class Data > DataPtr
void showHelpForKeyword(const QString &id)
boost::shared_ptr< class RegServices > RegServicesPtr
boost::shared_ptr< class Mesh > MeshPtr
Namespace for all CustusX production code.