]> Creatis software - creaMaracasVisu.git/commitdiff
*** empty log message ***
authorJuan Prieto <Juan.Prieto@creatis.insa-lyon.fr>
Fri, 13 Nov 2009 08:51:59 +0000 (08:51 +0000)
committerJuan Prieto <Juan.Prieto@creatis.insa-lyon.fr>
Fri, 13 Nov 2009 08:51:59 +0000 (08:51 +0000)
bbtk/src/bbmaracasvisuTransferFunctionView.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualInteractorWindowLevel.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkImageViewer2_XYZ.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkImageViewer2_XYZ.h

index 569e80f659653aa3f286021cd2cc10068057ebd5..5d2e2941b0fcfa1e305d24dd97f07d5bcaa6ce8e 100644 (file)
@@ -66,7 +66,8 @@ void TransferFunctionView::onColorChange(){
        }               
 
        bbSignalOutputModification();
-
+       
+       _tfun->Update();
        bbSetOutputOpacityFunction(_tfun);
        bbSetOutputColorFunction(_ctfun);
 }
index 0be3029cf1920c451920411944d2a0932e77fbbd..20615fbcaae11f17729da6a3630210c86449a133 100644 (file)
@@ -31,8 +31,29 @@ bool manualInteractorWindowLevel::OnMouseMove()                      // virtual
                wxVTKRenderWindowInteractor *wxVTKiren;
                wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
                wxVTKiren->GetEventPosition( tmpPx , tmpPy );
-               int colorWin=_backWindow - 2*( _backPx - tmpPx );
-               int colorLev=_backLevel  + 2*( _backPy - tmpPy );       
+
+
+               int colorWin;
+               int colorLev;
+
+               
+               vtkImageData* imgrange = ((wxVtk2DBaseView*)_vtkInteractorStyleBaseView->GetWxVtk2DBaseView())->GetVtkBaseData()->GetImageData();
+
+               if(imgrange != NULL){
+                       double* scalarrange = imgrange->GetScalarRange();
+                       double scalarr = scalarrange[1] - scalarrange[0];
+                       //std::cout<<"scalar r="<<scalarr<<std::endl;
+                       int w, h;
+                       ((wxWindow*)wxVTKiren)->GetSize(&w, &h);                        
+                       int dx = (scalarr*( _backPx - tmpPx ))/w;
+                       int dy = (scalarr*( _backPy - tmpPy ))/h;
+                       //colorWin=_backWindow - (scalarr)*( _backPx - tmpPx );
+                       colorWin=_backWindow - dx;
+                       colorLev=_backLevel  + dy;
+               }else{
+                       colorWin=_backWindow - 2*( _backPx - tmpPx );
+                       colorLev=_backLevel  + 2*( _backPy - tmpPy );
+               }
 
                if (colorWin<0)
                { 
index c692f96ed76db559906340690f774792721f58a7..faea7924aff0177fcc2f715596311a0c47e05faf 100644 (file)
@@ -10,6 +10,7 @@ vtkImageViewer2_XYZ::vtkImageViewer2_XYZ()
        _vtkimageviewer2->GetRenderer()->GradientBackgroundOn();
        _vtkimageviewer2->GetRenderer()->SetBackground( 0.33 , 0.33 , 0.33 );
        _vtkimageviewer2->GetRenderer()->SetBackground2( 0.66 , 0.66 , 0.66 );  
+       _colortable = NULL;
 }
 //-------------------------------------------------------------------
 vtkImageViewer2_XYZ::~vtkImageViewer2_XYZ()
@@ -89,7 +90,8 @@ void vtkImageViewer2_XYZ::setColorTransferFunction(vtkColorTransferFunction* col
 
        vtkImageMapToWindowLevelColors* imagemaptowindowlevel = _vtkimageviewer2->GetWindowLevel();
 
-       if(colortable!=NULL&&colortable->GetSize()>0){
+       if(colortable!=NULL&&colortable->GetSize()>0 && _colortable != colortable){
+               _colortable = colortable;
                imagemaptowindowlevel->SetLookupTable(colortable);
        }
 
index 472ac9b830743b8bcb097a140b02f96d718c8c01..24cb363903fdf6a5e4aea8598902e1f26fae09fb 100644 (file)
@@ -29,6 +29,7 @@ public:
 private:
        int     _x1,_x2,_y1,_y2,_z1,_z2;
        vtkImageViewer2 *_vtkimageviewer2;
+       vtkColorTransferFunction* _colortable;
 protected:     
 };