# ----------------------------------
# - BBTKGEditor v 1.4 BBG BlackBox Diagram file
-# - /home/davila/Creatis/All/creatools_source/creaRigidRegistration/PackRecalage/bbs/boxes/CompareImagesWidget_base_3Dp_B.bbg
+# - /tmpEED/creaTools/creatools_source/creaRigidRegistration/PackRecalage/bbs/boxes/CompareImagesWidget_base_3Dp_B.bbg
# ----------------------------------
APP_START
# ----------------------------------
# - BBTKGEditor v 1.4 BBS BlackBox Script (Complex Box)
-# - /home/davila/Creatis/All/creatools_source/creaRigidRegistration/PackRecalage/bbs/boxes/CompareImagesWidget_base_3Dp_B.bbs
+# - /tmpEED/creaTools/creatools_source/creaRigidRegistration/PackRecalage/bbs/boxes/CompareImagesWidget_base_3Dp_B.bbs
# ----------------------------------
include std
category "example"
-new ImageConvolution convol1
+new PackRecalage:ImageConvolution convol1
-new SliceImage Box02
+new creaMaracasVisu:SliceImage Box02
set Box02.TypeOrientation "0"
-new ImageConvolution Box03
+new PackRecalage:ImageConvolution Box03
-new SliceImage Box04
+new creaMaracasVisu:SliceImage Box04
set Box04.TypeOrientation "1"
-new ImageConvolution Box05
+new PackRecalage:ImageConvolution Box05
-new SliceImage Box06
+new creaMaracasVisu:SliceImage Box06
set Box06.TypeOrientation "2"
-new AddImageToVector Box07
+new PackRecalage:AddImageToVector Box07
-new vtkImageDataPointerRelay Box08
+new vtk:vtkImageDataPointerRelay Box08
-new MagicBox Box09
+new std:MagicBox Box09
-new MagicBox Box10
+new std:MagicBox Box10
-new MagicBox Box11
+new std:MagicBox Box11
-new GetVectorIntElement Box12
+new std:GetVectorIntElement Box12
set Box12.I "2"
-new GetVectorIntElement Box13
+new std:GetVectorIntElement Box13
set Box13.I "1"
-new GetVectorIntElement Box14
+new std:GetVectorIntElement Box14
set Box14.I "0"
-new MagicBox Box15
+new std:MagicBox Box15
connect Box02.Out convol1.In
# Complex output ports
output Out Box07.Out " "
+message
endefine
//Calculates the new position of the points after the first transformation
double A2N[3];
A2N[0] = A2[0]*newMatrix[0][0] + A2[0]*newMatrix[0][1] + A2[0]*newMatrix[0][2];
- A2N[1] = A2[1]*newMatrix[1][0] + A2[0]*newMatrix[1][1] + A2[0]*newMatrix[1][2];
- A2N[2] = A2[2]*newMatrix[2][0] + A2[0]*newMatrix[2][1] + A2[0]*newMatrix[2][2];
+ A2N[1] = A2[1]*newMatrix[1][0] + A2[1]*newMatrix[1][1] + A2[1]*newMatrix[1][2];
+ A2N[2] = A2[2]*newMatrix[2][0] + A2[2]*newMatrix[2][1] + A2[2]*newMatrix[2][2];
double B2N[3];
B2N[0] = B2[0]*newMatrix[0][0] + B2[0]*newMatrix[0][1] + B2[0]*newMatrix[0][2];
- B2N[1] = B2[1]*newMatrix[1][0] + B2[0]*newMatrix[1][1] + B2[0]*newMatrix[1][2];
- B2N[2] = B2[2]*newMatrix[2][0] + B2[0]*newMatrix[2][1] + B2[0]*newMatrix[2][2];
+ B2N[1] = B2[1]*newMatrix[1][0] + B2[1]*newMatrix[1][1] + B2[1]*newMatrix[1][2];
+ B2N[2] = B2[2]*newMatrix[2][0] + B2[2]*newMatrix[2][1] + B2[2]*newMatrix[2][2];
double O2N[3];
O2N[0] = O2[0]*newMatrix[0][0] + O2[0]*newMatrix[0][1] + O2[0]*newMatrix[0][2];
- O2N[1] = O2[1]*newMatrix[1][0] + O2[0]*newMatrix[1][1] + O2[0]*newMatrix[1][2];
- O2N[2] = O2[2]*newMatrix[2][0] + O2[0]*newMatrix[2][1] + O2[0]*newMatrix[2][2];
+ O2N[1] = O2[1]*newMatrix[1][0] + O2[1]*newMatrix[1][1] + O2[1]*newMatrix[1][2];
+ O2N[2] = O2[2]*newMatrix[2][0] + O2[2]*newMatrix[2][1] + O2[2]*newMatrix[2][2];
///////////////////////////////////////////////////////////////////////////////
//Creation of the two planes for the second transformation
transformer->SetSecondAngle(-anglePlanes);
+
+ double * vector2B;
+ vector2B = planes->makeVector(O2, B2);
+ double mag1= planes->getMagnitud(vector1B);
+ double mag2= planes->getMagnitud(vector2B);
+ transformer->SetScale(mag1/mag2);
+
+
+/*
+ double * vector2B;
+ vector2B = planes->makeVector(O2, B2);
+ double mag1= planes->getMagnitud(vector1);
+ double mag2= planes->getMagnitud(vector2);
+ transformer->SetScale(mag2/mag1);
+*/
+
// The calculation of the transformations are made
transformer->Run();
}
+void Transformer3D::SetScale(double scale)
+{
+ _scale=scale;
+}
+
+
+
+
/*
GETS THE RESULTANT TRANSFORM
*/
vtkTransform *Transformer3D::GetFirstResult()
{
_transform->Identity();
-
_transform->Translate(-_firstPoint[0], -_firstPoint[1], -_firstPoint[2]);
-
_transform->RotateWXYZ(_angle, _rotationAxis[0], _rotationAxis[1], _rotationAxis[2]);
-
_transform->Translate(_secondPoint[0], _secondPoint[1], _secondPoint[2]);
-
-
_transform->Update();
return _transform;
}
{
//Cleans the transformation matrix
_transform->Identity();
-
//Make all transformations in postmultiply mode
_transform->PostMultiply();
-
//Acomodate in 0,0,0 according to the first point of the second vector
_transform->Translate(-_secondPoint[0], -_secondPoint[1], -_secondPoint[2]);
-
_transform->RotateWXYZ(_angle, _rotationAxis[0], _rotationAxis[1], _rotationAxis[2]);
-
_transform->RotateWXYZ(_secondAngle, _secondRotationAxis[0], _secondRotationAxis[1], _secondRotationAxis[2]);
-
+printf("EED Transformer3D::Run %f %f\n", _angle, _secondAngle);
+ _transform->Scale(_scale,_scale,_scale);
//Acommodate according to the first point of the first vector
_transform->Translate(_firstPoint[0], _firstPoint[1], _firstPoint[2]);
-
_transform->Inverse();
_transform->Update();
}
+
void SetSecondRotationAxis(double* axis);
void SetAngle(double angle);
void SetSecondAngle(double angle);
+ void SetScale(double scale);
void Run();
vtkTransform *GetResult();
vtkTransform *GetFirstResult();
private:
+ double _scale;
double _rotationAxis[3];
double _secondRotationAxis[3];
double _firstPoint[3];