X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;ds=sidebyside;f=lib%2FmaracasVisuLib%2Fsrc%2Finterface%2FwxWindows%2Fwidgets%2FwxMaracasRenderImageTransformation.cpp;fp=lib%2FmaracasVisuLib%2Fsrc%2Finterface%2FwxWindows%2Fwidgets%2FwxMaracasRenderImageTransformation.cpp;h=11f1d3985dcb96a7f2478143e3da67fc12af10b4;hb=d7d3ec17199e6b725bd375fdfe1085eeb35b34cc;hp=e2dad9083971c7133493d83373ae27261262034b;hpb=d2fc2645728a4aea4f0aa0febfa1d7a894ab3ff1;p=creaMaracasVisu.git diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasRenderImageTransformation.cpp b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasRenderImageTransformation.cpp index e2dad90..11f1d39 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasRenderImageTransformation.cpp +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasRenderImageTransformation.cpp @@ -1,4 +1,5 @@ #include "wxMaracasRenderImageTransformation.h" +#include "wxMaracasRendererView.h" /** ** Class constructor @@ -16,7 +17,6 @@ wxMaracasRenderImageTransformation::wxMaracasRenderImageTransformation(wxMaracas transformS1 = vtkTransform::New(); transformS2 = vtkTransform::New(); transformS3 = vtkTransform::New(); - } /** @@ -40,46 +40,62 @@ void wxMaracasRenderImageTransformation::Translate(int tx, int ty, int tz, int r double volspY; double volspZ; vol->getImageData()->GetSpacing(volspX, volspY, volspZ); - + double surfspX; double surfspY; double surfspZ; surface1->getImageData()->GetSpacing(surfspX, surfspY, surfspZ); - transformV->Identity(); - transformS1->Identity(); - transformS2->Identity(); - transformS3->Identity(); + int ext[6]; + vol->getImageData()->GetExtent(ext); - 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 ->Identity(); + transformS1 ->Identity(); + transformS2 ->Identity(); + transformS3 ->Identity(); - 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 ->PostMultiply(); + transformS1 ->PostMultiply(); + transformS2 ->PostMultiply(); + transformS3 ->PostMultiply(); + + printf("CPR: wxMaracasRenderImageTransformation::Translate-> %d\n", -(ext[1]-ext[0])*volspX ); + printf("CPR: wxMaracasRenderImageTransformation::Translate-> %d\n", -(ext[3]-ext[2])*surfspY); + printf("CPR: wxMaracasRenderImageTransformation::Translate-> %d\n", -(ext[5]-ext[4])*surfspZ); - transformV->RotateZ( rz*volspZ ); - transformS1->RotateZ( rz*surfspZ ); - transformS2->RotateZ( rz*surfspZ ); - transformS3->RotateZ( rz*surfspZ ); + transformV ->Translate( -(ext[1]-ext[0])*volspX/2, -(ext[3]-ext[2])*volspY/2, -(ext[5]-ext[4])*volspZ/2 ); + transformS1->Translate( -(ext[1]-ext[0])*surfspX/2, -(ext[3]-ext[2])*surfspY/2, -(ext[5]-ext[4])*surfspZ/2 ); + transformS2->Translate( -(ext[1]-ext[0])*surfspX/2, -(ext[3]-ext[2])*surfspY/2, -(ext[5]-ext[4])*surfspZ/2 ); + transformS3->Translate( -(ext[1]-ext[0])*surfspX/2, -(ext[3]-ext[2])*surfspY/2, -(ext[5]-ext[4])*surfspZ/2 ); - transformV->Scale( (sx/100.0), (sy/100.0), (sz/100.0) ); + 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) ); + transformV ->RotateX( rx ); + transformS1->RotateX( rx ); + transformS2->RotateX( rx ); + transformS3->RotateX( rx ); + + transformV ->RotateY( ry ); + transformS1->RotateY( ry ); + transformS2->RotateY( ry ); + transformS3->RotateY( ry ); + + transformV ->RotateZ( rz ); + transformS1->RotateZ( rz ); + transformS2->RotateZ( rz ); + transformS3->RotateZ( rz ); + + 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 ); + 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 ); + 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 ); + 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 ); + Refresh(); } - /** ** Updates each Matrix **/ @@ -91,10 +107,10 @@ void wxMaracasRenderImageTransformation::Refresh()throw(char*) transformS3->Update(); vol->getViewData(propID)->getProp3D()->SetUserMatrix(transformV->GetMatrix()); - //vol->getRenderer()->Render(); + //vol->Update(propID); surface1->getViewData(propID)->getProp3D()->SetUserMatrix(transformV->GetMatrix()); - //surface1->getRenderer()->Render(); + //surface1->Update(propID); surface2->getViewData(propID)->getProp3D()->SetUserMatrix(transformV->GetMatrix()); //surface2->getRenderer()->Render();