]> Creatis software - creaMaracasVisu.git/commitdiff
#3009 creaMaracasVisu Feature New Normal - Interpolate option in box ViewerNV
authorEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Mon, 22 Aug 2016 14:23:02 +0000 (16:23 +0200)
committerEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Mon, 22 Aug 2016 14:23:02 +0000 (16:23 +0200)
bbtk/bbs/boxes/Measure3DLength_Widget.bbg
bbtk/bbs/boxes/Measure3DLength_Widget.bbs
bbtk/src/bbmaracasvisuViewerNV.cxx
bbtk/src/bbmaracasvisuViewerNV.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_N_ViewersWidget.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_N_ViewersWidget.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_ViewerWidget.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkClipping3DView.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkClipping3DView.h

index dd5cf9aa53edc8fefbf6f88f3ac3fbc30efa291f..518189ef0ee7bada4c0fba293b6970e633e69981 100644 (file)
@@ -49,7 +49,7 @@ BOX
 creaMaracasVisu:ShowNPoints:Box31
 ISEXEC:FALSE
 -19.500275:46.578993:-900.000000
-28.819725:36.578993:-900.000000
+41.139725:36.578993:-900.000000
 FIN_BOX
 BOX
 wx:LayoutSplit:Box32
@@ -58,6 +58,8 @@ ISEXEC:FALSE
 -43.295549:-113.442289:-900.000000
 PORT
 Proportion:"10"
+PORT
+WinTitle:"Measure"
 FIN_BOX
 BOX
 wx:LayoutTab:Box33
index 2d9d86a31619760bf4c3080d326bdce688c7197c..c73b9635d7509d9c5bbe379db7567b31f8c7b8a8 100644 (file)
@@ -25,6 +25,7 @@ new creaMaracasVisu:ShowNPoints Box31
 
 new wx:LayoutSplit Box32
   set Box32.Proportion "10"
+  set Box32.WinTitle "Measure"
 
 new wx:LayoutTab Box33
 
