50 BaseWidget(parent,
"USReconstruction",
"US Reconstruction"),
51 mReconstructer(reconstructer),
54 this->setToolTip(
"Reconstruct 3D US data from an acquired 2D sequence");
64 QVBoxLayout* topLayout =
new QVBoxLayout(
this);
71 QHBoxLayout* extentLayout =
new QHBoxLayout;
72 mExtentLineEdit =
new QLineEdit(
this);
73 mExtentLineEdit->setReadOnly(
true);
74 extentLayout->addWidget(
new QLabel(
"Extent",
this));
75 extentLayout->addWidget(mExtentLineEdit);
77 mInputSpacingLineEdit =
new QLineEdit(
this);
78 mInputSpacingLineEdit->setReadOnly(
true);
79 QLabel* inputSpacingLabel =
new QLabel(
"Spacing In",
this);
81 mReconstructButton =
new QPushButton(
"Reconstruct",
this);
86 QGridLayout* sizesLayout =
new QGridLayout;
87 QWidget* maxVolSizeWidget =
sscCreateDataWidget(
this, mReconstructer->getParam(
"Volume Size"));
88 sizesLayout->addWidget(inputSpacingLabel, 0, 0);
89 sizesLayout->addWidget(mInputSpacingLineEdit, 0, 1);
90 sizesLayout->addLayout(extentLayout, 0, 2);
92 sizesLayout->addWidget(maxVolSizeWidget, 1, 2);
94 QHBoxLayout* runLayout =
new QHBoxLayout;
95 topLayout->addLayout(runLayout);
96 runLayout->addWidget(mReconstructButton);
98 QIcon(
":/icons/open_icon_library/system-run-5.png"),
99 "Details",
"Show Advanced Settings",
100 SLOT(toggleDetailsSlot()),
103 topLayout->addWidget(mFileSelectWidget);
104 topLayout->addLayout(sizesLayout);
107 topLayout->addWidget(presetTFWidget);
109 mOptionsWidget = this->createOptionsWidget();
110 mOptionsWidget->setVisible(
settings()->value(
"reconstruction/guiShowDetails").toBool());
111 topLayout->addWidget(mOptionsWidget);
113 topLayout->addStretch();
114 topLayout->addWidget(mTimedAlgorithmProgressBar);
117 void ReconstructionWidget::updateFileSelectorPath(QString path)
119 mFileSelectWidget->
setPath(path);
123 void ReconstructionWidget::toggleDetailsSlot()
125 mOptionsWidget->setVisible(!mOptionsWidget->isVisible());
126 settings()->
setValue(
"reconstruction/guiShowDetails", mOptionsWidget->isVisible());
129 QWidget* ReconstructionWidget::createOptionsWidget()
131 QWidget* retval =
new QWidget(
this);
132 QGridLayout* layout =
new QGridLayout(retval);
133 layout->setMargin(0);
140 mAlgorithmGroup =
new QFrame(
this);
141 mAlgorithmGroup->setFrameStyle(QFrame::StyledPanel | QFrame::Raised);
142 mAlgorithmGroup->setFocusPolicy(Qt::StrongFocus);
143 mAlgorithmGroup->setSizePolicy(mAlgorithmGroup->sizePolicy().horizontalPolicy(),QSizePolicy::Fixed);
145 QVBoxLayout* algoOuterLayout =
new QVBoxLayout(mAlgorithmGroup);
147 QWidget* algorithmWidget =
sscCreateDataWidget(
this, mReconstructer->getParam(
"Algorithm"));
148 algoOuterLayout->addWidget(algorithmWidget);
149 mAlgoLayout =
new QStackedLayout;
150 this->repopulateAlgorithmGroup();
151 mAlgoLayout->setMargin(0);
152 algoOuterLayout->addLayout(mAlgoLayout);
154 layout->addWidget(mAlgorithmGroup, line, 0, 1, 2);
162 mDimXWidget =
new SpinBoxGroupWidget(
this,
DoublePropertyBasePtr(
new DoublePropertyXDim(mReconstructer)));
163 mDimYWidget =
new SpinBoxGroupWidget(
this,
DoublePropertyBasePtr(
new DoublePropertyYDim(mReconstructer)));
164 mDimZWidget =
new SpinBoxGroupWidget(
this,
DoublePropertyBasePtr(
new DoublePropertyZDim(mReconstructer)));
165 QHBoxLayout* outputVolDimLayout =
new QHBoxLayout;
166 outputVolDimLayout->addWidget(mDimXWidget);
167 outputVolDimLayout->addWidget(mDimYWidget);
168 outputVolDimLayout->addWidget(mDimZWidget);
169 layout->addLayout(outputVolDimLayout, line++, 0, 1, 2);
172 sscCreateDataWidget(
this, mReconstructer->getParam(
"Extra Temporal Calib"), layout, line++);
173 sscCreateDataWidget(
this, mReconstructer->getParam(
"Reduce mask (% in 1D)"), layout, line++);
178 void ReconstructionWidget::repopulateAlgorithmGroup()
180 QString algoName = mReconstructer->getParam(
"Algorithm")->getValueAsVariant().toString();
182 if (mAlgoLayout->currentWidget() && (algoName == mAlgoLayout->currentWidget()->objectName()))
185 for (
int i=0; i<mAlgoLayout->count(); ++i)
187 if (algoName==mAlgoLayout->widget(i)->objectName())
189 mAlgoLayout->setCurrentIndex(i);
197 while ((child = mAlgoLayout->takeAt(0)) != 0)
200 QWidget* widget = child->widget();
205 this->createNewStackedWidget(algoName);
208 void ReconstructionWidget::createNewStackedWidget(QString algoName)
210 QWidget* oneAlgoWidget =
new QWidget(
this);
211 oneAlgoWidget->setObjectName(algoName);
212 mAlgorithmGroup->setObjectName(algoName);
213 mAlgoLayout->addWidget(oneAlgoWidget);
214 QGridLayout* oneAlgoLayout =
new QGridLayout(oneAlgoWidget);
215 oneAlgoLayout->setMargin(0);
217 std::vector<PropertyPtr> algoOption = mReconstructer->getAlgoOptions();
219 for (;row < algoOption.size(); ++row)
223 oneAlgoLayout->setRowStretch(row, 1);
225 mAlgoLayout->setCurrentWidget(oneAlgoWidget);
228 QString ReconstructionWidget::getCurrentPath()
230 return QFileInfo(mReconstructer->getSelectedFilename()).dir().absolutePath();
235 mReconstructer->startReconstruction();
241 this->
selectData(mReconstructer->getSelectedFilename());
247 void ReconstructionWidget::inputDataSelected(QString mhdFileName)
249 if (mReconstructer->getSelectedFilename().isEmpty())
259 if (filename.isEmpty())
265 mReconstructer->selectData(filename);
273 Vector3D range = mReconstructer->getOutputVolumeParams().getExtent().range();
276 QString(
"%1, %2, %3").arg(range[0], 0,
'f', 1).arg(range[1], 0,
'f', 1).arg(range[2], 0,
'f', 1);
277 mExtentLineEdit->setText(extText);
279 mInputSpacingLineEdit->setText(QString(
"%1").arg(mReconstructer->getOutputVolumeParams().getInputSpacing(), 0,
'f', 4));
282 void ReconstructionWidget::reconstructAboutToStartSlot()
284 std::set<cx::TimedAlgorithmPtr> threads = mReconstructer->getThreadedReconstruction();
285 mTimedAlgorithmProgressBar->
attach(threads);
288 void ReconstructionWidget::reconstructStartedSlot()
290 mReconstructButton->setEnabled(
false);
293 void ReconstructionWidget::reconstructFinishedSlot()
295 std::set<cx::TimedAlgorithmPtr> threads = mReconstructer->getThreadedReconstruction();
296 mTimedAlgorithmProgressBar->
detach(threads);
297 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)