20 #include <itkCenteredTransformInitializer.h>
21 #include <itkVersorRigid3DTransform.h>
34 return mitk::TransformParameters::RIGID3DTRANSFORM;
47 template <
class TPixelType,
unsigned int VImageDimension>
48 itk::Object::Pointer QmitkRigid3DTransformView::GetTransform2(itk::Image<TPixelType, VImageDimension> * )
50 typedef typename itk::Image<TPixelType, VImageDimension> FixedImageType;
51 typedef typename itk::Image<TPixelType, VImageDimension> MovingImageType;
52 if (VImageDimension == 3)
55 transformPointer->SetIdentity();
56 m_CenterX = transformPointer->GetCenter()[0];
57 m_CenterY = transformPointer->GetCenter()[1];
58 m_CenterZ = transformPointer->GetCenter()[2];
60 return transformPointer.GetPointer();
67 itk::Array<double> transformValues;
68 transformValues.SetSize(15);
69 transformValues.fill(0);
70 transformValues[0] =
m_Controls.m_UseOptimizerScalesRigid3D->isChecked();
71 transformValues[1] =
m_Controls.m_ScalesRigid3DTransformScale1->text().toDouble();
72 transformValues[2] =
m_Controls.m_ScalesRigid3DTransformScale2->text().toDouble();
73 transformValues[3] =
m_Controls.m_ScalesRigid3DTransformScale3->text().toDouble();
74 transformValues[4] =
m_Controls.m_ScalesRigid3DTransformScale4->text().toDouble();
75 transformValues[5] =
m_Controls.m_ScalesRigid3DTransformScale5->text().toDouble();
76 transformValues[6] =
m_Controls.m_ScalesRigid3DTransformScale6->text().toDouble();
77 transformValues[7] =
m_Controls.m_ScalesRigid3DTransformScale7->text().toDouble();
78 transformValues[8] =
m_Controls.m_ScalesRigid3DTransformScale8->text().toDouble();
79 transformValues[9] =
m_Controls.m_ScalesRigid3DTransformScale9->text().toDouble();
80 transformValues[10] =
m_Controls.m_ScalesRigid3DTransformScaleTranslationX->text().toDouble();
81 transformValues[11] =
m_Controls.m_ScalesRigid3DTransformScaleTranslationY->text().toDouble();
82 transformValues[12] =
m_Controls.m_ScalesRigid3DTransformScaleTranslationZ->text().toDouble();
83 transformValues[13] =
m_Controls.m_CenterForInitializerRigid3D->isChecked();
84 transformValues[14] =
m_Controls.m_MomentsRigid3D->isChecked();
85 return transformValues;
90 m_Controls.m_UseOptimizerScalesRigid3D->setChecked(transformValues[0]);
91 m_Controls.m_ScalesRigid3DTransformScale1->setText(QString::number(transformValues[1]));
92 m_Controls.m_ScalesRigid3DTransformScale2->setText(QString::number(transformValues[2]));
93 m_Controls.m_ScalesRigid3DTransformScale3->setText(QString::number(transformValues[3]));
94 m_Controls.m_ScalesRigid3DTransformScale4->setText(QString::number(transformValues[4]));
95 m_Controls.m_ScalesRigid3DTransformScale5->setText(QString::number(transformValues[5]));
96 m_Controls.m_ScalesRigid3DTransformScale6->setText(QString::number(transformValues[6]));
97 m_Controls.m_ScalesRigid3DTransformScale7->setText(QString::number(transformValues[7]));
98 m_Controls.m_ScalesRigid3DTransformScale8->setText(QString::number(transformValues[8]));
99 m_Controls.m_ScalesRigid3DTransformScale9->setText(QString::number(transformValues[9]));
100 m_Controls.m_ScalesRigid3DTransformScaleTranslationX->setText(QString::number(transformValues[10]));
101 m_Controls.m_ScalesRigid3DTransformScaleTranslationY->setText(QString::number(transformValues[11]));
102 m_Controls.m_ScalesRigid3DTransformScaleTranslationZ->setText(QString::number(transformValues[12]));
103 m_Controls.m_CenterForInitializerRigid3D->setChecked(transformValues[13]);
104 m_Controls.m_MomentsRigid3D->setChecked(transformValues[14]);
105 m_Controls.m_GeometryRigid3D->setChecked(!transformValues[14]);
116 QValidator *validatorLineEditInputFloat =
new QDoubleValidator(0, 20000000, 8,
this);
117 m_Controls.m_ScalesRigid3DTransformScale1->setValidator(validatorLineEditInputFloat);
118 m_Controls.m_ScalesRigid3DTransformScale2->setValidator(validatorLineEditInputFloat);
119 m_Controls.m_ScalesRigid3DTransformScale3->setValidator(validatorLineEditInputFloat);
120 m_Controls.m_ScalesRigid3DTransformScale4->setValidator(validatorLineEditInputFloat);
121 m_Controls.m_ScalesRigid3DTransformScale5->setValidator(validatorLineEditInputFloat);
122 m_Controls.m_ScalesRigid3DTransformScale6->setValidator(validatorLineEditInputFloat);
123 m_Controls.m_ScalesRigid3DTransformScale7->setValidator(validatorLineEditInputFloat);
124 m_Controls.m_ScalesRigid3DTransformScale8->setValidator(validatorLineEditInputFloat);
125 m_Controls.m_ScalesRigid3DTransformScale9->setValidator(validatorLineEditInputFloat);
126 m_Controls.m_ScalesRigid3DTransformScaleTranslationX->setValidator(validatorLineEditInputFloat);
127 m_Controls.m_ScalesRigid3DTransformScaleTranslationY->setValidator(validatorLineEditInputFloat);
128 m_Controls.m_ScalesRigid3DTransformScaleTranslationZ->setValidator(validatorLineEditInputFloat);
133 itk::Array<double> scales;
136 if (
m_Controls.m_UseOptimizerScalesRigid3D->isChecked())
138 scales[0] =
m_Controls.m_ScalesRigid3DTransformScale1->text().toDouble();
139 scales[1] =
m_Controls.m_ScalesRigid3DTransformScale2->text().toDouble();
140 scales[2] =
m_Controls.m_ScalesRigid3DTransformScale3->text().toDouble();
141 scales[3] =
m_Controls.m_ScalesRigid3DTransformScale4->text().toDouble();
142 scales[4] =
m_Controls.m_ScalesRigid3DTransformScale5->text().toDouble();
143 scales[5] =
m_Controls.m_ScalesRigid3DTransformScale6->text().toDouble();
144 scales[6] =
m_Controls.m_ScalesRigid3DTransformScale7->text().toDouble();
145 scales[7] =
m_Controls.m_ScalesRigid3DTransformScale8->text().toDouble();
146 scales[8] =
m_Controls.m_ScalesRigid3DTransformScale9->text().toDouble();
147 scales[9] =
m_Controls.m_ScalesRigid3DTransformScaleTranslationX->text().toDouble();
148 scales[10] =
m_Controls.m_ScalesRigid3DTransformScaleTranslationY->text().toDouble();
149 scales[11] =
m_Controls.m_ScalesRigid3DTransformScaleTranslationZ->text().toDouble();
155 vtkTransform *vtktransform,
156 itk::Array<double> transformParams)
161 for (
int i = 0; i < 3; i++)
163 for (
int j = 0; j < 3; j++)
165 vtkmatrix->SetElement(i, j, transformParams[m]);
170 float translation[4];
175 vtkmatrix->MultiplyPoint(center, translation);
176 vtkmatrix->SetElement(0, 3, -translation[0] + center[0] + transformParams[9]);
177 vtkmatrix->SetElement(1, 3, -translation[1] + center[1] + transformParams[10]);
178 vtkmatrix->SetElement(2, 3, -translation[2] + center[2] + transformParams[11]);
179 vtktransform->SetMatrix(vtkmatrix);
itk::SmartPointer< Self > Pointer
TransformType
Unique integer value for every transform.
#define AccessByItk(mitkImage, itkImageTypeFunction)
Access a MITK image by an ITK image.
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.