20 #include <itkCenteredTransformInitializer.h>
21 #include <itkEuler2DTransform.h>
48 template <
class TPixelType,
unsigned int VImageDimension>
49 itk::Object::Pointer QmitkEuler2DTransformView::GetTransform2(itk::Image<TPixelType, VImageDimension> *itkImage1)
51 if (VImageDimension == 2)
53 typedef typename itk::Image<TPixelType, 2> FixedImage2DType;
54 typedef typename itk::Image<TPixelType, 2> MovingImage2DType;
62 movingImageToItk->Update();
66 transformPointer->SetIdentity();
67 if (
m_Controls.m_CenterForInitializerEuler2D->isChecked())
69 typedef typename itk::Euler2DTransform<double> Euler2DTransformType;
70 typedef typename itk::CenteredTransformInitializer<Euler2DTransformType, FixedImage2DType, MovingImage2DType>
71 TransformInitializerType;
73 transformInitializer->SetFixedImage(fixedImage2D);
74 transformInitializer->SetMovingImage(movingImage2D);
75 transformInitializer->SetTransform(transformPointer);
78 transformInitializer->MomentsOn();
82 transformInitializer->GeometryOn();
84 transformInitializer->InitializeTransform();
87 return transformPointer.GetPointer();
94 itk::Array<double> transformValues;
95 transformValues.SetSize(6);
96 transformValues.fill(0);
97 transformValues[0] =
m_Controls.m_UseOptimizerScalesEuler2D->isChecked();
98 transformValues[1] =
m_Controls.m_RotationScaleEuler2D->text().toDouble();
99 transformValues[2] =
m_Controls.m_TranslationXScaleEuler2D->text().toDouble();
100 transformValues[3] =
m_Controls.m_TranslationYScaleEuler2D->text().toDouble();
101 transformValues[4] =
m_Controls.m_CenterForInitializerEuler2D->isChecked();
102 transformValues[5] =
m_Controls.m_MomentsEuler2D->isChecked();
103 return transformValues;
108 m_Controls.m_UseOptimizerScalesEuler2D->setChecked(transformValues[0]);
109 m_Controls.m_RotationScaleEuler2D->setText(QString::number(transformValues[1]));
110 m_Controls.m_TranslationXScaleEuler2D->setText(QString::number(transformValues[2]));
111 m_Controls.m_TranslationYScaleEuler2D->setText(QString::number(transformValues[3]));
112 m_Controls.m_CenterForInitializerEuler2D->setChecked(transformValues[4]);
113 m_Controls.m_MomentsEuler2D->setChecked(transformValues[5]);
114 m_Controls.m_GeometryEuler2D->setChecked(!transformValues[5]);
125 QValidator *validatorLineEditInputFloat =
new QDoubleValidator(0, 20000000, 8,
this);
126 m_Controls.m_RotationScaleEuler2D->setValidator(validatorLineEditInputFloat);
127 m_Controls.m_TranslationXScaleEuler2D->setValidator(validatorLineEditInputFloat);
128 m_Controls.m_TranslationYScaleEuler2D->setValidator(validatorLineEditInputFloat);
133 itk::Array<double> scales;
136 if (
m_Controls.m_UseOptimizerScalesEuler2D->isChecked())
138 scales[0] =
m_Controls.m_RotationScaleEuler2D->text().toDouble();
139 scales[1] =
m_Controls.m_TranslationXScaleEuler2D->text().toDouble();
140 scales[2] =
m_Controls.m_TranslationYScaleEuler2D->text().toDouble();
146 vtkTransform *vtktransform,
147 itk::Array<double> transformParams)
152 vtktransform->PostMultiply();
153 vtktransform->RotateZ(angle);
154 vtktransform->Translate(transformParams[1], transformParams[2], 0);
155 vtktransform->PreMultiply();
itk::SmartPointer< Self > Pointer
#define AccessFixedDimensionByItk(mitkImage, itkImageTypeFunction, dimension)
Access a mitk-image with known dimension by an itk-image.
TransformType
Unique integer value for every transform.
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.