00001 /*========================================================================= 00002 00003 Program: Medical Imaging & Interaction Toolkit 00004 Language: C++ 00005 Date: $Date$ 00006 Version: $Revision$ 00007 00008 Copyright (c) German Cancer Research Center, Division of Medical and 00009 Biological Informatics. All rights reserved. 00010 See MITKCopyright.txt or https://www.mitk.org/copyright.html for details. 00011 00012 This software is distributed WITHOUT ANY WARRANTY; without even 00013 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00014 PURPOSE. See the above copyright notices for more information. 00015 00016 =========================================================================*/ 00017 00018 00019 #ifndef QMITKRIGIDREGISTRATION_H 00020 #define QMITKRIGIDREGISTRATION_H 00021 00022 #include "QmitkFunctionality.h" 00023 #include "ui_QmitkRigidRegistrationViewControls.h" 00024 00025 #include "berryISelectionListener.h" 00026 #include "berryIStructuredSelection.h" 00027 00028 #include "../RigidregistrationDll.h" 00029 00030 // Time Slider related 00031 #include <QmitkStepperAdapter.h> 00032 00047 class RIGIDREGISTRATION_EXPORT QmitkRigidRegistrationView : public QObject, public QmitkFunctionality 00048 { 00049 00050 friend struct SelListenerRigidRegistration; 00051 00052 Q_OBJECT 00053 00054 public: 00055 00056 static const std::string VIEW_ID; 00057 00061 QmitkRigidRegistrationView(QObject *parent=0, const char *name=0); 00062 00066 virtual ~QmitkRigidRegistrationView(); 00067 00071 virtual void CreateQtPartControl(QWidget *parent); 00072 00076 virtual void StdMultiWidgetAvailable (QmitkStdMultiWidget &stdMultiWidget); 00077 00081 virtual void StdMultiWidgetNotAvailable(); 00082 00086 virtual void CreateConnections(); 00087 00091 virtual void Activated(); 00092 00096 virtual void Deactivated(); 00097 00098 virtual void Visible(); 00099 virtual void Hidden(); 00100 00101 void DataNodeHasBeenRemoved(const mitk::DataNode* node); 00102 00103 signals: 00104 00105 protected slots: 00106 00110 void FixedSelected(mitk::DataNode::Pointer fixedImage); 00111 00115 void MovingSelected(mitk::DataNode::Pointer movingImage); 00116 00120 bool CheckCalculate(); 00121 00125 void UndoTransformation(); 00126 00130 void RedoTransformation(); 00131 00135 void AddNewTransformationToUndoList(); 00136 00142 void Translate(int* translateVector); 00143 00149 void Rotate(int* rotateVector); 00150 00156 void Scale(int* scaleVector); 00157 00161 void AlignCenters(); 00162 00167 void ShowRedGreen(bool show); 00168 00173 void ShowManualRegistrationFrame(bool show); 00174 00179 void OpacityUpdate(float opacity); 00180 00186 void OpacityUpdate(int opacity); 00187 00192 void SetImageColor(bool redGreen); 00193 00197 void ClearTransformationLists(); 00198 00199 void SetUndoEnabled( bool enable ); 00200 00201 void SetRedoEnabled( bool enable ); 00202 00203 void CheckCalculateEnabled(); 00204 00205 void xTrans_valueChanged( int v ); 00206 00207 void yTrans_valueChanged( int v ); 00208 00209 void zTrans_valueChanged( int v ); 00210 00211 void xRot_valueChanged( int v ); 00212 00213 void yRot_valueChanged( int v ); 00214 00215 void zRot_valueChanged( int v ); 00216 00217 void xScale_valueChanged( int v ); 00218 00219 void yScale_valueChanged( int v ); 00220 00221 void zScale_valueChanged( int v ); 00222 00223 void MovingImageChanged(); 00224 00228 void Calculate(); 00229 00230 void SetOptimizerValue( double value ); 00231 00232 void StopOptimizationClicked(); 00233 00234 void UpdateTimestep(); 00235 00236 void SetImagesVisible(berry::ISelection::ConstPointer /*selection*/); 00237 00238 void CheckForMaskImages(); 00239 00240 void UseFixedMaskImageChecked(bool checked); 00241 00242 void UseMovingMaskImageChecked(bool checked); 00243 00244 void TabChanged(int index); 00245 00246 void SwitchImages(); 00247 00248 protected: 00249 00250 berry::ISelectionListener::Pointer m_SelListener; 00251 berry::IStructuredSelection::ConstPointer m_CurrentSelection; 00252 00257 QmitkStdMultiWidget * m_MultiWidget; 00258 00262 Ui::QmitkRigidRegistrationViewControls m_Controls; 00263 mitk::DataNode::Pointer m_MovingNode; 00264 mitk::DataNode::Pointer m_MovingMaskNode; 00265 mitk::DataNode::Pointer m_FixedNode; 00266 mitk::DataNode::Pointer m_FixedMaskNode; 00267 std::list<mitk::Geometry3D::Pointer> m_UndoGeometryList; 00268 std::list<std::map<mitk::DataNode::Pointer, mitk::Geometry3D*> > m_UndoChildGeometryList; 00269 std::list<mitk::Geometry3D::Pointer> m_RedoGeometryList; 00270 std::list<std::map<mitk::DataNode::Pointer, mitk::Geometry3D*> > m_RedoChildGeometryList; 00271 bool m_ShowRedGreen; 00272 float m_Opacity; 00273 float m_OriginalOpacity; 00274 bool m_Deactivated; 00275 int m_FixedDimension; 00276 int m_MovingDimension; 00277 int * translationParams; 00278 int * rotationParams; 00279 int * scalingParams; 00280 mitk::Color m_FixedColor; 00281 mitk::Color m_MovingColor; 00282 int m_TranslateSliderPos[3]; 00283 int m_RotateSliderPos[3]; 00284 int m_ScaleSliderPos[3]; 00285 00286 QmitkStepperAdapter* m_TimeStepperAdapter; 00287 }; 00288 00289 #endif //QMITKRigidREGISTRATION_H