]> Creatis software - creaMaracasVisu.git/commitdiff
#3592 ColorLayerView in vtkPlane2DView (free 2D plane) vtk9itk5wx3-macos
authoreduardo.davila@creatis.insa-lyon.fr <eduardo.davila@creatis.insa-lyon.fr>
Tue, 3 Nov 2026 16:34:14 +0000 (17:34 +0100)
committereduardo.davila@creatis.insa-lyon.fr <eduardo.davila@creatis.insa-lyon.fr>
Tue, 3 Nov 2026 16:34:14 +0000 (17:34 +0100)
lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkInteractorStylePlane2D.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkPlane2DView.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxWidgetMesure2D_Plane.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxWidgetMesure2D_Plane_in_MPR.cxx

index 4a5ffef..7518177 100644 (file)
@@ -46,9 +46,9 @@ bool vtkInteractorStylePlane2D::GetStateRotate()
 //---------------------------------------------------------------------------
 bool  vtkInteractorStylePlane2D::OnLeftButtonDown()  // vitual
 {
-       _stateRotate = true;
-       _fordwareX = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[0];
-       _fordwareY = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[1];
+       _stateRotate    = true;
+       _fordwareX      = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[0];
+       _fordwareY      = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[1];
        vtkPlane2DView *vtkplane2Dview = (vtkPlane2DView*)(_vtkInteractorStyleBaseView->GetWxVtk2DBaseView());
        vtkplane2Dview->RotationStart();
        return true;
@@ -59,8 +59,8 @@ bool vtkInteractorStylePlane2D::OnLeftButtonUp() // virtual
 {
        if (_stateRotate==true)
        {
-               _stateRotate = false;
-               vtkPlane2DView *vtkplane2Dview = (vtkPlane2DView*)(_vtkInteractorStyleBaseView->GetWxVtk2DBaseView());
+               _stateRotate                    = false;
+               vtkPlane2DView *vtkplane2Dview  = (vtkPlane2DView*)(_vtkInteractorStyleBaseView->GetWxVtk2DBaseView());
                vtkplane2Dview->ResetBack();
 //             this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
        }
@@ -72,15 +72,13 @@ bool  vtkInteractorStylePlane2D::OnRightButtonUp()  // virtual
 {
        if (_stateRotate==true){
                //vtkPlane2DView *vtkplane2Dview = (vtkPlane2DView*)(_vtkInteractorStyleBaseView->GetWxVtk2DBaseView()); // JPRx
-
 // EED Borrame
 //             vtkplane2Dview->RotationEnd();
-
                _stateRotate = false;
        }
-
        return true;
 }
+
 //---------------------------------------------------------------------------
 bool  vtkInteractorStylePlane2D::OnMouseMove () // virtual 
 {
@@ -104,6 +102,7 @@ bool  vtkInteractorStylePlane2D::OnMouseMove () // virtual
        } 
        return true;
 }
+
 //-------------------------------------------------------------------
 bool vtkInteractorStylePlane2D::OnLeftDClick() // virtual
 {
@@ -112,15 +111,11 @@ bool vtkInteractorStylePlane2D::OnLeftDClick() // virtual
        double  xx = fx;
        double  yy = fy;
        double  zz = 0;
-
        vtkPlane2DView *vtkplane2Dview = (vtkPlane2DView*)(_vtkInteractorStyleBaseView->GetWxVtk2DBaseView());
        vtkMPRBaseData *vtkmprbasedata = vtkplane2Dview->GetVtkmprbasedata();
-
        vtkplane2Dview->TransfromCoordViewWorld2(xx,yy,zz);
-
     vtkmprbasedata->SetXYZ( xx , yy , zz);
        this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
-
        return true;
 }
 
index 2b05c4b..db58627 100644 (file)
 #include "vtkImageAppend.h"
 #include "vtkImageSlab.h"
 
-
 #include "vtkInteractorStyleBaseView2D.h"
 
-
 vtkPlane2DView::vtkPlane2DView( wxWindow *parent) : wxVtk2DBaseView(parent)
 {
        _backX                                  =       -99999;
@@ -416,10 +414,10 @@ void vtkPlane2DView::Configure( )
        // SetInteractorStyleImage( vtkInteractorStyleBaseView2D::New() );
        //
        // Actual version
-       vtkInteractorStyleBaseView2D *style2D = vtkInteractorStyleBaseView2D::New();
-       manualInteractorWindowLevel *_manualinteractorwindowlevel= new manualInteractorWindowLevel();
+       vtkInteractorStyleBaseView2D    *style2D                            = vtkInteractorStyleBaseView2D::New();
+       manualInteractorWindowLevel     *_manualinteractorwindowlevel       = new manualInteractorWindowLevel();
        style2D->SetInteractorWindowLevel( _manualinteractorwindowlevel );
-       vtkInteractorScrollZ *_vtkInteractorScrollZ = new vtkInteractorScrollZ();
+       vtkInteractorScrollZ            *_vtkInteractorScrollZ              = new vtkInteractorScrollZ();
        style2D->SetInteractorScrollZ(_vtkInteractorScrollZ);
        SetInteractorStyleImage( style2D );
 
@@ -429,7 +427,7 @@ void vtkPlane2DView::Configure( )
        _interactorstyleplane2D = new vtkInteractorStylePlane2D();
        ((vtkInteractorStyleBaseView*)GetInteractorStyleBaseView())->AddInteractorStyleMaracas( _interactorstyleplane2D );
 
-       vtkCamera *camera =_imageViewer2XYZ->GetVtkImageViewer2()->GetRenderer()->GetActiveCamera();
+       vtkCamera *camera       =_imageViewer2XYZ->GetVtkImageViewer2()->GetRenderer()->GetActiveCamera();
        
        camera->SetViewUp               (       0                       ,       1                               ,       0       );
        camera->SetPosition             ((0+_sizeIma)/2 , (0+_sizeIma)/2        , 10000 ); 
@@ -523,16 +521,19 @@ void vtkPlane2DView::Refresh(  )
        UpdateColorWindowLevel();
        wxVtkBaseView::Refresh();
 }
+
 //-------------------------------------------------------------------
 void vtkPlane2DView::SetImgSize( int imgSize )
 {
        _sizeIma = imgSize;
 }
+
 //-------------------------------------------------------------------
 int vtkPlane2DView::GetImgSize()
 {
        return _sizeIma;
 }
+
 //-------------------------------------------------------------------
 int    vtkPlane2DView::GetActualSlice()  // virtual 
 {
@@ -574,14 +575,12 @@ void vtkPlane2DView::SetActive(bool active)
 }
 
 //---------------------------------------------------------------------------
-
 void vtkPlane2DView::SetMipVisualization(bool ok)
 {
        _mip_visualization = ok;
 }
 
 //---------------------------------------------------------------------------
-
 void vtkPlane2DView::SetMipWidth(int value)
 {
        _mip_width = value;
index 3f47a4e..4a983da 100644 (file)
@@ -83,35 +83,24 @@ wxWidgetMesure2D_Plane::~wxWidgetMesure2D_Plane()
 
 wxWindow *wxWidgetMesure2D_Plane::CreateWin1a(wxWindow *parent) // virtual
 {
-       wxPanel *panel = new wxPanel(parent,-1);
-
-       _cb_circle              = new wxCheckBox(panel,-1,_T("Circle        ")); 
-       _cb_line                = new wxCheckBox(panel,-1,_T("Rotation Axe ")); 
-
-
+       wxPanel *panel  = new wxPanel(parent,-1);
+       _cb_circle              = new wxCheckBox(panel,-1,_T("Circle        "));
+       _cb_line                = new wxCheckBox(panel,-1,_T("Rotation Axe "));
        wxBoxSizer *sizerA = new wxBoxSizer(wxHORIZONTAL);
        sizerA->Add(_cb_circle);
        sizerA->Add(_cb_line);
-
-
        wxFlexGridSizer *sizer = new wxFlexGridSizer(1);
        sizer->Add( sizerA );
        sizer->Add( wxWidgetMesure2D::CreateWin1a(panel) );
-
        panel->SetAutoLayout(true);
        panel->SetSizer(sizer);
        panel->SetSize(400,30);
        panel->Layout();
-//EEDxx2.4
-//     panel->FitInside();
-
        Connect(_cb_line->GetId()        , wxEVT_COMMAND_CHECKBOX_CLICKED         , (wxObjectEventFunction) &wxWidgetMesure2D_Plane::OnActiveLine                       );
        Connect(_cb_circle->GetId()      , wxEVT_COMMAND_CHECKBOX_CLICKED         , (wxObjectEventFunction) &wxWidgetMesure2D_Plane::OnActiveCirlcle            );
-
        return panel;
 }
 
-
 //-------------------------------------------------------------------
 void wxWidgetMesure2D_Plane::OnActiveCirlcle(wxCommandEvent& event)
 {
@@ -134,6 +123,7 @@ void wxWidgetMesure2D_Plane::SetVisibleCircle( bool ok )
        _circle1Actor->GetProperty()->SetOpacity( opacity );
        _circle2Actor->GetProperty()->SetOpacity( opacity );
 }
+
 //-------------------------------------------------------------------
 void wxWidgetMesure2D_Plane::OnActiveLine(wxCommandEvent& event)
 {
@@ -142,7 +132,6 @@ void wxWidgetMesure2D_Plane::OnActiveLine(wxCommandEvent& event)
        _wxvtk2Dbaseview->RefreshView();
 }
 
-
 //-------------------------------------------------------------------
 void wxWidgetMesure2D_Plane::ConfigureA(wxVtk2DBaseView *wxvtk2Dbaseview) // virtual
 {
@@ -152,60 +141,48 @@ void wxWidgetMesure2D_Plane::ConfigureA(wxVtk2DBaseView *wxvtk2Dbaseview) // vir
        SetVisibleCircle(false);        
 }
 
-
 //-------------------------------------------------------------------
 void wxWidgetMesure2D_Plane::ConfigureCircleLine()
 {
        double ang;
-
        vtkPlane2DView *vtkplane2Dview = (vtkPlane2DView*)_wxvtk2Dbaseview;
        int sizeIma = vtkplane2Dview->GetImgSize();
-
        double i,maxPts=20;
        double k=(360/(maxPts-1)) * (3.1416/180);
-       double x,y,r1=5,r2=10,r3=15;
+       double x,y,r1=5,r2=10,r3=15, z=100;
        for (i=0;i<maxPts;i++)
        {
                x=cos( k*i ) ;
                y=sin( k*i ) ;
-               _ptsCircle1->SetPoint( (int)i , (sizeIma/2) + x*r1      , (sizeIma/2) + y*r1    , 1 );
-               _ptsCircle2->SetPoint( (int)i , (sizeIma/2) + x*r2      , (sizeIma/2) + y*r2    , 1 );
+               _ptsCircle1->SetPoint( (int)i , (sizeIma/2) + x*r1      , (sizeIma/2) + y*r1    , z );
+               _ptsCircle2->SetPoint( (int)i , (sizeIma/2) + x*r2      , (sizeIma/2) + y*r2    , z );
        }
-
        //
-       ang=(45) * (3.1416/180);
-       x=cos( ang ) ;
-       y=sin( ang ) ;
-       _ptsLineRef1->SetPoint( 0 , (sizeIma/2) + x*r3  , (sizeIma/2) + y*r3    , 1 );
-       
+       ang = (45) * (3.1416/180);
+       x   = cos( ang ) ;
+       y   = sin( ang ) ;
+       _ptsLineRef1->SetPoint( 0 , (sizeIma/2) + x*r3  , (sizeIma/2) + y*r3    , z );
        ang=(45+180) * (3.1416/180);
        x=cos( ang ) ;
        y=sin( ang ) ;
-       _ptsLineRef1->SetPoint( 1 , (sizeIma/2) + x*r3  , (sizeIma/2) + y*r3    , 1 );
-
+       _ptsLineRef1->SetPoint( 1 , (sizeIma/2) + x*r3  , (sizeIma/2) + y*r3    , z );
        //
-       ang=(135) * (3.1416/180);
-       x=cos( ang ) ;
-       y=sin( ang ) ;
-       _ptsLineRef2->SetPoint( 0 , (sizeIma/2) + x*r3  , (sizeIma/2) + y*r3    , 1 );
-       
-       ang=(135+180) * (3.1416/180);
-       x=cos( ang ) ;
-       y=sin( ang ) ;
-       _ptsLineRef2->SetPoint( 1 , (sizeIma/2) + x*r3  , (sizeIma/2) + y*r3    , 1 );
+       ang = (135) * (3.1416/180);
+       x   = cos( ang ) ;
+       y   = sin( ang ) ;
+       _ptsLineRef2->SetPoint( 0 , (sizeIma/2) + x*r3  , (sizeIma/2) + y*r3    , z );
+       ang = (135+180) * (3.1416/180);
+       x   = cos( ang ) ;
+       y   = sin( ang ) ;
+       _ptsLineRef2->SetPoint( 1 , (sizeIma/2) + x*r3  , (sizeIma/2) + y*r3    , z);
 }
 
-
-
 //-------------------------------------------------------------------
 void wxWidgetMesure2D_Plane::CircleLine()
 {
-       int i,maxPts=20;
+       int i,maxPts = 20;
        vtkCellArray *lines;
-
        vtkImageViewer2_XYZ *imageViewer2XYZ = _wxvtk2Dbaseview->_imageViewer2XYZ;
-       
-
 // Circle 1 Horizontal
        _ptsCircle1 = vtkPoints::New();
        _ptsCircle1->SetNumberOfPoints(maxPts);
@@ -219,14 +196,12 @@ void wxWidgetMesure2D_Plane::CircleLine()
        lines->InsertCellPoint(0);
        _ptsCircle1->SetPoint(0, -1000  , -1000 , -1000 );
        _ptsCircle1->SetPoint(1,  1000  ,  1000 ,  1000 );
-
        _pdCircle1 = vtkPolyData::New();
     _pdCircle1->SetPoints( _ptsCircle1 );
     _pdCircle1->SetLines( lines );
        lines->Delete();  //do not delete lines ??
        _circle1Actor                                   =       vtkActor::New();
     _circle1Mapper                                     =       vtkPolyDataMapper::New();
-
 //EED 2017-01-01 Migration VTK7
 #if VTK_MAJOR_VERSION <= 5
        _circle1Mapper->SetInput(_pdCircle1);
@@ -239,7 +214,6 @@ void wxWidgetMesure2D_Plane::CircleLine()
        _circle1Actor->GetProperty()->SetDiffuseColor(0,0,1);
        _circle1Actor->GetProperty()->SetLineWidth(2);
     imageViewer2XYZ->GetVtkImageViewer2()->GetRenderer()->AddActor( _circle1Actor );
-
 // Circle 2 Horizontal
        _ptsCircle2 = vtkPoints::New();
        _ptsCircle2->SetNumberOfPoints(maxPts);
@@ -252,7 +226,6 @@ void wxWidgetMesure2D_Plane::CircleLine()
        }
        _ptsCircle2->SetPoint(0, -1000  , -1000 , -1000 );
        _ptsCircle2->SetPoint(1,  1000  ,  1000 ,  1000 );
-
        _pdCircle2 = vtkPolyData::New();
     _pdCircle2->SetPoints( _ptsCircle2 );
     _pdCircle2->SetLines( lines );
@@ -271,7 +244,6 @@ void wxWidgetMesure2D_Plane::CircleLine()
        _circle2Actor->GetProperty()->SetDiffuseColor(0,0,1);
        _circle2Actor->GetProperty()->SetLineWidth(2);
     imageViewer2XYZ->GetVtkImageViewer2()->GetRenderer()->AddActor( _circle2Actor );
-
 // Line Referance 1
        _ptsLineRef1 = vtkPoints::New();
        _ptsLineRef1->SetNumberOfPoints(2);
@@ -281,14 +253,12 @@ void wxWidgetMesure2D_Plane::CircleLine()
        lines->InsertNextCell(2);
        lines->InsertCellPoint(0);
        lines->InsertCellPoint(1);
-
        _pdLineRef1 = vtkPolyData::New();
     _pdLineRef1->SetPoints( _ptsLineRef1 );
     _pdLineRef1->SetLines( lines );
        lines->Delete();  //do not delete lines ??
        _lineRef1Actor                                  =       vtkActor::New();
     _lineRef1Mapper                                    =       vtkPolyDataMapper::New();
-
 //EED 2017-01-01 Migration VTK7
 #if VTK_MAJOR_VERSION <= 5
        _lineRef1Mapper->SetInput(_pdLineRef1);
@@ -296,13 +266,11 @@ void wxWidgetMesure2D_Plane::CircleLine()
 #else
        _lineRef1Mapper->SetInputData(_pdLineRef1);
 #endif
-
        _lineRef1Actor->SetMapper(_lineRef1Mapper);
        _lineRef1Actor->GetProperty()->BackfaceCullingOn();
        _lineRef1Actor->GetProperty()->SetDiffuseColor(0,0,1);
        _lineRef1Actor->GetProperty()->SetLineWidth(2);
     imageViewer2XYZ->GetVtkImageViewer2()->GetRenderer()->AddActor( _lineRef1Actor );
-
 // Line Referance 2
        _ptsLineRef2 = vtkPoints::New();
        _ptsLineRef2->SetNumberOfPoints(2);
@@ -312,14 +280,12 @@ void wxWidgetMesure2D_Plane::CircleLine()
        lines->InsertNextCell(2);
        lines->InsertCellPoint(0);
        lines->InsertCellPoint(1);
-
        _pdLineRef2 = vtkPolyData::New();
     _pdLineRef2->SetPoints( _ptsLineRef2 );
     _pdLineRef2->SetLines( lines );
        lines->Delete();  //do not delete lines ??
        _lineRef2Actor                                  =       vtkActor::New();
     _lineRef2Mapper                                    =       vtkPolyDataMapper::New();
-
 //EED 2017-01-01 Migration VTK7
 #if VTK_MAJOR_VERSION <= 5
        _lineRef2Mapper->SetInput(_pdLineRef2);
@@ -327,13 +293,9 @@ void wxWidgetMesure2D_Plane::CircleLine()
 #else
        _lineRef2Mapper->SetInputData(_pdLineRef2);
 #endif
-
        _lineRef2Actor->SetMapper(_lineRef2Mapper);
        _lineRef2Actor->GetProperty()->BackfaceCullingOn();
        _lineRef2Actor->GetProperty()->SetDiffuseColor(0,0,1);
        _lineRef2Actor->GetProperty()->SetLineWidth(2);
     imageViewer2XYZ->GetVtkImageViewer2()->GetRenderer()->AddActor( _lineRef2Actor );
-
-
 }
-
index 3901990..412ad78 100644 (file)
 wxWidgetMesure2D_Plane_in_MPR::wxWidgetMesure2D_Plane_in_MPR(wxWindow *parent)
 :wxWidgetMesure2D_Plane(parent)
 {
-       _vtkplane2Dview=NULL;
+       _vtkplane2Dview = NULL;
 }
 
 //-------------------------------------------------------------------
-
 wxWidgetMesure2D_Plane_in_MPR::~wxWidgetMesure2D_Plane_in_MPR()
 {
 }
+
 //-------------------------------------------------------------------
 void wxWidgetMesure2D_Plane_in_MPR::OnActiveLink(wxCommandEvent& event)
 {
@@ -47,7 +47,6 @@ void wxWidgetMesure2D_Plane_in_MPR::OnActiveLink(wxCommandEvent& event)
        }
 }
 