index a1910174557d31e4535b4e197d6561879810996b..fd98d87ccc46eabadd54fd74bc173c32989c82ff 100644 (file)
@@ -86,38 +86,31 @@ BBTK_BLACK_BOX_IMPLEMENTATION(ViewerNV,bbtk::WxBlackBox);
 void ViewerNV::Process()
 {
        vtkImageData* img = bbGetInputIn();
-
-
        std::vector<int> type = bbGetInputnTypeView();
-
-
-       if(img != NULL && _mwxwidget != NULL){
-               if(!compareVectors(type, _currenttype)){
+       if(img != NULL && _mwxwidget != NULL)
+       {
+               if(!compareVectors(type, _currenttype))
+               {
                        _mwxwidget->SetType(&type);
                        _mwxwidget->UpdateLayout(img);
                }else if (img != _currentimg){
                        _mwxwidget->SetImage(img);
                }
                _mwxwidget->RefreshView();
-
                _currenttype    = type;
                _currentimg     = img;
-
                _point.clear();
                _point.push_back((int)_mwxwidget->GetX());
                _point.push_back((int)_mwxwidget->GetY());
                _point.push_back((int)_mwxwidget->GetZ());
                bbSetOutputPoint(_point);
-
        //    WxBlackBox::Process();
 //             mwxwidget->SetImage(img );
                wxVtkBaseView *wvbv1 = _mwxwidget->GetwxVtkBaseView(1);
                wxVtkBaseView *wvbv2 = _mwxwidget->GetwxVtkBaseView(2);
                wxVtkBaseView *wvbv3 = _mwxwidget->GetwxVtkBaseView(3);
                wxVtkBaseView *wvbv4 = _mwxwidget->GetwxVtkBaseView(4);
-
                //wxwidget->RefreshView();
-
                bbSetOutputwxVtkBaseView1( wvbv1 );
                bbSetOutputwxVtkBaseView2( wvbv2 );
                bbSetOutputwxVtkBaseView3( wvbv3 );
@@ -126,19 +119,15 @@ void ViewerNV::Process()
                if (wvbv2!=NULL) { bbSetOutputRenderer2( wvbv2->GetRenderer() ); }
                if (wvbv3!=NULL) { bbSetOutputRenderer3( wvbv3->GetRenderer() ); }
                if (wvbv4!=NULL) { bbSetOutputRenderer4( wvbv4->GetRenderer() ); }
-
                if (wvbv1!=NULL)
                {
                        bbSetOutputInteractor1( wvbv1->GetWxVTKRenderWindowInteractor() );
                        updateObservers();
                }
-
                if(bbGetInputColorFunction()!=NULL)
                {
                        _mwxwidget->setColorTransferFunction(bbGetInputColorFunction());
                }
-
-
                if( (bbGetInputColorLevel()!=-1) && (bbGetInputWindowLevel()!=-1))
                {
                        if(bbGetInputColorLevel() == 0)
@@ -148,6 +137,7 @@ void ViewerNV::Process()
                                _mwxwidget->SetColorWindowLevel( bbGetInputWindowLevel() , bbGetInputColorLevel() );
                        }
                }
+               _mwxwidget->SetInterpolate( bbGetInputInterpolate() );
        }//  mwxwidget != NULL
 }
 
@@ -174,6 +164,7 @@ void ViewerNV::bbUserSetDefaultValues()
        bbSetInputObs3(NULL);
        bbSetInputObs4(NULL);
        bbSetInputObs5(NULL);
+       bbSetInputInterpolate(true);
 
        std::vector<int> vecNTypeViwer;
        vecNTypeViwer.push_back(5);
index 9d3eb7d0cba14bc1b2a3487ecf3a26babf77552e..0846f828fe2d4b67c4a82c462dfd8724914e26db 100644 (file)
@@ -80,6 +80,8 @@ class /*BBTK_EXPORT*/ ViewerNV
   BBTK_DECLARE_INPUT(Obs3, vtkInteractorObserver *);
   BBTK_DECLARE_INPUT(Obs4, vtkInteractorObserver *);
   BBTK_DECLARE_INPUT(Obs5, vtkInteractorObserver *);
+  BBTK_DECLARE_INPUT(Interpolate, bool);
+
 
   BBTK_DECLARE_OUTPUT(wxVtkBaseView1,wxVtkBaseView*);
   BBTK_DECLARE_OUTPUT(wxVtkBaseView2,wxVtkBaseView*);
@@ -124,6 +126,7 @@ BBTK_DESCRIPTION("Viewer : N view configuration 2D and 3D");
   BBTK_INPUT(ViewerNV,Obs3,"Optional: set a different Color level by using an other widget",vtkInteractorObserver*,"");
   BBTK_INPUT(ViewerNV,Obs4,"Optional: set a different Color level by using an other widget",vtkInteractorObserver*,"");
   BBTK_INPUT(ViewerNV,Obs5,"Optional: set a different Color level by using an other widget",vtkInteractorObserver*,"");
+  BBTK_INPUT(ViewerNV,Interpolate,"Interpolate true/false (default true)",bool,"");
 
   BBTK_OUTPUT(ViewerNV,wxVtkBaseView1,"wxVtkBaseView 1",wxVtkBaseView  *,"");
   BBTK_OUTPUT(ViewerNV,wxVtkBaseView2,"wxVtkBaseView 2",wxVtkBaseView  *,"");
index ed4001b153edb3f1896b98ab3b283a5507ef475e..75fa8c30da965cbe8aa9dc45d366961d1460048e 100644 (file)
@@ -438,3 +438,12 @@ void wxMaracas_N_ViewersWidget::SetColorWindowLevel(double colorWindow, double c
        RefreshView();
 }
 
+//-----------------------------------------------------------------------------------
+void wxMaracas_N_ViewersWidget::SetInterpolate(bool interpolate)
+{
+       mvtkmprbasedata->SetInterpolate(interpolate);
+       RefreshView();
+}
+
+
+
index 1495dc19ebc2cb8310cfde8907858d592e4232d0..4d0223c6092d00d8ce5a81a04c450c8b39a73315 100644 (file)
@@ -132,6 +132,9 @@ class creaMaracasVisu_EXPORT wxMaracas_N_ViewersWidget : public wxPanel
        void setColorTransferFunction(vtkColorTransferFunction* colortable);
     void SetColorWindowLevel(double colorWindow, double colorLevel);
 
+       void SetInterpolate(bool interpolate);
+
+
        //------------------------------------------------------------------------------------------------------------
        // Attributes
        //------------------------------------------------------------------------------------------------------------
index de0a52f846c72762d97a654e70188f45b9d213cc..f5cce0037add3250864e9860351358df39c2f692 100644 (file)
        wxMaracas_ViewerWidget::wxMaracas_ViewerWidget(wxWindow *parent, vtkImageData* imagedata, int type, vtkMPRBaseData *vtkmprbasedata)
                : wxPanel( parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL)
        {
-               wxPanel *panel = this;
-               wxWindow *wxwindow = NULL, *window3D    = 0;
-               wxSplitterWindow        *panelClipping3D= 0;
-//             wxPanel *panelControl                   = 0;
-//             wxFlexGridSizer  *sizerCtrol            = 0;
-               wxPanel *controlPanelMPR3D              = 0;
-               wxPanel *controlPanelClippingSurf3D     = 0;
+               wxPanel                         *panel                                          = this;
+               wxWindow                        *wxwindow                                       = NULL;
+               wxWindow                        *window3D                                       = NULL;
+               wxSplitterWindow        *panelClipping3D                        = NULL;
+//             wxPanel                         *panelControl                           = NULL;
+//             wxFlexGridSizer         *sizerCtrol                                     = NULL;
+               wxPanel                         *controlPanelMPR3D                      = NULL;
+               wxPanel                         *controlPanelClippingSurf3D     = NULL;
                //RaC 03-2010 Adding a tab
-               wxPanel *controlPanelClippingVol3D      = 0;
+               wxPanel                         *controlPanelClippingVol3D      = NULL;
 
                wxBoxSizer *sizer                       = 0;
 
                        mvtkmprbasedata                     = vtkmprbasedata;
                }
 
-               mvtk2Dbaseview                  = NULL;
-               mvtkmpr2Dview_X                 = NULL;
-               mvtkmpr2Dview_Y                 = NULL;
-               mvtkmpr2Dview_Z                 = NULL;
-               mvtkplane2Dview                 = NULL;
-               mwidgetMesure                   = NULL;
-               mwxsphereview                   = NULL;
-               mwxvtkclipping3Dview            = NULL;
-               mwxvtk3Dbaseview_Clipping3D     = NULL;
-               mwxvtkmpr3Dview                     = NULL;
-               vtkmpr3Ddataviewer                  = NULL;
+               mvtk2Dbaseview                                  = NULL;
+               mvtkmpr2Dview_X                                 = NULL;
+               mvtkmpr2Dview_Y                                 = NULL;
+               mvtkmpr2Dview_Z                                 = NULL;
+               mvtkplane2Dview                                 = NULL;
+               mwidgetMesure                                   = NULL;
+               mwxsphereview                                   = NULL;
+               mwxvtkclipping3Dview                    = NULL;
+               mwxvtk3Dbaseview_Clipping3D             = NULL;
+               mwxvtkmpr3Dview                         = NULL;
+               vtkmpr3Ddataviewer                      = NULL;
 
                if (type==-1)
                {
index a53f035ec2421be2185950c90eba8b1759fb709a..84c3c609dd20fdad9e612e648d49aed7ff9dd065 100644 (file)
@@ -42,30 +42,35 @@ wxVtkClipping3DView::wxVtkClipping3DView(wxVtk3DBaseView* wxvtk3Dbaseview)
 //-------------------------------------------------------------------
 wxVtkClipping3DView::~wxVtkClipping3DView()
 {
-       if (_boxWidgetVolume!=NULL)                              { _boxWidgetVolume     -> Delete();                                    }
-       if (_boxWidgetS1!=NULL)                                  { _boxWidgetS1         -> Delete();                                    }
+       if (_boxWidgetVolume!=NULL)                              { _boxWidgetVolume     -> Delete();                    }
+       if (_boxWidgetS1!=NULL)                                  { _boxWidgetS1         -> Delete();                    }
        if (_vtkclipping3Ddataviewer!=NULL)              { delete _vtkclipping3Ddataviewer;                     }
        if (_wxvtkclipping3DviewCntrlPanel!=NULL){ delete _wxvtkclipping3DviewCntrlPanel;       }
 }
+
 //-------------------------------------------------------------------
 void wxVtkClipping3DView::SetVisibleBoxSurface(bool visible)
 {
-       if (visible==true){
+       if (visible==true)
+       {
                _boxWidgetS1->On();
        } else {
                _boxWidgetS1->Off();
        }
 }
+
 //-------------------------------------------------------------------
 void wxVtkClipping3DView::VisibleVolumeBoxActor(bool visible)
 {
-       if (visible!=_vtkclipping3Ddataviewer->GetVisibleVolumeBox() ){
+       if (visible!=_vtkclipping3Ddataviewer->GetVisibleVolumeBox() )
+       {
         VisibleVolumeActor(!visible);
         _vtkclipping3Ddataviewer->BoxActorChanged(visible);
         _vtkclipping3Ddataviewer->SetVisibleVolumeBox(visible);
         _vtkclipping3Ddataviewer->SetVisibleVolume(!visible);
        }
 }
+
 //-------------------------------------------------------------------
 void wxVtkClipping3DView::Refresh()
 {
@@ -75,6 +80,7 @@ void wxVtkClipping3DView::Refresh()
                _wxvtkclipping3DviewCntrlPanel->Refresh();
        }
 }
+
 //-------------------------------------------------------------------
 wxPanel* wxVtkClipping3DView::CreateSurfControlPanel(wxWindow *parent)
 {
@@ -90,12 +96,12 @@ wxPanel* wxVtkClipping3DView::CreateVolControlPanel(wxWindow *parent)
        return _wxvtkclipping3DviewVolCntrlPanel;
 }
 
-
 //-------------------------------------------------------------------
 vtkClipping3DDataViewer* wxVtkClipping3DView::GetVtkClipping3DDataViewer()
 {
        return _vtkclipping3Ddataviewer;
 }
+
 //-------------------------------------------------------------------
 void wxVtkClipping3DView::VisibleActor(int idTissue, bool visTissue){
        if (visTissue!=_vtkclipping3Ddataviewer->GetVisibleTissue(idTissue)){
@@ -109,6 +115,7 @@ void wxVtkClipping3DView::VisibleActor(int idTissue, bool visTissue){
                _vtkclipping3Ddataviewer->SetVisibleTissue(idTissue,visTissue);
        }
 }
+
 //-------------------------------------------------------------------
 void wxVtkClipping3DView::SetRepSurfaceWireFrame(int idTissue , bool representationType )
 {
@@ -145,6 +152,7 @@ void wxVtkClipping3DView::VisibleVolumeActor( bool visVolume){
        }
 
 }
+
 //-------------------------------------------------------------------
 wxVtk3DBaseView* wxVtkClipping3DView::GetWxvtk3Dbaseview()throw(char*)
 {
@@ -153,6 +161,7 @@ wxVtk3DBaseView* wxVtkClipping3DView::GetWxvtk3Dbaseview()throw(char*)
        }
        return _wxvtk3Dbaseview;
 }
+
 //-------------------------------------------------------------------
 void wxVtkClipping3DView::Configure()
 {
@@ -172,7 +181,12 @@ void wxVtkClipping3DView::Configure()
 
 
        _boxWidgetS1->SetInput( polydata );
-       _boxWidgetS1->PlaceWidget();
+
+//EED 2016-08-19       
+       //_boxWidgetS1->PlaceWidget();
+       int ext[6];
+       this->GetVtkClipping3DDataViewer()->GetVtkMPRBaseData()->GetImageData()->GetExtent(ext);
+       _boxWidgetS1->PlaceWidget(ext[0],ext[1],ext[2],ext[3],ext[4],ext[5]);
 
        int i;
        for (i=0; i< VTKMPRDATA_MAXTISSUE ; i++)
@@ -180,9 +194,6 @@ void wxVtkClipping3DView::Configure()
                _boxWidgetS1->AddObserver( vtkCommand::InteractionEvent, _vtkclipping3Ddataviewer->GetObserverS(i) );
        }
 
-
-
-
 //     _wxvtk3Dbaseview->GetRenderer()->AddActor( _vtkclipping3Ddataviewer->GetTissueActor(0) );
 //     _wxvtk3Dbaseview->GetRenderer()->AddActor( _vtkclipping3Ddataviewer->GetTissueActor(3));
 
@@ -195,7 +206,6 @@ void wxVtkClipping3DView::Configure()
 
 //EED 29Mars2009
 //     _boxWidgetS1->On();
-
        _boxWidgetS1->Off();
 
        _boxWidgetS1->GetPlanes( this->GetVtkClipping3DDataViewer()->GetTissuePlanes(0) );
@@ -208,24 +218,18 @@ void wxVtkClipping3DView::Configure()
        _boxWidgetVolume = vtkBoxWidget::New();
        _boxWidgetVolume->SetInteractor( _wxvtk3Dbaseview->GetWxVTKRenderWindowInteractor() );
        _boxWidgetVolume->SetPlaceFactor(1.25);
-
        _boxWidgetVolume->SetInput( this->GetVtkClipping3DDataViewer()->GetVtkMPRBaseData()->GetImageData() );
        _boxWidgetVolume->PlaceWidget();
-
-       _boxWidgetVolume->AddObserver( vtkCommand::InteractionEvent              , _vtkclipping3Ddataviewer->GetObserverV() );
-
+       _boxWidgetVolume->AddObserver( vtkCommand::InteractionEvent, _vtkclipping3Ddataviewer->GetObserverV() );
        _boxWidgetVolume->HandlesOn ();
 
 //EED 29Mars2009
 //     _boxWidgetVolume->On();
-
        _boxWidgetVolume->Off();
 
-
 //     vtkPlanes *vtkplanes=this->GetVtkClipping3DDataViewer()->GetVolumePlanes();
 //     _boxWidgetVolume->GetPlanes( vtkplanes );
 
-
 //EED 27/05/2013
 //  _wxvtk3Dbaseview->GetRenderer()->ResetCamera ();
 //  _wxvtk3Dbaseview->GetCamera()->Dolly(1.2);
@@ -250,8 +254,6 @@ void wxVtkClipping3DView::Configure()
 
        _vtkclipping3Ddataviewer->SetRenderer(this->GetWxvtk3Dbaseview()->GetRenderer());
        _vtkclipping3Ddataviewer->SetInteractor(this->GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor());
-
-
 }
 //-------------------------------------------------------------------
 void wxVtkClipping3DView::SetVtkClipping3DDataViewer(vtkClipping3DDataViewer *vtkclipping3Ddataviewer)
index 8e7f4bbf2f01c7dde73b277f9d8386b1632aded4..c3c24512a4407048c053e66d43e064ea2f80c418 100644 (file)
@@ -41,39 +41,39 @@ public:
        virtual ~wxVtkClipping3DView();
        virtual void                    Refresh();
        virtual void                    Configure();
-       void                                            SetVtkClipping3DDataViewer( vtkClipping3DDataViewer *vtkclipping3Ddataviewer );
+       void                                    SetVtkClipping3DDataViewer( vtkClipping3DDataViewer *vtkclipping3Ddataviewer );
 
-       wxPanel*                                        CreateSurfControlPanel(wxWindow *parent);
-       wxPanel*                                        CreateVolControlPanel(wxWindow *parent);
+       wxPanel*                                CreateSurfControlPanel(wxWindow *parent);
+       wxPanel*                                CreateVolControlPanel(wxWindow *parent);
 
        vtkClipping3DDataViewer*        GetVtkClipping3DDataViewer();
 
-       void                                            VisibleActor(int idTissue, bool visTissue);
-       void                                            VisibleVolumeActor( bool visVolume );
+       void                                    VisibleActor(int idTissue, bool visTissue);
+       void                                    VisibleVolumeActor( bool visVolume );
 
-       void                 VisibleVolumeBoxActor(bool visible);
+       void                    VisibleVolumeBoxActor(bool visible);
 
-       void                                            SetVisibleBoxSurface(bool visible);
-       void                                            SetVisibleBoxVolume(bool visible);
-       void                                            SetRepSurfaceWireFrame(int idTissue , bool typeRepresentation );
+       void                                    SetVisibleBoxSurface(bool visible);
+       void                                    SetVisibleBoxVolume(bool visible);
+       void                                    SetRepSurfaceWireFrame(int idTissue , bool typeRepresentation );
 
        wxVtk3DBaseView*                GetWxvtk3Dbaseview()throw(char*);
 
-       void                 SetRayCasting(bool active);
-       void                 SetMIPActive(bool active);
-   void                        SetInterpolation(bool active);
-   void                        SetShade(bool active);
+       void                    SetRayCasting(bool active);
+       void                    SetMIPActive(bool active);
+   void                                SetInterpolation(bool active);
+   void                                SetShade(bool active);
 
-   void                        UpdateVolumeBox(vector<double> gf, vector<double> vf, vtkColorTransferFunction* ctfun);
+   void                                UpdateVolumeBox(vector<double> gf, vector<double> vf, vtkColorTransferFunction* ctfun);
 
 
 private:
        wxVtk3DBaseView                         *_wxvtk3Dbaseview;
        vtkClipping3DDataViewer         *_vtkclipping3Ddataviewer;
-       vtkBoxWidget                                    *_boxWidgetS1;
-       vtkBoxWidget                                    *_boxWidgetVolume;
-       wxPanel                                                 *_wxvtkclipping3DviewCntrlPanel;
-       wxPanel                                                 *_wxvtkclipping3DviewVolCntrlPanel;
+       vtkBoxWidget                            *_boxWidgetS1;
+       vtkBoxWidget                            *_boxWidgetVolume;
+       wxPanel                                         *_wxvtkclipping3DviewCntrlPanel;
+       wxPanel                                         *_wxvtkclipping3DviewVolCntrlPanel;
 protected:
 };