50 BaseWidget(parent,
"USReconstruction",
"US Reconstruction"),
51 mReconstructer(reconstructer),
63 QVBoxLayout* topLayout =
new QVBoxLayout(
this);
70 QHBoxLayout* extentLayout =
new QHBoxLayout;
71 mExtentLineEdit =
new QLineEdit(
this);
72 mExtentLineEdit->setReadOnly(
true);
73 extentLayout->addWidget(
new QLabel(
"Extent",
this));
74 extentLayout->addWidget(mExtentLineEdit);
76 mInputSpacingLineEdit =
new QLineEdit(
this);
77 mInputSpacingLineEdit->setReadOnly(
true);
78 QLabel* inputSpacingLabel =
new QLabel(
"Spacing In",
this);
80 mReconstructButton =
new QPushButton(
"Reconstruct",
this);
85 QGridLayout* sizesLayout =
new QGridLayout;
86 QWidget* maxVolSizeWidget =
sscCreateDataWidget(
this, mReconstructer->getParam(
"Volume Size"));
87 sizesLayout->addWidget(inputSpacingLabel, 0, 0);
88 sizesLayout->addWidget(mInputSpacingLineEdit, 0, 1);
89 sizesLayout->addLayout(extentLayout, 0, 2);
91 sizesLayout->addWidget(maxVolSizeWidget, 1, 2);
93 QHBoxLayout* runLayout =
new QHBoxLayout;
94 topLayout->addLayout(runLayout);
95 runLayout->addWidget(mReconstructButton);
97 QIcon(
":/icons/open_icon_library/system-run-5.png"),
98 "Details",
"Show Advanced Settings",
99 SLOT(toggleDetailsSlot()),
102 topLayout->addWidget(mFileSelectWidget);
103 topLayout->addLayout(sizesLayout);
106 topLayout->addWidget(presetTFWidget);
108 mOptionsWidget = this->createOptionsWidget();
109 mOptionsWidget->setVisible(
settings()->value(
"reconstruction/guiShowDetails").toBool());
110 topLayout->addWidget(mOptionsWidget);
112 topLayout->addStretch();
113 topLayout->addWidget(mTimedAlgorithmProgressBar);
116 void ReconstructionWidget::updateFileSelectorPath(QString path)
118 mFileSelectWidget->
setPath(path);
122 QString ReconstructionWidget::defaultWhatsThis()
const
125 "<h3>US 3D Reconstruction.</h3>"
126 "<p><i>Reconstruct 3D US data from acquired a 2D sequence.</i></br>"
130 void ReconstructionWidget::toggleDetailsSlot()
132 mOptionsWidget->setVisible(!mOptionsWidget->isVisible());
133 settings()->
setValue(
"reconstruction/guiShowDetails", mOptionsWidget->isVisible());
136 QWidget* ReconstructionWidget::createOptionsWidget()
138 QWidget* retval =
new QWidget(
this);
139 QGridLayout* layout =
new QGridLayout(retval);
140 layout->setMargin(0);
147 mAlgorithmGroup =
new QFrame(
this);
148 mAlgorithmGroup->setFrameStyle(QFrame::StyledPanel | QFrame::Raised);
149 mAlgorithmGroup->setSizePolicy(mAlgorithmGroup->sizePolicy().horizontalPolicy(),QSizePolicy::Fixed);
151 QVBoxLayout* algoOuterLayout =
new QVBoxLayout(mAlgorithmGroup);
153 QWidget* algorithmWidget =
sscCreateDataWidget(
this, mReconstructer->getParam(
"Algorithm"));
154 algoOuterLayout->addWidget(algorithmWidget);
155 mAlgoLayout =
new QStackedLayout;
156 this->repopulateAlgorithmGroup();
157 mAlgoLayout->setMargin(0);
158 algoOuterLayout->addLayout(mAlgoLayout);
160 layout->addWidget(mAlgorithmGroup, line, 0, 1, 2);
168 mDimXWidget =
new SpinBoxGroupWidget(
this,
DoublePropertyBasePtr(
new DoublePropertyXDim(mReconstructer)));
169 mDimYWidget =
new SpinBoxGroupWidget(
this,
DoublePropertyBasePtr(
new DoublePropertyYDim(mReconstructer)));
170 mDimZWidget =
new SpinBoxGroupWidget(
this,
DoublePropertyBasePtr(
new DoublePropertyZDim(mReconstructer)));
171 QHBoxLayout* outputVolDimLayout =
new QHBoxLayout;
172 outputVolDimLayout->addWidget(mDimXWidget);
173 outputVolDimLayout->addWidget(mDimYWidget);
174 outputVolDimLayout->addWidget(mDimZWidget);
175 layout->addLayout(outputVolDimLayout, line++, 0, 1, 2);
178 sscCreateDataWidget(
this, mReconstructer->getParam(
"Extra Temporal Calib"), layout, line++);
179 sscCreateDataWidget(
this, mReconstructer->getParam(
"Reduce mask (% in 1D)"), layout, line++);
184 void ReconstructionWidget::repopulateAlgorithmGroup()
186 QString algoName = mReconstructer->getParam(
"Algorithm")->getValueAsVariant().toString();
188 if (mAlgoLayout->currentWidget() && (algoName == mAlgoLayout->currentWidget()->objectName()))
191 for (
int i=0; i<mAlgoLayout->count(); ++i)
193 if (algoName==mAlgoLayout->widget(i)->objectName())
195 mAlgoLayout->setCurrentIndex(i);
203 while ((child = mAlgoLayout->takeAt(0)) != 0)
206 QWidget* widget = child->widget();
211 this->createNewStackedWidget(algoName);
214 void ReconstructionWidget::createNewStackedWidget(QString algoName)
216 QWidget* oneAlgoWidget =
new QWidget(
this);
217 oneAlgoWidget->setObjectName(algoName);
218 mAlgoLayout->addWidget(oneAlgoWidget);
219 QGridLayout* oneAlgoLayout =
new QGridLayout(oneAlgoWidget);
220 oneAlgoLayout->setMargin(0);
222 std::vector<PropertyPtr> algoOption = mReconstructer->getAlgoOptions();
224 for (;row < algoOption.size(); ++row)
228 oneAlgoLayout->setRowStretch(row, 1);
230 mAlgoLayout->setCurrentWidget(oneAlgoWidget);
233 QString ReconstructionWidget::getCurrentPath()
235 return QFileInfo(mReconstructer->getSelectedFilename()).dir().absolutePath();
240 mReconstructer->startReconstruction();
246 this->
selectData(mReconstructer->getSelectedFilename());
252 void ReconstructionWidget::inputDataSelected(QString mhdFileName)
254 if (mReconstructer->getSelectedFilename().isEmpty())
264 if (filename.isEmpty())
270 mReconstructer->selectData(filename);
278 Vector3D range = mReconstructer->getOutputVolumeParams().getExtent().range();
281 QString(
"%1, %2, %3").arg(range[0], 0,
'f', 1).arg(range[1], 0,
'f', 1).arg(range[2], 0,
'f', 1);
282 mExtentLineEdit->setText(extText);
284 mInputSpacingLineEdit->setText(QString(
"%1").arg(mReconstructer->getOutputVolumeParams().getInputSpacing(), 0,
'f', 4));
287 void ReconstructionWidget::reconstructAboutToStartSlot()
289 std::set<cx::TimedAlgorithmPtr> threads = mReconstructer->getThreadedReconstruction();
290 mTimedAlgorithmProgressBar->
attach(threads);
293 void ReconstructionWidget::reconstructStartedSlot()
295 mReconstructButton->setEnabled(
false);
298 void ReconstructionWidget::reconstructFinishedSlot()
300 std::set<cx::TimedAlgorithmPtr> threads = mReconstructer->getThreadedReconstruction();
301 mTimedAlgorithmProgressBar->
detach(threads);
302 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)