-
 //-------------------------------------------------------------------
 void wxWidgetMesure2D_Plane_in_MPR::SetActiveLink(bool ok)
 {
@@ -57,38 +56,27 @@ void wxWidgetMesure2D_Plane_in_MPR::SetActiveLink(bool ok)
                _vtkplane2Dview->SetActive( _cb_link->GetValue() );
        }
 }
-//-------------------------------------------------------------------
 
+//-------------------------------------------------------------------
 void wxWidgetMesure2D_Plane_in_MPR::SetVtkPlane2DView(vtkPlane2DView *vtkplane2Dview)
 {
        _vtkplane2Dview = vtkplane2Dview;
 }
 
 //-------------------------------------------------------------------
-
 wxWindow *wxWidgetMesure2D_Plane_in_MPR::CreateWin1a(wxWindow *parent) // virtual
 {
-       wxPanel *panel = new wxPanel(parent,-1);
-
-       _cb_link                = new wxCheckBox(panel,-1,_T("LINK                    ")); 
+       wxPanel *panel  = new wxPanel(parent,-1);
+       _cb_link                = new wxCheckBox(panel,-1,_T("LINK                    "));
        _cb_link->SetValue(true);
-
        wxFlexGridSizer *sizer = new wxFlexGridSizer(1);
-
        sizer->Add(_cb_link);
-
        sizer->Add( wxWidgetMesure2D_Plane::CreateWin1a(panel) );
-
        panel->SetAutoLayout(true);
        panel->SetSizer(sizer);
        panel->SetSize(400,30);
        panel->Layout();
-
-//EEDxx2.4
-//     panel->FitInside();
-
        Connect(_cb_link->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &wxWidgetMesure2D_Plane_in_MPR::OnActiveLink );
-
        return panel;
 }