1 #include "wxMaracasRenderImageTransformation.h"
2 #include "wxMaracasRendererView.h"
7 wxMaracasRenderImageTransformation::wxMaracasRenderImageTransformation(wxMaracasMultipleVolumeRendererManager* _vol, wxMaracasSurfaceRenderingManager* _surface1,
8 wxMaracasSurfaceRenderingManager* _surface2, wxMaracasSurfaceRenderingManager* _surface3, int id)
16 transformV = vtkTransform::New();
17 transformS1 = vtkTransform::New();
18 transformS2 = vtkTransform::New();
19 transformS3 = vtkTransform::New();
25 wxMaracasRenderImageTransformation::~wxMaracasRenderImageTransformation()
31 ** Transforms a volume by the given value for the X axis
33 void wxMaracasRenderImageTransformation::Translate(int tx, int ty, int tz, int rx, int ry, int rz, int sx, int sy, int sz)
35 //printf("wxMaracasRenderImageManagementPanel::Rotate float:scaleX = %f \n", tx);
36 //printf("wxMaracasRenderImageManagementPanel::Rotate float:scaleY = %f \n", ty);
37 //printf("wxMaracasRenderImageManagementPanel::Rotate float:scaleZ = %f \n", tz);
42 vol->getImageData()->GetSpacing(volspX, volspY, volspZ);
47 surface1->getImageData()->GetSpacing(surfspX, surfspY, surfspZ);
50 vol->getImageData()->GetExtent(ext);
52 transformV ->Identity();
53 transformS1 ->Identity();
54 transformS2 ->Identity();
55 transformS3 ->Identity();
57 transformV ->PostMultiply();
58 transformS1 ->PostMultiply();
59 transformS2 ->PostMultiply();
60 transformS3 ->PostMultiply();
62 printf("CPR: wxMaracasRenderImageTransformation::Translate-> %d\n", -(ext[1]-ext[0])*volspX );
63 printf("CPR: wxMaracasRenderImageTransformation::Translate-> %d\n", -(ext[3]-ext[2])*surfspY);
64 printf("CPR: wxMaracasRenderImageTransformation::Translate-> %d\n", -(ext[5]-ext[4])*surfspZ);
66 transformV ->Translate( -(ext[1]-ext[0])*volspX/2, -(ext[3]-ext[2])*volspY/2, -(ext[5]-ext[4])*volspZ/2 );
67 transformS1->Translate( -(ext[1]-ext[0])*surfspX/2, -(ext[3]-ext[2])*surfspY/2, -(ext[5]-ext[4])*surfspZ/2 );
68 transformS2->Translate( -(ext[1]-ext[0])*surfspX/2, -(ext[3]-ext[2])*surfspY/2, -(ext[5]-ext[4])*surfspZ/2 );
69 transformS3->Translate( -(ext[1]-ext[0])*surfspX/2, -(ext[3]-ext[2])*surfspY/2, -(ext[5]-ext[4])*surfspZ/2 );
71 transformV ->Scale( (sx/100.0), (sy/100.0), (sz/100.0) );
72 transformS1->Scale( (sx/100.0), (sy/100.0), (sz/100.0) );
73 transformS2->Scale( (sx/100.0), (sy/100.0), (sz/100.0) );
74 transformS3->Scale( (sx/100.0), (sy/100.0), (sz/100.0) );
76 transformV ->RotateX( rx );
77 transformS1->RotateX( rx );
78 transformS2->RotateX( rx );
79 transformS3->RotateX( rx );
81 transformV ->RotateY( ry );
82 transformS1->RotateY( ry );
83 transformS2->RotateY( ry );
84 transformS3->RotateY( ry );
86 transformV ->RotateZ( rz );
87 transformS1->RotateZ( rz );
88 transformS2->RotateZ( rz );
89 transformS3->RotateZ( rz );
91 transformV ->Translate( tx*volspX + (ext[1]-ext[0])*volspX/2, ty*volspY + (ext[3]-ext[2])*volspY/2, tz*volspZ + (ext[5]-ext[4])*volspZ/2 );
92 transformS1->Translate( tx*surfspX + (ext[1]-ext[0])*volspX/2, ty*surfspY + (ext[3]-ext[2])*volspY/2, tz*surfspZ + (ext[5]-ext[4])*volspZ/2 );
93 transformS2->Translate( tx*surfspX + (ext[1]-ext[0])*volspX/2, ty*surfspY + (ext[3]-ext[2])*volspY/2, tz*surfspZ + (ext[5]-ext[4])*volspZ/2 );
94 transformS3->Translate( tx*surfspX + (ext[1]-ext[0])*volspX/2, ty*surfspY + (ext[3]-ext[2])*volspY/2, tz*surfspZ + (ext[5]-ext[4])*volspZ/2 );
100 ** Updates each Matrix
102 void wxMaracasRenderImageTransformation::Refresh()throw(char*)
104 transformV->Update();
105 transformS1->Update();
106 transformS2->Update();
107 transformS3->Update();
109 vol->getViewData(propID)->getProp3D()->SetUserMatrix(transformV->GetMatrix());
110 //vol->Update(propID);
112 surface1->getViewData(propID)->getProp3D()->SetUserMatrix(transformV->GetMatrix());
113 //surface1->Update(propID);
115 surface2->getViewData(propID)->getProp3D()->SetUserMatrix(transformV->GetMatrix());
116 //surface2->getRenderer()->Render();
118 surface3->getViewData(propID)->getProp3D()->SetUserMatrix(transformV->GetMatrix());
119 //surface3->getRenderer()->Render();