X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FmaracasVisuLib%2Fsrc%2Finterface%2FwxWindows%2Fwidgets%2FwxVtkBaseView.cxx;h=83f69400006a85362cbaa7e8545911d3140fa345;hb=4443a8fe2b4992b6abee8531917fd0803018fc12;hp=ccabe8d3e3d83dd5a3bb51bd7ffbdfae063e27d6;hpb=24f24e2b64b9a959010e69a41dd85ed0d2f94be1;p=creaMaracasVisu.git diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkBaseView.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkBaseView.cxx index ccabe8d..83f6940 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkBaseView.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkBaseView.cxx @@ -13,6 +13,7 @@ #include "wxVtkBaseView.h" + vtkStandardNewMacro(vtkInteractorStyleBaseView); vtkStandardNewMacro(vtkInteractorStyleBaseView2D); vtkStandardNewMacro(vtkInteractorStyleBaseView3D); @@ -208,7 +209,13 @@ void wxVtkBaseView::Refresh() // virtual #if defined(WIN32) _iren->Refresh(false); #else - _iren->Render(); + +//EED 01Avril2009 +// _iren->Render(); + vtkRenderWindowInteractor *vri = GetWxVTKRenderWindowInteractor(); + vri->vtkRenderWindowInteractor::Render(); + + //_iren->Refresh(); #endif @@ -1200,7 +1207,7 @@ vtkTextActor *vtkInfoTextImage::Create_Text_Label(int px, int py ) // Text Window Level vtkTextActor *textActor = vtkTextActor::New(); textActor->SetDisplayPosition(px, py); - textActor->SetInput("--"); + textActor->SetInput("0"); // Set coordinates to match the old vtkScaledTextActor default value textActor->GetPosition2Coordinate()->SetCoordinateSystemToNormalizedViewport(); @@ -1340,14 +1347,112 @@ void vtkInfoTextImage::PutPixelIntensity(int xx, int yy, int zz) char zTzxt[20]; char resultText[50]; - strcpy(resultText,"NG: "); - if (ok==true) { - unsigned short *pOrg=(unsigned short*)imagedata->GetScalarPointer ((int)xx,(int)yy,(int)zz); -// itoa (*pOrg,zTzxt,10); - int tmp=*pOrg; - sprintf(zTzxt,"%d",tmp); - - } else { + strcpy(resultText,"GL: "); + if (ok==true) + { + if (imagedata->GetScalarType()==VTK_BIT) + { + char *pOrg=(char*)imagedata->GetScalarPointer ((int)xx,(int)yy,(int)zz); + // itoa (*pOrg,zTzxt,10); + if(*pOrg==0) + { + sprintf(zTzxt,"%d",0); + } + else + { + sprintf(zTzxt,"%d",1); + } + } + + if (imagedata->GetScalarType()==VTK_CHAR) + { + char *pOrg=(char*)imagedata->GetScalarPointer ((int)xx,(int)yy,(int)zz); + // itoa (*pOrg,zTzxt,10); + int tmp=*pOrg; + sprintf(zTzxt,"%d",tmp); + } + + if (imagedata->GetScalarType()==VTK_SIGNED_CHAR) + { + signed char *pOrg=(signed char*)imagedata->GetScalarPointer ((int)xx,(int)yy,(int)zz); + // itoa (*pOrg,zTzxt,10); + int tmp=*pOrg; + sprintf(zTzxt,"%d",tmp); + } + + if (imagedata->GetScalarType()==VTK_UNSIGNED_CHAR) + { + unsigned char *pOrg=(unsigned char*)imagedata->GetScalarPointer ((int)xx,(int)yy,(int)zz); + // itoa (*pOrg,zTzxt,10); + int tmp=*pOrg; + sprintf(zTzxt,"%d",tmp); + } + + if (imagedata->GetScalarType()==VTK_SHORT) + { + short *pOrg=(short*)imagedata->GetScalarPointer ((int)xx,(int)yy,(int)zz); + // itoa (*pOrg,zTzxt,10); + int tmp=*pOrg; + sprintf(zTzxt,"%d",tmp); + } + + if (imagedata->GetScalarType()==VTK_UNSIGNED_SHORT) + { + unsigned short *pOrg=(unsigned short*)imagedata->GetScalarPointer ((int)xx,(int)yy,(int)zz); + // itoa (*pOrg,zTzxt,10); + int tmp=*pOrg; + sprintf(zTzxt,"%d",tmp); + } + + if (imagedata->GetScalarType()==VTK_INT) + { + int *pOrg=(int*)imagedata->GetScalarPointer ((int)xx,(int)yy,(int)zz); + // itoa (*pOrg,zTzxt,10); + sprintf(zTzxt,"%d",*pOrg); + } + + if (imagedata->GetScalarType()==VTK_UNSIGNED_INT) + { + unsigned int *pOrg=(unsigned int*)imagedata->GetScalarPointer ((int)xx,(int)yy,(int)zz); + // itoa (*pOrg,zTzxt,10); + int tmp=*pOrg; + sprintf(zTzxt,"%d",tmp); + } + + if (imagedata->GetScalarType()==VTK_LONG) + { + long *pOrg=(long*)imagedata->GetScalarPointer ((int)xx,(int)yy,(int)zz); + // itoa (*pOrg,zTzxt,10); + double tmp=*pOrg; + sprintf(zTzxt,"%3.2f",tmp); + } + + if (imagedata->GetScalarType()==VTK_UNSIGNED_LONG) + { + unsigned long *pOrg=(unsigned long*)imagedata->GetScalarPointer ((int)xx,(int)yy,(int)zz); + // itoa (*pOrg,zTzxt,10); + double tmp=*pOrg; + sprintf(zTzxt,"%3.2f",tmp); + } + + if (imagedata->GetScalarType()==VTK_FLOAT) + { + long *pOrg=(long*)imagedata->GetScalarPointer ((int)xx,(int)yy,(int)zz); + // itoa (*pOrg,zTzxt,10); + double tmp=*pOrg; + sprintf(zTzxt,"%3.2f",tmp); + } + + if (imagedata->GetScalarType()==VTK_DOUBLE) + { + double *pOrg=(double*)imagedata->GetScalarPointer ((int)xx,(int)yy,(int)zz); + // itoa (*pOrg,zTzxt,10); + double tmp=*pOrg; + sprintf(zTzxt,"%3.2f",tmp); + } + } + else + { strcpy(zTzxt,"---"); } strcat(resultText,zTzxt); @@ -1542,13 +1647,22 @@ void wxVtk2DBaseView::Configure(bool okimage) vtkImageViewer2 *IV2=_imageViewer2XYZ->GetVtkImageViewer2(); vtkCamera *camera = IV2->GetRenderer()->GetActiveCamera(); + +//EED 17Avril2009 +/* camera->SetViewUp ( spx*0 , -spy*1 , spz*0 ); camera->SetPosition ( spx*(x1+x2)/2 , spy*(y1+y2)/2 , -spz*10000 ); camera->SetFocalPoint ( spx*(x1+x2)/2 , spy*(y1+y2)/2 , spz*0 ); +*/ + camera->SetViewUp ( spx*0 , spy*1 , spz*0 ); + camera->SetPosition ( spx*(x1+x2)/2 , spy*(y1+y2)/2 , spz*10000 ); + camera->SetFocalPoint ( spx*(x1+x2)/2 , spy*(y1+y2)/2 , spz*0 ); + + camera->SetClippingRange( 0.01 , 1000000 ); camera->ComputeViewPlaneNormal(); camera->SetParallelScale( spx*(x2-x1)/3.0 ); - + // text information over the graphic window _vtkIinfoTextImage = new vtkInfoTextImage(); _vtkIinfoTextImageInteractor = new vtkInfoTextImageInteractor(); @@ -1721,8 +1835,14 @@ void wxVtk3DBaseView::Configure() // (ResetCamera() method) this vector is used to position the camera // to look at the data in this direction. _aCamera = vtkCamera::New(); +//EED 17Avril2009 +/* _aCamera->SetViewUp (0, 0, -1); _aCamera->SetPosition (0, 1, 0); + */ + _aCamera->SetViewUp (0, 1, 0); + _aCamera->SetPosition (0, 0, 1); + _aCamera->SetFocalPoint (0, 0, 0); _aCamera->ComputeViewPlaneNormal(); }