1 #include "milxQtRegistrationAdvancedOptions.h" 13 setWindowModality(Qt::ApplicationModal);
14 setWindowTitle(tr(
"Registration Advanced Options"));
20 milxQtRegistrationAdvancedOptions::~milxQtRegistrationAdvancedOptions()
28 QSettings settings(
"Smili",
"Registration Plugin");
34 ui.titleSplinesOptions->setVisible(
true);
35 ui.descriptionSplinesOptions->setVisible(
true);
36 ui.sx->setVisible(
true);
37 ui.sy->setVisible(
true);
38 ui.sz->setVisible(
true);
39 ui.spinBoxSx->setVisible(
true);
40 ui.spinBoxSy->setVisible(
true);
41 ui.spinBoxSz->setVisible(
true);
42 ui.vSpacerSplines->changeSize(20, 20, QSizePolicy::Fixed, QSizePolicy::Fixed);
43 ui.vSpacerOptimisations->changeSize(0, 0, QSizePolicy::Fixed, QSizePolicy::Fixed);
44 ui.vSpacerSymApproach->changeSize(0, 0, QSizePolicy::Fixed, QSizePolicy::Fixed);
46 ui.optimisationsForm->setVerticalSpacing(7);
47 ui.lblMaxIt->setVisible(
true);
48 ui.spinBoxMaxIt->setVisible(
true);
49 ui.lblLn->setVisible(
true);
50 ui.spinBoxLn->setVisible(
true);
51 ui.lblLp->setVisible(
true);
52 ui.spinBoxLp->setVisible(
true);
53 ui.checkBoxNopy->setVisible(
true);
54 ui.lblPctOfBlock->setVisible(
false);
55 ui.spinBoxPctBlock->setVisible(
false);
56 ui.checkBoxRigOnly->setVisible(
false);
57 ui.checkBoxAffDirect->setVisible(
false);
59 ui.titleSymmetricApproach->setVisible(
true);
60 ui.checkBoxSym->setVisible(
true);
62 ui.lblParameterFile->setVisible(
false);
63 ui.lblParameterFileExplanation->setVisible(
false);
64 ui.lineParameterFile->setVisible(
false);
65 ui.btnBrowseParameterFile->setVisible(
false);
66 ui.lblPctOfBlock->setVisible(
false);
67 ui.btnClearParameterFile->setVisible(
false);
69 ui.spinBoxSx->setValue(settings.value(
"F3D/sx", -5).toFloat());
70 ui.spinBoxSy->setValue(settings.value(
"F3D/sy", -5).toFloat());
71 ui.spinBoxSz->setValue(settings.value(
"F3D/sz", -5).toFloat());
73 ui.spinBoxMaxIt->setValue(settings.value(
"F3D/maxit", 300).toInt());
74 ui.spinBoxLn->setValue(settings.value(
"F3D/ln", 3).toInt());
75 ui.spinBoxLp->setValue(settings.value(
"F3D/lp", 3).toInt());
77 ui.checkBoxNopy->setChecked(settings.value(
"F3D/nopy",
false).toBool());
78 ui.checkBoxSym->setChecked(settings.value(
"F3D/sym",
false).toBool());
81 else if (algo == AladinNifti)
83 ui.titleSplinesOptions->setVisible(
false);
84 ui.descriptionSplinesOptions->setVisible(
false);
85 ui.sx->setVisible(
false);
86 ui.sy->setVisible(
false);
87 ui.sz->setVisible(
false);
88 ui.spinBoxSx->setVisible(
false);
89 ui.spinBoxSy->setVisible(
false);
90 ui.spinBoxSz->setVisible(
false);
91 ui.checkBoxNopy->setVisible(
false);
93 ui.vSpacerSplines->changeSize(0, 0, QSizePolicy::Fixed, QSizePolicy::Fixed);
94 ui.vSpacerOptimisations->changeSize(20, 20, QSizePolicy::Fixed, QSizePolicy::Fixed);
95 ui.vSpacerSymApproach->changeSize(0, 0, QSizePolicy::Fixed, QSizePolicy::Fixed);
97 ui.optimisationsForm->setVerticalSpacing(7);
98 ui.lblMaxIt->setVisible(
true);
99 ui.spinBoxMaxIt->setVisible(
true);
100 ui.lblLn->setVisible(
true);
101 ui.spinBoxLn->setVisible(
true);
102 ui.lblLp->setVisible(
true);
103 ui.spinBoxLp->setVisible(
true);
104 ui.checkBoxNopy->setVisible(
false);
105 ui.lblPctOfBlock->setVisible(
true);
106 ui.spinBoxPctBlock->setVisible(
true);
107 ui.checkBoxRigOnly->setVisible(
true);
108 ui.checkBoxAffDirect->setVisible(
true);
110 ui.titleSymmetricApproach->setVisible(
true);
111 ui.checkBoxSym->setVisible(
true);
113 ui.lblParameterFile->setVisible(
false);
114 ui.lblParameterFileExplanation->setVisible(
false);
115 ui.lineParameterFile->setVisible(
false);
116 ui.btnBrowseParameterFile->setVisible(
false);
117 ui.btnClearParameterFile->setVisible(
false);
119 ui.spinBoxMaxIt->setValue(settings.value(
"aladin/maxit", 5).toInt());
120 ui.spinBoxLn->setValue(settings.value(
"aladin/ln", 3).toInt());
121 ui.spinBoxLp->setValue(settings.value(
"aladin/lp", 3).toInt());
122 ui.spinBoxPctBlock->setValue(settings.value(
"aladin/%v", 50).toFloat());
124 ui.checkBoxAffDirect->setChecked(settings.value(
"aladin/aF3Direct",
false).toBool());
125 ui.checkBoxRigOnly->setChecked(settings.value(
"aladin/rigOnly",
false).toBool());
126 ui.checkBoxSym->setChecked(settings.value(
"aladin/sym",
true).toBool());
129 else if (algo == ElastixAffine || algo == ElastixBSpline)
131 ui.titleSplinesOptions->setVisible(
false);
132 ui.descriptionSplinesOptions->setVisible(
false);
133 ui.sx->setVisible(
false);
134 ui.sy->setVisible(
false);
135 ui.sz->setVisible(
false);
136 ui.spinBoxSx->setVisible(
false);
137 ui.spinBoxSy->setVisible(
false);
138 ui.spinBoxSz->setVisible(
false);
139 ui.checkBoxNopy->setVisible(
false);
141 ui.vSpacerSplines->changeSize(0, 0, QSizePolicy::Fixed, QSizePolicy::Fixed);
142 ui.vSpacerOptimisations->changeSize(20, 20, QSizePolicy::Fixed, QSizePolicy::Fixed);
143 ui.vSpacerSymApproach->changeSize(0, 0, QSizePolicy::Fixed, QSizePolicy::Fixed);
145 ui.optimisationsForm->setVerticalSpacing(0);
146 ui.lblMaxIt->setVisible(
true);
147 ui.spinBoxMaxIt->setVisible(
true);
148 ui.lblLn->setVisible(
false);
149 ui.spinBoxLn->setVisible(
false);
150 ui.lblLp->setVisible(
false);
151 ui.spinBoxLp->setVisible(
false);
152 ui.checkBoxNopy->setVisible(
false);
153 ui.lblPctOfBlock->setVisible(
false);
154 ui.spinBoxPctBlock->setVisible(
false);
155 ui.checkBoxRigOnly->setVisible(
false);
156 ui.checkBoxAffDirect->setVisible(
false);
158 ui.titleSymmetricApproach->setVisible(
false);
159 ui.checkBoxSym->setVisible(
false);
161 ui.lblParameterFile->setVisible(
true);
162 ui.lineParameterFile->setVisible(
true);
163 ui.lblParameterFileExplanation->setVisible(
true);
164 ui.btnBrowseParameterFile->setVisible(
true);
165 ui.btnClearParameterFile->setVisible(
true);
167 if (algo == ElastixAffine)
169 ui.spinBoxMaxIt->setValue(settings.value(
"elastixAffine/maxit", 250).toInt());
170 ui.lineParameterFile->setText(settings.value(
"elastixAffine/parameterFile",
"").toString());
172 else if (algo == ElastixBSpline)
174 ui.spinBoxMaxIt->setValue(settings.value(
"elastixBSpline/maxit", 500).toInt());
175 ui.lineParameterFile->setText(settings.value(
"elastixBSpline/parameterFile",
"").toString());
179 this->resize(10, 10);
185 connect(this->
ui.btnBrowseParameterFile, SIGNAL(clicked()),
this, SLOT(browseBtnClicked()));
186 connect(this->
ui.btnClearParameterFile, SIGNAL(clicked()),
this, SLOT(clearFileBtnClicked()));
189 void milxQtRegistrationAdvancedOptions::browseBtnClicked()
191 QFileDialog fileOpener;
192 fileOpener.setFileMode(QFileDialog::ExistingFile);
193 QString filename = fileOpener.getOpenFileName(
this, tr(
"Select File"));
194 this->
ui.lineParameterFile->setText(filename);
197 void milxQtRegistrationAdvancedOptions::clearFileBtnClicked()
199 this->
ui.lineParameterFile->setText(
"");
207 if (this->
ui.lineParameterFile->text() !=
"" && QFile::exists(this->
ui.lineParameterFile->text()))
209 params.parameterFile = this->
ui.lineParameterFile->text();
210 params.customParameterFile =
true;
216 params.parametersTxt =
217 "(FixedInternalImagePixelType \"float\")\r\n" 218 "(MovingInternalImagePixelType \"float\")\r\n" 219 "(UseDirectionCosines \"true\")\r\n" 220 "(Registration \"MultiResolutionRegistration\")\r\n" 221 "(Interpolator \"BSplineInterpolator\")\r\n" 222 "(ResampleInterpolator \"FinalBSplineInterpolator\")\r\n" 223 "(Resampler \"DefaultResampler\")\r\n" 224 "(FixedImagePyramid \"FixedRecursiveImagePyramid\")\r\n" 225 "(MovingImagePyramid \"MovingRecursiveImagePyramid\")\r\n" 226 "(Optimizer \"AdaptiveStochasticGradientDescent\")\r\n" 227 "(Transform \"AffineTransform\")\r\n" 228 "(Metric \"AdvancedMattesMutualInformation\")\r\n" 229 "(AutomaticScalesEstimation \"true\")\r\n" 230 "(AutomaticTransformInitialization \"true\")\r\n" 231 "(HowToCombineTransforms \"Compose\")\r\n" 232 "(NumberOfHistogramBins 32)\r\n" 233 "(ErodeMask \"false\")\r\n" 234 "(NumberOfResolutions 4)\r\n" 235 "(MaximumNumberOfIterations " + QString::number(
ui.spinBoxMaxIt->value()) +
")\r\n" 236 "(NumberOfSpatialSamples 2048)\r\n" 237 "(NewSamplesEveryIteration \"true\")\r\n" 238 "(ImageSampler \"Random\")\r\n" 239 "(BSplineInterpolationOrder 1)\r\n" 240 "(FinalBSplineInterpolationOrder 3)\r\n" 241 "(DefaultPixelValue 0)\r\n" 242 "(WriteResultImage \"true\")\r\n" 243 "(ResultImageFormat \"nii\")\r\n";
253 if (this->
ui.lineParameterFile->text() !=
"" && QFile::exists(this->
ui.lineParameterFile->text()))
255 params.parameterFile = this->
ui.lineParameterFile->text();
256 params.customParameterFile =
true;
262 params.parametersTxt =
263 "(FixedInternalImagePixelType \"float\")\r\n" 264 "(MovingInternalImagePixelType \"float\")\r\n" 265 "(UseDirectionCosines \"true\")\r\n" 266 "(Registration \"MultiResolutionRegistration\")\r\n" 267 "(Interpolator \"BSplineInterpolator\")\r\n" 268 "(ResampleInterpolator \"FinalBSplineInterpolator\")\r\n" 269 "(Resampler \"DefaultResampler\")\r\n" 270 "(FixedImagePyramid \"FixedRecursiveImagePyramid\")\r\n" 271 "(MovingImagePyramid \"MovingRecursiveImagePyramid\")\r\n" 272 "(Optimizer \"AdaptiveStochasticGradientDescent\")\r\n" 273 "(Transform \"BSplineTransform\")\r\n" 274 "(Metric \"AdvancedMattesMutualInformation\")\r\n" 275 "(FinalGridSpacingInPhysicalUnits 16)\r\n" 276 "(HowToCombineTransforms \"Compose\")\r\n" 277 "(NumberOfHistogramBins 32)\r\n" 278 "(ErodeMask \"false\")\r\n" 279 "(NumberOfResolutions 4)\r\n" 280 "(MaximumNumberOfIterations " + QString::number(
ui.spinBoxMaxIt->value()) +
")\r\n" 281 "(NumberOfSpatialSamples 2048)\r\n" 282 "(NewSamplesEveryIteration \"true\")\r\n" 283 "(ImageSampler \"Random\")\r\n" 284 "(BSplineInterpolationOrder 1)\r\n" 285 "(FinalBSplineInterpolationOrder 3)\r\n" 286 "(DefaultPixelValue 0)\r\n" 287 "(WriteResultImage \"true\")\r\n" 288 "(ResultImageFormat \"nii\")\r\n";
301 this->
reset(F3DNifti);
305 params.spacing[0] =
ui.spinBoxSx->value();
308 params.spacing[1] =
ui.spinBoxSy->value();
311 params.spacing[2] =
ui.spinBoxSz->value();
314 params.maxit =
ui.spinBoxMaxIt->value();
317 params.ln =
ui.spinBoxLn->value();
320 params.lp =
ui.spinBoxLp->value();
323 params.nopy =
ui.checkBoxNopy->isChecked();
326 params.useSym =
ui.checkBoxSym->isChecked();
338 this->
reset(AladinNifti);
342 params.maxit =
ui.spinBoxMaxIt->value();
345 params.ln =
ui.spinBoxLn->value();
348 params.lp =
ui.spinBoxLp->value();
351 params.percentBlock =
ui.spinBoxPctBlock->value();
354 params.affineDirect =
ui.checkBoxAffDirect->isChecked();
357 params.rigOnly =
ui.checkBoxRigOnly->isChecked();
360 params.useSym =
ui.checkBoxSym->isChecked();
370 QSettings settings(
"Smili",
"Registration Plugin");
374 settings.setValue(
"F3D/sx",
ui.spinBoxSx->value());
375 settings.setValue(
"F3D/sy",
ui.spinBoxSy->value());
376 settings.setValue(
"F3D/sz",
ui.spinBoxSz->value());
378 settings.setValue(
"F3D/maxit",
ui.spinBoxMaxIt->value());
379 settings.setValue(
"F3D/ln",
ui.spinBoxLn->value());
380 settings.setValue(
"F3D/lp",
ui.spinBoxLp->value());
382 settings.setValue(
"F3D/nopy",
ui.checkBoxNopy->isChecked());
383 settings.setValue(
"F3D/sym",
ui.checkBoxSym->isChecked());
387 settings.setValue(
"aladin/maxit",
ui.spinBoxMaxIt->value());
388 settings.setValue(
"aladin/ln",
ui.spinBoxLn->value());
389 settings.setValue(
"aladin/lp",
ui.spinBoxLp->value());
390 settings.setValue(
"aladin/%v",
ui.spinBoxPctBlock->value());
392 settings.setValue(
"aladin/aF3Direct",
ui.checkBoxAffDirect->isChecked());
393 settings.setValue(
"aladin/rigOnly",
ui.checkBoxRigOnly->isChecked());
394 settings.setValue(
"aladin/sym",
ui.checkBoxSym->isChecked());
398 settings.setValue(
"elastixAffine/maxit",
ui.spinBoxMaxIt->value());
399 settings.setValue(
"elastixAffine/parameterFile",
ui.lineParameterFile->text());
403 settings.setValue(
"elastixBSpline/maxit", 500);
404 settings.setValue(
"elastixBSpline/parameterFile",
ui.lineParameterFile->text());
Ui::dlgRegistrationAdvancedOptions ui
User interface.
milxQtRegistrationAdvancedOptions(QDialog *theParent=0)
The standard constructor.
milxQtRegistrationParams getParamsAladinNifti()
Get the advanced parameter of a Nifti Aladin registration.
void reject()
Click on button Cancel.
void reset(RegType algo)
Reset the advanced form to the algorithm in parameter.
void accept()
Click on button Ok.
milxQtRegistrationParams getParamsElastixAffine()
Get the advanced parameters of an Elastix Affine registration.
milxQtRegistrationParams getParamsElastixBSpline()
Get the advanced parameters of an Elastix BSpline registration.
void createConnections()
Create connections with UI.
milxQtRegistrationParams getParamsF3DNifti()
Get the advanced parameter of a Nifti F3D registration.
RegType currentAlgo
Current algo.