29 BaseWidget(parent,
"us_reconstruction",
"US Reconstruction"),
30 mReconstructer(reconstructer),
33 this->setToolTip(
"Reconstruct 3D US data from an acquired 2D sequence");
43 QVBoxLayout* topLayout =
new QVBoxLayout(
this);
50 QHBoxLayout* extentLayout =
new QHBoxLayout;
51 mExtentLineEdit =
new QLineEdit(
this);
52 mExtentLineEdit->setReadOnly(
true);
53 extentLayout->addWidget(
new QLabel(
"Extent",
this));
54 extentLayout->addWidget(mExtentLineEdit);
56 mInputSpacingLineEdit =
new QLineEdit(
this);
57 mInputSpacingLineEdit->setReadOnly(
true);
58 QLabel* inputSpacingLabel =
new QLabel(
"Spacing In",
this);
60 mReconstructButton =
new QPushButton(
"Reconstruct",
this);
65 QGridLayout* sizesLayout =
new QGridLayout;
66 QWidget* maxVolSizeWidget =
sscCreateDataWidget(
this, mReconstructer->getParam(
"Volume Size"));
67 sizesLayout->addWidget(inputSpacingLabel, 0, 0);
68 sizesLayout->addWidget(mInputSpacingLineEdit, 0, 1);
69 sizesLayout->addLayout(extentLayout, 0, 2);
71 sizesLayout->addWidget(maxVolSizeWidget, 1, 2);
73 QHBoxLayout* runLayout =
new QHBoxLayout;
74 topLayout->addLayout(runLayout);
75 runLayout->addWidget(mReconstructButton);
77 QIcon(
":/icons/open_icon_library/system-run-5.png"),
78 "Details",
"Show Advanced Settings",
79 SLOT(toggleDetailsSlot()),
82 topLayout->addWidget(mFileSelectWidget);
83 topLayout->addLayout(sizesLayout);
86 topLayout->addWidget(presetTFWidget);
88 mOptionsWidget = this->createOptionsWidget();
89 mOptionsWidget->setVisible(
settings()->value(
"reconstruction/guiShowDetails").toBool());
90 topLayout->addWidget(mOptionsWidget);
92 topLayout->addStretch();
93 topLayout->addWidget(mTimedAlgorithmProgressBar);
96 void ReconstructionWidget::updateFileSelectorPath(QString path)
98 mFileSelectWidget->
setPath(path);
102 void ReconstructionWidget::toggleDetailsSlot()
104 mOptionsWidget->setVisible(!mOptionsWidget->isVisible());
105 settings()->
setValue(
"reconstruction/guiShowDetails", mOptionsWidget->isVisible());
108 QWidget* ReconstructionWidget::createOptionsWidget()
110 QWidget* retval =
new QWidget(
this);
111 QGridLayout* layout =
new QGridLayout(retval);
112 layout->setMargin(0);
119 mAlgorithmGroup =
new QFrame(
this);
120 mAlgorithmGroup->setFrameStyle(QFrame::StyledPanel | QFrame::Raised);
121 mAlgorithmGroup->setFocusPolicy(Qt::StrongFocus);
122 mAlgorithmGroup->setSizePolicy(mAlgorithmGroup->sizePolicy().horizontalPolicy(),QSizePolicy::Fixed);
124 QVBoxLayout* algoOuterLayout =
new QVBoxLayout(mAlgorithmGroup);
126 QWidget* algorithmWidget =
sscCreateDataWidget(
this, mReconstructer->getParam(
"Algorithm"));
127 algoOuterLayout->addWidget(algorithmWidget);
128 mAlgoLayout =
new QStackedLayout;
129 this->repopulateAlgorithmGroup();
130 mAlgoLayout->setMargin(0);
131 algoOuterLayout->addLayout(mAlgoLayout);
133 layout->addWidget(mAlgorithmGroup, line, 0, 1, 2);
144 QHBoxLayout* outputVolDimLayout =
new QHBoxLayout;
145 outputVolDimLayout->addWidget(mDimXWidget);
146 outputVolDimLayout->addWidget(mDimYWidget);
147 outputVolDimLayout->addWidget(mDimZWidget);
148 layout->addLayout(outputVolDimLayout, line++, 0, 1, 2);
151 sscCreateDataWidget(
this, mReconstructer->getParam(
"Extra Temporal Calib"), layout, line++);
153 sscCreateDataWidget(
this, mReconstructer->getParam(
"Position Filter Strength"), layout, line++);
154 sscCreateDataWidget(
this, mReconstructer->getParam(
"Reduce mask (% in 1D)"), layout, line++);
159 void ReconstructionWidget::repopulateAlgorithmGroup()
161 QString algoName = mReconstructer->getParam(
"Algorithm")->getValueAsVariant().toString();
163 if (mAlgoLayout->currentWidget() && (algoName == mAlgoLayout->currentWidget()->objectName()))
166 for (
int i=0; i<mAlgoLayout->count(); ++i)
168 if (algoName==mAlgoLayout->widget(i)->objectName())
170 mAlgoLayout->setCurrentIndex(i);
178 while ((child = mAlgoLayout->takeAt(0)) != 0)
181 QWidget* widget = child->widget();
186 this->createNewStackedWidget(algoName);
189 void ReconstructionWidget::createNewStackedWidget(QString algoName)
191 QWidget* oneAlgoWidget =
new QWidget(
this);
192 oneAlgoWidget->setObjectName(algoName);
193 mAlgorithmGroup->setObjectName(algoName);
194 mAlgoLayout->addWidget(oneAlgoWidget);
195 QGridLayout* oneAlgoLayout =
new QGridLayout(oneAlgoWidget);
196 oneAlgoLayout->setMargin(0);
198 std::vector<PropertyPtr> algoOption = mReconstructer->getAlgoOptions();
200 for (;row < algoOption.size(); ++row)
204 oneAlgoLayout->setRowStretch(row, 1);
206 mAlgoLayout->setCurrentWidget(oneAlgoWidget);
209 QString ReconstructionWidget::getCurrentPath()
211 return QFileInfo(mReconstructer->getSelectedFilename()).dir().absolutePath();
216 mReconstructer->startReconstruction();
222 this->
selectData(mReconstructer->getSelectedFilename());
228 void ReconstructionWidget::inputDataSelected(QString mhdFileName)
230 if (mReconstructer->getSelectedFilename().isEmpty())
240 if (filename.isEmpty())
246 mReconstructer->selectData(filename);
254 Vector3D range = mReconstructer->getOutputVolumeParams().getExtent().range();
257 QString(
"%1, %2, %3").arg(range[0], 0,
'f', 1).arg(range[1], 0,
'f', 1).arg(range[2], 0,
'f', 1);
258 mExtentLineEdit->setText(extText);
260 mInputSpacingLineEdit->setText(QString(
"%1").arg(mReconstructer->getOutputVolumeParams().getInputSpacing(), 0,
'f', 4));
263 void ReconstructionWidget::reconstructAboutToStartSlot()
265 std::set<cx::TimedAlgorithmPtr> threads = mReconstructer->getThreadedReconstruction();
266 mTimedAlgorithmProgressBar->
attach(threads);
269 void ReconstructionWidget::reconstructStartedSlot()
271 mReconstructButton->setEnabled(
false);
274 void ReconstructionWidget::reconstructFinishedSlot()
276 std::set<cx::TimedAlgorithmPtr> threads = mReconstructer->getThreadedReconstruction();
277 mTimedAlgorithmProgressBar->
detach(threads);
278 mReconstructButton->setEnabled(
true);
void newInputDataAvailable(QString mhdFileName)
boost::shared_ptr< class UsReconstructionService > UsReconstructionServicePtr
void inputDataSelected(QString mhdFileName)
void reconstructFinished()
Show progress for a TimedBaseAlgorithm.
void detach(TimedAlgorithmPtr algorithm)
void setValue(const QString &key, const QVariant &value)
void reportWarning(QString msg)
void reconstructStarted()
boost::shared_ptr< class DoublePropertyBase > DoublePropertyBasePtr
Settings * settings()
Shortcut for accessing the settings instance.
void attach(TimedAlgorithmPtr algorithm)
void reconstructAboutToStart()
Eigen::Vector3d Vector3D
Vector3D is a representation of a point or vector in 3D.
void newInputDataPath(QString path)
Namespace for all CustusX production code.