NifTK  16.4.1 - 0798f20
CMIC's Translational Medical Imaging Platform
QmitkNiftyRegView.h
Go to the documentation of this file.
1 /*=============================================================================
2 
3  NifTK: A software platform for medical image computing.
4 
5  Copyright (c) University College London (UCL). All rights reserved.
6 
7  This software is distributed WITHOUT ANY WARRANTY; without even
8  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
9  PURPOSE.
10 
11  See LICENSE.txt in the top level directory for details.
12 
13 =============================================================================*/
14 
15 #ifndef QmitkNiftyRegView_h
16 #define QmitkNiftyRegView_h
17 
18 // broken
19 #undef _USE_CUDA
20 
21 #include "ui_QmitkNiftyRegViewControls.h"
22 #include <berryISelectionListener.h>
23 #include <QmitkAbstractView.h>
24 
25 // ITK
26 #include <itkMultiThreader.h>
27 
28 #include "NiftyRegParameters.h"
29 
30 #include <_reg_aladin.h>
31 #include <_reg_tools.h>
32 
33 #include <_reg_f3d2.h>
34 
35 #ifdef _USE_CUDA
36 #include <_reg_f3d_gpu.h>
37 #endif
38 
39 
40 #ifdef _USE_NR_DOUBLE
41 #define PrecisionTYPE double
42 #else
43 #define PrecisionTYPE float
44 #endif
45 
46 
54 class QmitkNiftyRegView : public QmitkAbstractView
55 {
56  // this is needed for all Qt objects that should have a Qt meta-object
57  // (everything that derives from QObject and wants to have signal/slots)
58  Q_OBJECT
59 
60  friend class RegistrationExecution;
61 
62  public:
63 
64  static const std::string VIEW_ID;
65 
67  virtual ~QmitkNiftyRegView();
68 
69  void OnNodeAdded(const mitk::DataNode* node);
70  void OnNodeRemoved(const mitk::DataNode* node);
71  void OnNodeChanged(const mitk::DataNode* node);
72 
73 
74  protected slots:
75 
81 
83 
84  // Multi-Scale Options
85 
88 
89  // Input Image Options
90 
93  void OnNoSmoothingPushButtonPressed( void );
94 
95  void OnDoBlockMatchingOnlyRadioButtonToggled( bool checked );
96  void OnDoNonRigidOnlyRadioButtonToggled( bool checked );
98 
99  // Initial Affine Transformation
100 
101  void OnInputAffineCheckBoxToggled( bool checked );
103 
104  void OnInputFlirtCheckBoxStateChanged( int state );
105 
106  // Aladin - Initialisation
107 
108  void OnUseNiftyHeaderCheckBoxStateChanged( int state );
109 
110  // Aladin - Method
111 
112  void OnRigidOnlyRadioButtonToggled( bool checked );
113  void OnRigidThenAffineRadioButtonToggled( bool checked );
114  void OnDirectAffineRadioButtonToggled( bool checked );
115 
117 
121 
122  // Aladin - Advanced
123 
127 
128 
129 
130  // Non-Rigid - Initialisation
131 
134 
135 
136  // Non-Rigid - Input Image
137 
140 
143 
146 
149 
150  // Non-Rigid - Spline
151 
155 
156  // Non-Rigid - Objective Function
157 
160 
163 
166 
167  void OnApproxJacobianLogCheckBoxStateChanged( int state );
168 
169  void OnSimilarityNMIRadioButtonToggled( bool checked );
170  void OnSimilaritySSDRadioButtonToggled( bool checked );
171  void OnSimilarityKLDivRadioButtonToggled( bool checked );
172 
173  // Non-Rigid - Optimisation
174 
177  void OnUsePyramidalCheckBoxStateChanged( int state );
178 
179  // Non-Rigid - Advanced
180 
184 
188 
189 
190  // Execution
191 
192 
193  void OnCancelPushButtonPressed( void );
194 
197  void OnExecutePushButtonPressed( void );
198 
201 
202  friend void UpdateProgressBar( float pcntProgress, void *param );
203 
204  friend ITK_THREAD_RETURN_TYPE ExecuteRegistration( void *param );
205 
206 
207  protected:
208 
210  mitk::DataNode::Pointer GetDataNode( QString searchName );
211 
213  mitk::DataStorage::SetOfObjects::ConstPointer GetNodes();
214 
219 
221  virtual void CreateQtPartControl(QWidget *parent);
222 
224  virtual void SetDefaultParameters();
225 
227  virtual void SetGuiToParameterValues();
228 
230  virtual void CreateConnections();
231 
233  virtual void SetFocus();
234 
236  void WriteRegistrationParametersToFile( QString &filename );
237 
239  void ReadRegistrationParametersFromFile( QString &filename );
240 
242  void PrintSelf( std::ostream& os );
243 
245  void Modified();
246 
247 
249  Ui::QmitkNiftyRegViewControls m_Controls;
250 
253 
254 
261 
264 
266  reg_aladin<PrecisionTYPE> *m_RegAladin;
267 
269  reg_f3d<PrecisionTYPE> *m_RegNonRigid;
270 
271 };
272 
273 
274 void UpdateProgressBar( float pcntProgress, void *param );
275 ITK_THREAD_RETURN_TYPE ExecuteRegistration( void *param );
276 
277 #endif // QmitkNiftyRegView_h
278 
friend ITK_THREAD_RETURN_TYPE ExecuteRegistration(void *param)
Definition: QmitkNiftyRegView.cxx:2219
void OnControlPointSpacingZDoubleSpinBoxValueChanged(double value)
Definition: QmitkNiftyRegView.cxx:2997
void OnInputFlirtCheckBoxStateChanged(int state)
Definition: QmitkNiftyRegView.cxx:2593
void OnSaveTransformationPushButtonPressed(void)
Definition: QmitkNiftyRegView.cxx:1217
void OnAladinIterationsMaxSpinBoxValueChanged(int value)
Definition: QmitkNiftyRegView.cxx:2696
void OnSimilarityKLDivRadioButtonToggled(bool checked)
Definition: QmitkNiftyRegView.cxx:3120
void OnUpperThresholdTargetImageDoubleSpinBoxValueChanged(double value)
Definition: QmitkNiftyRegView.cxx:2864
QmitkNiftyRegView()
Definition: QmitkNiftyRegView.cxx:46
void OnNoSmoothingPushButtonPressed(void)
Definition: QmitkNiftyRegView.cxx:2490
void OnRigidThenAffineRadioButtonToggled(bool checked)
Definition: QmitkNiftyRegView.cxx:2646
void OnNonRigidInputControlPointBrowsePushButtonPressed(void)
Definition: QmitkNiftyRegView.cxx:2792
ITK_THREAD_RETURN_TYPE ExecuteRegistration(void *param)
Definition: QmitkNiftyRegView.cxx:2219
void OnNonRigidLinearInterpolationRadioButtonToggled(bool checked)
Definition: QmitkNiftyRegView.cxx:3230
void OnNonRigidInputControlPointCheckBoxStateChanged(int state)
Definition: QmitkNiftyRegView.cxx:2771
void OnTargetImageComboBoxChanged(int index)
Definition: QmitkNiftyRegView.cxx:986
bool m_Modified
Flag indicating whether any factors influencing the segmentation have been modified.
Definition: QmitkNiftyRegView.h:252
void OnUpperThresholdSourceImageAutoPushButtonPressed(void)
Definition: QmitkNiftyRegView.cxx:2960
void OnAladinInterpolationLinearRadioButtonToggled(bool checked)
Definition: QmitkNiftyRegView.cxx:2743
void OnWeightLogJacobianDoubleSpinBoxValueChanged(double value)
Definition: QmitkNiftyRegView.cxx:3041
void OnSmoothSourceImageDoubleSpinBoxValueChanged(double value)
Definition: QmitkNiftyRegView.cxx:2468
friend void UpdateProgressBar(float pcntProgress, void *param)
Definition: QmitkNiftyRegView.cxx:2416
GUI interface to enable the user to run the NiftyReg registration algorithm. .... ...
Definition: QmitkNiftyRegView.h:54
void OnUpperThresholdSourceImageDoubleSpinBoxValueChanged(double value)
Definition: QmitkNiftyRegView.cxx:2938
void OnNodeChanged(const mitk::DataNode *node)
Definition: QmitkNiftyRegView.cxx:948
void OnLoadRegistrationParametersPushButtonPressed(void)
Definition: QmitkNiftyRegView.cxx:2103
void OnLowerThresholdSourceImageDoubleSpinBoxValueChanged(double value)
Definition: QmitkNiftyRegView.cxx:2901
void OnDoNonRigidOnlyRadioButtonToggled(bool checked)
Definition: QmitkNiftyRegView.cxx:2521
void OnNumberOfLevelsSpinBoxValueChanged(int value)
Definition: QmitkNiftyRegView.cxx:2432
void OnLowerThresholdSourceImageAutoPushButtonPressed(void)
Definition: QmitkNiftyRegView.cxx:2923
virtual void SetGuiToParameterValues()
Set the default state of the GUI.
Definition: QmitkNiftyRegView.cxx:172
static const std::string VIEW_ID
Definition: QmitkNiftyRegView.h:64
void OnUsePyramidalCheckBoxStateChanged(int state)
Definition: QmitkNiftyRegView.cxx:3152
virtual void SetDefaultParameters()
Set the default parameters.
Definition: QmitkNiftyRegView.cxx:86
void OnUseNiftyHeaderCheckBoxStateChanged(int state)
Definition: QmitkNiftyRegView.cxx:2611
void UpdateAladinResultImageFilename()
Update the Aladin result/transformed image filename.
Definition: QmitkNiftyRegView.cxx:1028
void OnNonRigidNearestInterpolationRadioButtonToggled(bool checked)
Definition: QmitkNiftyRegView.cxx:3216
Definition: RegistrationExecution.h:24
void OnAladinInterpolationCubicRadioButtonToggled(bool checked)
Definition: QmitkNiftyRegView.cxx:2757
void OnAladinUseSymmetricAlgorithmCheckBoxStateChanged(int state)
Definition: QmitkNiftyRegView.cxx:2678
void OnExecutePushButtonPressed(void)
Definition: QmitkNiftyRegView.cxx:2129
reg_aladin< PrecisionTYPE > * m_RegAladin
The 'reg_aladin' registration object.
Definition: QmitkNiftyRegView.h:266
void OnApproxJacobianLogCheckBoxStateChanged(int state)
Definition: QmitkNiftyRegView.cxx:3074
GLsizei const GLfloat * value
Definition: glew.h:1833
void UpdateProgressBar(float pcntProgress, void *param)
Definition: QmitkNiftyRegView.cxx:2416
void Modified()
Function called whenever the object is modified.
Definition: QmitkNiftyRegView.cxx:865
void OnWeightBendingEnergyDoubleSpinBoxValueChanged(double value)
Definition: QmitkNiftyRegView.cxx:3030
void OnNodeAdded(const mitk::DataNode *node)
Definition: QmitkNiftyRegView.cxx:879
void OnRigidOnlyRadioButtonToggled(bool checked)
Definition: QmitkNiftyRegView.cxx:2630
void OnLowerThresholdTargetImageAutoPushButtonPressed(void)
Definition: QmitkNiftyRegView.cxx:2849
void OnUseSimpleGradientAscentCheckBoxStateChanged(int state)
Definition: QmitkNiftyRegView.cxx:3134
void OnInputAffineBrowsePushButtonPressed(void)
Definition: QmitkNiftyRegView.cxx:2562
virtual void CreateQtPartControl(QWidget *parent)
Called by framework, this method creates all the controls for this view.
Definition: QmitkNiftyRegView.cxx:156
void WriteRegistrationParametersToFile(QString &filename)
Save the registration parameters (as a shell-script command line)
Definition: QmitkNiftyRegView.cxx:1362
NiftyRegParameters< PrecisionTYPE > m_RegParameters
The registration parameters.
Definition: QmitkNiftyRegView.h:263
void OnLevelsToPerformSpinBoxValueChanged(int value)
Definition: QmitkNiftyRegView.cxx:2450
void OnInputAffineCheckBoxToggled(bool checked)
Definition: QmitkNiftyRegView.cxx:2551
void OnAladinInterpolationNearestRadioButtonToggled(bool checked)
Definition: QmitkNiftyRegView.cxx:2729
void OnSimilaritySSDRadioButtonToggled(bool checked)
Definition: QmitkNiftyRegView.cxx:3106
void OnSmoothTargetImageDoubleSpinBoxValueChanged(double value)
Definition: QmitkNiftyRegView.cxx:2479
void OnPercentBlockSpinBoxValueChanged(int value)
Definition: QmitkNiftyRegView.cxx:2707
void OnTargetMaskImageComboBoxChanged(int index)
Definition: QmitkNiftyRegView.cxx:1163
virtual ~QmitkNiftyRegView()
Definition: QmitkNiftyRegView.cxx:105
GLuint index
Definition: glew.h:1798
void ReadRegistrationParametersFromFile(QString &filename)
Read the registration parameters (as a shell-script command line)
Definition: QmitkNiftyRegView.cxx:1625
void OnDoBlockMatchingOnlyRadioButtonToggled(bool checked)
Definition: QmitkNiftyRegView.cxx:2506
void OnNonRigidCubicInterpolationRadioButtonToggled(bool checked)
Definition: QmitkNiftyRegView.cxx:3244
void OnPercentInliersSpinBoxValueChanged(int value)
Definition: QmitkNiftyRegView.cxx:2718
void OnUpperThresholdTargetImageAutoPushButtonPressed(void)
Definition: QmitkNiftyRegView.cxx:2886
void OnLowerThresholdTargetImageDoubleSpinBoxValueChanged(double value)
Definition: QmitkNiftyRegView.cxx:2827
void OnNumberSourceHistogramBinsSpinBoxValueChanged(int value)
Definition: QmitkNiftyRegView.cxx:3008
void OnSimilarityNMIRadioButtonToggled(bool checked)
Definition: QmitkNiftyRegView.cxx:3092
virtual void CreateConnections()
Creation of the connections of widgets in this class and the slots in this class. ...
Definition: QmitkNiftyRegView.cxx:469
void OnCancelPushButtonPressed(void)
Definition: QmitkNiftyRegView.cxx:1194
Ui::QmitkNiftyRegViewControls m_Controls
The specific controls for this widget.
Definition: QmitkNiftyRegView.h:249
void OnResetParametersPushButtonPressed(void)
Definition: QmitkNiftyRegView.cxx:1204
mitk::DataStorage::SetOfObjects::ConstPointer GetNodes()
Get the list of data nodes from the data manager.
Definition: QmitkNiftyRegView.cxx:141
void OnNonRigidIterationsMaxSpinBoxValueChanged(int value)
Definition: QmitkNiftyRegView.cxx:3170
float m_ProgressBarOffset
Definition: QmitkNiftyRegView.h:257
void OnWarpedPaddingValuePushButtonPressed(void)
Definition: QmitkNiftyRegView.cxx:3203
void OnSourceImageComboBoxChanged(int index)
Slot for the source image combo box which when clicked should list all the currently loaded images...
Definition: QmitkNiftyRegView.cxx:1121
void OnDirectAffineRadioButtonToggled(bool checked)
Definition: QmitkNiftyRegView.cxx:2662
GLfloat param
Definition: glew.h:1514
void OnNodeRemoved(const mitk::DataNode *node)
Definition: QmitkNiftyRegView.cxx:910
void OnSmoothingMetricDoubleSpinBoxValueChanged(double value)
Definition: QmitkNiftyRegView.cxx:3181
reg_f3d< PrecisionTYPE > * m_RegNonRigid
The 'reg_f3d' registration object.
Definition: QmitkNiftyRegView.h:269
mitk::DataNode::Pointer GetDataNode(QString searchName)
Get the DataNode with a specific name. If not found return 0.
Definition: QmitkNiftyRegView.cxx:61
void PrintSelf(std::ostream &os)
Print the object.
Definition: QmitkNiftyRegView.cxx:853
void UpdateNonRigidResultImageFilename()
Update the non-rigid result/transformed image filename.
Definition: QmitkNiftyRegView.cxx:1080
void OnLinearEnergyWeightsDoubleSpinBox_1ValueChanged(double value)
Definition: QmitkNiftyRegView.cxx:3052
GLsizei const GLcharARB ** string
Definition: glew.h:5194
virtual void SetFocus()
Called by framework, sets the focus on a specific widget.
Definition: QmitkNiftyRegView.cxx:131
void OnLinearEnergyWeightsDoubleSpinBox_2ValueChanged(double value)
Definition: QmitkNiftyRegView.cxx:3063
void OnControlPointSpacingXDoubleSpinBoxValueChanged(double value)
Definition: QmitkNiftyRegView.cxx:2975
void OnSaveRegistrationParametersPushButtonPressed(void)
Definition: QmitkNiftyRegView.cxx:1599
void OnNumberTargetHistogramBinsSpinBoxValueChanged(int value)
Definition: QmitkNiftyRegView.cxx:3019
float m_ProgressBarRange
Definition: QmitkNiftyRegView.h:260
void OnWarpedPaddingValueDoubleSpinBoxValueChanged(double value)
Definition: QmitkNiftyRegView.cxx:3192
void OnDoBlockMatchingThenNonRigidRadioButtonToggled(bool checked)
Definition: QmitkNiftyRegView.cxx:2536
void OnControlPointSpacingYDoubleSpinBoxValueChanged(double value)
Definition: QmitkNiftyRegView.cxx:2986