20 #include <itkCenteredTransformInitializer.h>
21 #include <itkRigid2DTransform.h>
48 template <
class TPixelType,
unsigned int VImageDimension>
49 itk::Object::Pointer QmitkRigid2DTransformView::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_CenterForInitializerRigid2D->isChecked())
69 typedef typename itk::Rigid2DTransform<double> Rigid2DTransformType;
70 typedef typename itk::CenteredTransformInitializer<Rigid2DTransformType, 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_UseOptimizerScalesRigid2D->isChecked();
98 transformValues[1] =
m_Controls.m_ScalesRigid2DTransformScale1->text().toDouble();
99 transformValues[2] =
m_Controls.m_ScalesRigid2DTransformScaleTranslationX->text().toDouble();
100 transformValues[3] =
m_Controls.m_ScalesRigid2DTransformScaleTranslationY->text().toDouble();
101 transformValues[4] =
m_Controls.m_CenterForInitializerRigid2D->isChecked();
102 transformValues[5] =
m_Controls.m_MomentsRigid2D->isChecked();
103 return transformValues;
108 m_Controls.m_UseOptimizerScalesRigid2D->setChecked(transformValues[0]);
109 m_Controls.m_ScalesRigid2DTransformScale1->setText(QString::number(transformValues[1]));
110 m_Controls.m_ScalesRigid2DTransformScaleTranslationX->setText(QString::number(transformValues[2]));
111 m_Controls.m_ScalesRigid2DTransformScaleTranslationY->setText(QString::number(transformValues[3]));
112 m_Controls.m_CenterForInitializerRigid2D->setChecked(transformValues[4]);
113 m_Controls.m_MomentsRigid2D->setChecked(transformValues[5]);
114 m_Controls.m_GeometryRigid2D->setChecked(!transformValues[5]);
125 QValidator *validatorLineEditInputFloat =
new QDoubleValidator(0, 20000000, 8,
this);
126 m_Controls.m_ScalesRigid2DTransformScale1->setValidator(validatorLineEditInputFloat);
127 m_Controls.m_ScalesRigid2DTransformScaleTranslationX->setValidator(validatorLineEditInputFloat);
128 m_Controls.m_ScalesRigid2DTransformScaleTranslationY->setValidator(validatorLineEditInputFloat);
133 itk::Array<double> scales;
136 if (
m_Controls.m_UseOptimizerScalesRigid2D->isChecked())
138 scales[0] =
m_Controls.m_ScalesRigid2DTransformScale1->text().toDouble();
139 scales[1] =
m_Controls.m_ScalesRigid2DTransformScaleTranslationX->text().toDouble();
140 scales[2] =
m_Controls.m_ScalesRigid2DTransformScaleTranslationY->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.