X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FmaracasVisuLib%2Fsrc%2Finterface%2FwxWindows%2Fwidgets%2FwxMaracasRenderImageTransformation.cpp;h=fe9eedcb38c3ba87b5904f788f7098be01f077fe;hb=e60eea9083457889b9603a815db80af918f983da;hp=132b887cad36d619f6e004d178e13121ca875b79;hpb=fde5fea23394507e29ff91d85748f6f77e994d5d;p=creaMaracasVisu.git diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasRenderImageTransformation.cpp b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasRenderImageTransformation.cpp index 132b887..fe9eedc 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasRenderImageTransformation.cpp +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasRenderImageTransformation.cpp @@ -1,4 +1,3 @@ - #include "wxMaracasRenderImageTransformation.h" /** @@ -12,8 +11,6 @@ wxMaracasRenderImageTransformation::wxMaracasRenderImageTransformation(wxMaracas surface2 = _surface2; surface3 = _surface3; - propID = id; - transformV = vtkTransform::New(); transformS1 = vtkTransform::New(); transformS2 = vtkTransform::New(); @@ -26,72 +23,82 @@ wxMaracasRenderImageTransformation::wxMaracasRenderImageTransformation(wxMaracas **/ wxMaracasRenderImageTransformation::~wxMaracasRenderImageTransformation() { + } /** ** Transforms a volume by the given value for the X axis **/ -void wxMaracasRenderImageTransformation::Translate(int x, int y, int z) +void wxMaracasRenderImageTransformation::Translate(int tx, int ty, int tz, int rx, int ry, int rz, int sx, int sy, int sz) { - transformV->Identity(); - transformS1->Identity(); - transformS2->Identity(); - transformS3->Identity(); + //printf("wxMaracasRenderImageManagementPanel::Rotate float:scaleX = %f \n", tx); + //printf("wxMaracasRenderImageManagementPanel::Rotate float:scaleY = %f \n", ty); + //printf("wxMaracasRenderImageManagementPanel::Rotate float:scaleZ = %f \n", tz); - transformV->Translate( x, y, z ); - transformS1->Translate( x, y, z ); - transformS2->Translate( x, y, z ); - transformS3->Translate( x, y, z ); + double volspX; + double volspY; + double volspZ; - Refresh(); -} + vol->getImageData()->GetSpacing(volspX, volspY, volspZ); + + double surfspX; + double surfspY; + double surfspZ; + surface1->getImageData()->GetSpacing(surfspX, surfspY, surfspZ); -/** -** Rotates a volume by the given degree for the X axis -**/ -void wxMaracasRenderImageTransformation::Rotate(int x, int y, int z) -{ transformV->Identity(); transformS1->Identity(); transformS2->Identity(); transformS3->Identity(); - - transformV->RotateX( x ); - transformS1->RotateX( x ); - transformS2->RotateX( x ); - transformS3->RotateX( x ); - transformV->RotateY( y ); - transformS1->RotateY( y ); - transformS2->RotateY( y ); - transformS3->RotateY( y ); + transformV->Translate( tx/*volspX*/, ty/*volspY*/, tz/*volspZ*/ ); + transformS1->Translate( tx/*surfspX*/, ty/*surfspY*/, tz/*surfspZ*/ ); + transformS2->Translate( tx/*surfspX*/, ty/*surfspY*/, tz/*surfspZ*/ ); + transformS3->Translate( tx/*surfspX*/, ty/*surfspY*/, tz/*surfspZ*/ ); - transformV->RotateZ( z ); - transformS1->RotateZ( z ); - transformS2->RotateZ( z ); - transformS3->RotateZ( z ); + transformV->RotateX( rx/*volspX*/ ); + transformS1->RotateX( rx/*surfspX*/ ); + transformS2->RotateX( rx/*surfspX*/ ); + transformS3->RotateX( rx/*surfspX*/ ); + + transformV->RotateY( ry/*volspY*/ ); + transformS1->RotateY( ry/*surfspY*/ ); + transformS2->RotateY( ry/*surfspY*/ ); + transformS3->RotateY( ry/*surfspY*/ ); + + transformV->RotateZ( rz/*volspZ*/ ); + transformS1->RotateZ( rz/*surfspZ*/ ); + transformS2->RotateZ( rz/*surfspZ*/ ); + transformS3->RotateZ( rz/*surfspZ*/ ); + + transformV->Scale( (sx/100.0), (sy/100.0), (sz/100.0) ); + transformS1->Scale( (sx/100.0), (sy/100.0), (sz/100.0) ); + transformS2->Scale( (sx/100.0), (sy/100.0), (sz/100.0) ); + transformS3->Scale( (sx/100.0), (sy/100.0), (sz/100.0) ); Refresh(); } + /** ** Scales a volume by the given value for the X axis -**/ +* void wxMaracasRenderImageTransformation::Scale(int x, int y, int z) { - transformV->Identity(); - transformS1->Identity(); - transformS2->Identity(); - transformS3->Identity(); + float resultX = x/100.0; + float resultY = y/100.0; + float resultZ = z/100.0; - transformV->Scale( x, y, z ); - transformS1->Scale( x, y, z ); - transformS2->Scale( x, y, z ); - transformS3->Scale( x, y, z ); + //printf("wxMaracasRenderImageManagementPanel::Rotate int:scaleX = %d \n",x); + //printf("wxMaracasRenderImageManagementPanel::Rotate int:scaleY = %d \n", y); + //printf("wxMaracasRenderImageManagementPanel::Rotate int:scaleZ = %d \n", z); Refresh(); -} +}*/ +/** +** Updates each Matrix +**/ void wxMaracasRenderImageTransformation::Refresh()throw(char*) { transformV->Update(); @@ -100,15 +107,14 @@ void wxMaracasRenderImageTransformation::Refresh()throw(char*) transformS3->Update(); vol->getViewData(propID)->getProp3D()->SetUserMatrix(transformV->GetMatrix()); - vol->getRenderer()->Render(); + //vol->getRenderer()->Render(); surface1->getViewData(propID)->getProp3D()->SetUserMatrix(transformV->GetMatrix()); - surface1->getRenderer()->Render(); + //surface1->getRenderer()->Render(); surface2->getViewData(propID)->getProp3D()->SetUserMatrix(transformV->GetMatrix()); - surface2->getRenderer()->Render(); + //surface2->getRenderer()->Render(); surface3->getViewData(propID)->getProp3D()->SetUserMatrix(transformV->GetMatrix()); - surface3->getRenderer()->Render(); + //surface3->getRenderer()->Render(); } -