]> Creatis software - creaMaracasVisu.git/commitdiff
Bug #1679 v1.0.4
authorEduardo Davila <Eduardo.Davila@creatis.insa-lyon.fr>
Thu, 11 Oct 2012 10:45:15 +0000 (10:45 +0000)
committerEduardo Davila <Eduardo.Davila@creatis.insa-lyon.fr>
Thu, 11 Oct 2012 10:45:15 +0000 (10:45 +0000)
Refresh ViewerNV (initialice window level, color level, camera settings)

bbtk/src/bbmaracasvisuDrawAxe3D.cxx
bbtk/src/bbmaracasvisuViewerNV.cxx
bbtk/src/bbmaracasvisuViewerNV.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewContour.cpp
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_N_ViewersWidget.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_ViewerWidget.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk2DBaseView.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk2DBaseView.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkBaseView.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR2DView.cxx

index cd9997b4087ced046f0f9161465b126adfc456f2..5736969768048baf27802e602f6f1541859a6338 100644 (file)
@@ -15,8 +15,6 @@ BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,DrawAxe3D)
 BBTK_BLACK_BOX_IMPLEMENTATION(DrawAxe3D,bbtk::AtomicBlackBox);
 void DrawAxe3D::Process()
 {
-       printf("EED DrawAxe3D::Process start \n");
-       
        std::vector< double > vectx = bbGetInputlstPointX();
        std::vector< double > vecty = bbGetInputlstPointY();
        std::vector< double > vectz = bbGetInputlstPointZ();    
@@ -61,9 +59,6 @@ void DrawAxe3D::Process()
                firsttime=false;
            bbGetInputRenderer()->AddActor( mvtkactor );
      }
-       
-       printf("EED DrawAxe3D::Process end \n");
-
 }
 
 void DrawAxe3D::bbUserSetDefaultValues()
index 137b01261ffb9adc3f830664b239df356322e068..c8e287fc0216756afa12b68bd1e2f048a967133e 100644 (file)
@@ -31,12 +31,12 @@ bbwxMaracas_N_ViewersWidget::~bbwxMaracas_N_ViewersWidget()
 void bbwxMaracas_N_ViewersWidget::OnRefreshView(wxCommandEvent & event)
 {
        //printf("CPR: bbwxMaracas_N_ViewersWidget::OnRefreshView -> actualiza X, Y y Z\n");
-       mbbViewerNV->point.clear();
+       mbbViewerNV->_point.clear();
 
-       mbbViewerNV->point.push_back( (int)GetX() );
-       mbbViewerNV->point.push_back( (int)GetY() );
-       mbbViewerNV->point.push_back( (int)GetZ() );
-       mbbViewerNV->bbSetOutputPoint( mbbViewerNV->point );
+       mbbViewerNV->_point.push_back( (int)GetX() );
+       mbbViewerNV->_point.push_back( (int)GetY() );
+       mbbViewerNV->_point.push_back( (int)GetZ() );
+       mbbViewerNV->bbSetOutputPoint( mbbViewerNV->_point );
        mbbViewerNV->bbSignalOutputModification(std::string("Point"));
 
        wxMaracas_N_ViewersWidget::OnRefreshView(event);
@@ -60,9 +60,6 @@ BBTK_BLACK_BOX_IMPLEMENTATION(ViewerNV,bbtk::WxBlackBox);
 //-------------------------------------------------------------
 void ViewerNV::Process()
 {
-       
-       printf("EED ViewerNV::Process start \n");
-       
        vtkImageData* img = bbGetInputIn();
 /*
        double spc[3];
@@ -78,38 +75,31 @@ void ViewerNV::Process()
        std::vector<int> type = bbGetInputnTypeView();
 
 
-       if(img != NULL && mwxwidget != NULL){
-               if(!compareVectors(type, currenttype)){
-                       mwxwidget->SetType(&type);
-                       mwxwidget->UpdateLayout(img);
-               }else if (img != currentimg){
-                       mwxwidget->SetImage(img);
-                       //mwxwidget->UpdateLayout(img);
+       if(img != NULL && _mwxwidget != NULL){
+               if(!compareVectors(type, _currenttype)){
+                       _mwxwidget->SetType(&type);
+                       _mwxwidget->UpdateLayout(img);
+               }else if (img != _currentimg){
+                       _mwxwidget->SetImage(img);
                }
 
-//             if (firsttime==true)  // EED  21 aout 2010
-//             {
-//                     firsttime=false;
-//                     mwxwidget->ConfigureVTK();
-//             }
+               _mwxwidget->RefreshView();
 
-               mwxwidget->RefreshView();
+               _currenttype = type;
+               _currentimg = img;
 
-               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);
+               _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);
+               wxVtkBaseView *wvbv1 = _mwxwidget->GetwxVtkBaseView(1);
+               wxVtkBaseView *wvbv2 = _mwxwidget->GetwxVtkBaseView(2);
+               wxVtkBaseView *wvbv3 = _mwxwidget->GetwxVtkBaseView(3);
+               wxVtkBaseView *wvbv4 = _mwxwidget->GetwxVtkBaseView(4);
 
                //wxwidget->RefreshView();
 
@@ -130,12 +120,12 @@ void ViewerNV::Process()
 
                if(bbGetInputColorFunction()!=NULL)
                {
-                       mwxwidget->setColorTransferFunction(bbGetInputColorFunction());
+                       _mwxwidget->setColorTransferFunction(bbGetInputColorFunction());
                }
 
                if(bbGetInputWindowLevel()!=-1)
                {
-                   mwxwidget->setWindowLevel(bbGetInputWindowLevel());
+                       _mwxwidget->setWindowLevel(bbGetInputWindowLevel());
                }
 
                if(bbGetInputColorLevel()!=-1)
@@ -143,28 +133,21 @@ void ViewerNV::Process()
                        if(bbGetInputColorLevel() == 0)
                        {
                                std::cout<<"colorlevel "<<bbGetInputColorLevel()<<std::endl;
-                               mwxwidget->setColorLevel(0.1);
+                               _mwxwidget->setColorLevel(0.1);
                        }else{
-                               mwxwidget->setColorLevel(bbGetInputColorLevel());
+                               _mwxwidget->setColorLevel(bbGetInputColorLevel());
                        }
                }
        }//  mwxwidget != NULL
-       
-       printf("EED ViewerNV::Process end\n");
 }
 
 //-------------------------------------------------------------
 void ViewerNV::CreateWidget(wxWindow* parent)
 {
-       printf("EED ViewerNV::CreateWidget start\n");
-
     bbtkDebugMessageInc("Core",9,"ViewerNV::CreateWidget()"<<std::endl);
-       mwxwidget = new bbwxMaracas_N_ViewersWidget( this, parent );
+       _mwxwidget = new bbwxMaracas_N_ViewersWidget( this, parent );
        bbtkDebugDecTab("Core",9);
-    bbSetOutputWidget( mwxwidget );
-
-       printf("EED ViewerNV::CreateWidget end\n");
-
+    bbSetOutputWidget( _mwxwidget );
        //this->bbSignalOutputModification();
        //Process();
 }
@@ -172,8 +155,8 @@ void ViewerNV::CreateWidget(wxWindow* parent)
 //-------------------------------------------------------------
 void ViewerNV::bbUserSetDefaultValues()
 {
-//     firsttime=true;
-       mwxwidget = NULL;
+       _currentimg                             =       NULL;
+       _mwxwidget                              =       NULL;
        bbSetInputIn(NULL);
 
        bbSetInputObs1(NULL);
index b255c0c099b3d9eb5b06930595d52946e0878817..8f0d4e33ae5a6efdf992e59bff9930cb92a4ca6f 100644 (file)
@@ -72,14 +72,13 @@ class /*BBTK_EXPORT*/ ViewerNV
   BBTK_CREATE_WIDGET(CreateWidget);
   void CreateWidget(wxWindow* parent);
 
-   std::vector<int>                    point;
+   std::vector<int>                            _point;
 private:
-//     bool    firsttime;
-
-       vtkImageData* currentimg;
-       std::vector<int>  currenttype;
-       wxMaracas_N_ViewersWidget       *mwxwidget;
 
+       vtkImageData                            *_currentimg;
+       std::vector<int>                        _currenttype;
+       wxMaracas_N_ViewersWidget       *_mwxwidget;
+       
        bool compareVectors(std::vector<int> type,std::vector<int> currenttype);
        void updateObservers();
 };
index bff37c326502bbce96024a57cccc56ee604f37ab..636641c78ffe096da1eabe20925661bb61d06bbe 100644 (file)
@@ -225,11 +225,10 @@ bool manualViewContour::ifTouchContour(int x,int y,int z)
                nps_t = nps-1;
                } // if close
 
-               printf("EED  manualViewContour::ifTouchContour \n");
+printf("EED  Warning manualViewContour::ifTouchContour \n");
 
                for( i = 0; i < nps_t; i++ ) 
                {
-printf("%d ", i);
                        _pts->GetPoint(i%nps, ppA);
                        _pts->GetPoint((i+1)%nps, ppB);
                        d1 = sqrt( (ppA[0]-xx)*(ppA[0]-xx) + (ppA[1]-yy)*(ppA[1]-yy) + (ppA[2]-zz)*(ppA[2]-zz));
index 53d7a4b683d98a74407f476ea458cfc0aa263aa3..b139433c30c3ce382d0e9faaa57635827652e041 100644 (file)
@@ -3,8 +3,8 @@
   Program:   wxMaracas
   Module:    $RCSfile: wxMaracas_N_ViewersWidget.cxx,v $
   Language:  C++
-  Date:      $Date: 2012/05/30 17:23:12 $
-  Version:   $Revision: 1.21 $
+  Date:      $Date: 2012/10/11 10:45:16 $
+  Version:   $Revision: 1.22 $
 
   Copyright: (c) 2002, 2003
   License:
         if (wxwindow2!=NULL) { wxwindow2->SetImage(image); }
         if (wxwindow3!=NULL) { wxwindow3->SetImage(image); }
         if (wxwindow4!=NULL) { wxwindow4->SetImage(image); }
-        ConfigureVTK();
-
+        
+//      ConfigureVTK();
  }
 
+
 //-----------------------------------------------------------------------------------
  void wxMaracas_N_ViewersWidget::ConfigureVTK()
  {
index 62d2fc75cca10a1575da22cc933ffb45f1d7a693..a0ca639899ac8173d90700ba1658e3bd88ce469d 100644 (file)
@@ -3,8 +3,8 @@
   Program:   wxMaracas
   Module:    $RCSfile: wxMaracas_ViewerWidget.cxx,v $
   Language:  C++
-  Date:      $Date: 2012/05/30 17:23:12 $
-  Version:   $Revision: 1.35 $
+  Date:      $Date: 2012/10/11 10:45:16 $
+  Version:   $Revision: 1.36 $
 
   Copyright: (c) 2002, 2003
   License:
                if (mwxvtkmpr3Dview                     !=NULL)
                {
                        mwxvtkmpr3Dview->Configure();
-printf("EED wxMaracas_ViewerWidget::ConfigureVTK \n");                 
 //EED???                       mwxvtkmpr3Dview->ResetCamera(ext,org,spc);
                }
 
@@ -341,16 +340,15 @@ printf("EED wxMaracas_ViewerWidget::ConfigureVTK \n");
        //-------------------------------------------------------------------------
        void wxMaracas_ViewerWidget::RefreshView()
        {
-                       if (mvtk2Dbaseview              !=NULL ){ mvtk2Dbaseview->Refresh();            }
-                       if (mvtkmpr2Dview_X             !=NULL ){ mvtkmpr2Dview_X->Refresh();           }
-                       if (mvtkmpr2Dview_Y             !=NULL ){ mvtkmpr2Dview_Y->Refresh();           }
-                       if (mvtkmpr2Dview_Z             !=NULL ){ mvtkmpr2Dview_Z->Refresh();           }
-                       if (mvtkplane2Dview             !=NULL ){ mvtkplane2Dview->Refresh();           }
-                       if (mwxsphereview               !=NULL ){ mwxsphereview ->Refresh();            }
-
-                       if (mwxvtkmpr3Dview             !=NULL ){ mwxvtkmpr3Dview->RefreshView();       }
-                       if (mwxvtkclipping3Dview        !=NULL ){ mwxvtkclipping3Dview->Refresh();      }
-                       if (mwxvtk3Dbaseview_Clipping3D !=NULL ){ mwxvtk3Dbaseview_Clipping3D->Refresh();}
+               if (mvtk2Dbaseview                              !=NULL ){ mvtk2Dbaseview->Refresh();                            }
+               if (mvtkmpr2Dview_X                             !=NULL ){ mvtkmpr2Dview_X->Refresh();                           }
+               if (mvtkmpr2Dview_Y                             !=NULL ){ mvtkmpr2Dview_Y->Refresh();                           }
+               if (mvtkmpr2Dview_Z                             !=NULL ){ mvtkmpr2Dview_Z->Refresh();                           }
+               if (mvtkplane2Dview                             !=NULL ){ mvtkplane2Dview->Refresh();                           }
+               if (mwxsphereview                               !=NULL ){ mwxsphereview ->Refresh();                            }
+               if (mwxvtkmpr3Dview                             !=NULL ){ mwxvtkmpr3Dview->RefreshView();                       }
+               if (mwxvtkclipping3Dview                !=NULL ){ mwxvtkclipping3Dview->Refresh();                      }
+               if (mwxvtk3Dbaseview_Clipping3D !=NULL ){ mwxvtk3Dbaseview_Clipping3D->Refresh();       }
        }
 
        //-------------------------------------------------------------------------
@@ -391,6 +389,34 @@ printf("EED wxMaracas_ViewerWidget::ConfigureVTK \n");
                        mar->AddImageData(image);
                }
 
+               
+               if (mvtk2Dbaseview!=NULL)
+               {
+                       mvtk2Dbaseview->SetImageToVtkViewer(image);
+               }
+               
+               if (mvtkmpr2Dview_X!=NULL){
+                       mvtkmpr2Dview_X->SetImageToVtkViewer(image);
+               }
+               if (mvtkmpr2Dview_Y!=NULL){
+                       mvtkmpr2Dview_Y->SetImageToVtkViewer(image);
+               }
+               if (mvtkmpr2Dview_Z!=NULL){
+                       mvtkmpr2Dview_Z->SetImageToVtkViewer(image);
+               }
+               
+               if (mvtkplane2Dview!=NULL){
+                       // ???  EED 10 oct 2012
+               }
+               if (mwxsphereview!=NULL){
+                       // ???  EED 10 oct 2012
+               }
+               if (mwxvtk3Dbaseview_Clipping3D!=NULL){
+                       // ???  EED 10 oct 2012
+               }
+               
+               
+               
 //EED 26/11/2009
 //             ConfigureVTK();
 //             RefreshView();
index 90f4bf030ed1c2c62eb97a144e18465405899d39..61607c373e2075bf13ba759877412a49b7a2f260 100644 (file)
@@ -75,6 +75,7 @@ void wxVtk2DBaseView::TransformCoordinate_spacing_ModelToView(double &X,double &
 //-------------------------------------------------------------------
 void wxVtk2DBaseView::ResetView()
 {
+       printf("EED wxVtk2DBaseView::ResetView");
        double spx = 0,spy = 0,spz = 0;
        int x1 = 1,x2 = 1,y1 = 1,y2 = 1,z1 = 1,z2 = 1;
        wxVtkBaseView::Configure();
@@ -122,6 +123,17 @@ void wxVtk2DBaseView::ResetView()
 }
 
 
+
+//-------------------------------------------------------------------
+void wxVtk2DBaseView::SetImageToVtkViewer(vtkImageData *imageData)
+{
+       if (_imageViewer2XYZ!=NULL)
+       {
+               _imageViewer2XYZ->GetVtkImageViewer2()->SetInput( imageData );
+       } // if _imageViewer2XYZ
+}
+
+
 //-------------------------------------------------------------------
 void wxVtk2DBaseView::Configure(bool okimage)
 {
@@ -159,15 +171,15 @@ void wxVtk2DBaseView::Configure(bool okimage)
 
 
        vtkImageData *imageData = GetVtkBaseData()->GetMarImageData()->GetImageData();
-       if (imageData!=NULL){
-
+       if (imageData!=NULL)
+       {
                imageData->UpdateInformation();
                imageData->SetUpdateExtent( imageData->GetWholeExtent());
                imageData->Update();
                if (okimage==true){
                        imageData->GetSpacing (spx,spy,spz);
                        imageData->GetExtent (x1,x2,y1,y2,z1,z2);
-                       _imageViewer2XYZ->GetVtkImageViewer2()->SetInput(imageData );
+                       SetImageToVtkViewer(imageData);
                        _imageViewer2XYZ->SetExtentDimension(x1,x2,y1,y2,z1,z2);
                        double range[2];
                        imageData->GetScalarRange(range);
@@ -195,8 +207,8 @@ void wxVtk2DBaseView::Configure(bool okimage)
 //                     SetInteractorStyleImage( vtkInteractorStyleBaseView2D::New() );
 
 
-                       vtkImageViewer2 *IV2=_imageViewer2XYZ->GetVtkImageViewer2();
-                       vtkCamera *camera = IV2->GetRenderer()->GetActiveCamera();
+                       vtkImageViewer2 *IV2            =       _imageViewer2XYZ->GetVtkImageViewer2();
+                       vtkCamera               *camera         =       IV2->GetRenderer()->GetActiveCamera();
 
 //EED 17Avril2009
 //EED 21 mars 2012     FLIP problem  ..PLOP..
index 6903109de2e6cd1fcc4fde3f8d6eee71c649a8e7..7a3e47b985107d105e24406e172fd857832842d3 100644 (file)
@@ -41,6 +41,7 @@ public:
 
        void setColorLevel(double level);
     virtual int GetDirection();
+       void SetImageToVtkViewer(vtkImageData *imageData);
 
 
 private:
index 00cfbdc7d2a6234530e8b69dbda8653005014ba5..6bba28cece1d89788983ec78f7590b424c2c6216 100644 (file)
@@ -48,8 +48,8 @@ void wxVtkBaseView::Configure()  // virtual
 //-------------------------------------------------------------------
 void wxVtkBaseView::Refresh()  // virtual 
 {
+       
 // EED 10 Oct 2007
-
        #if defined(WIN32)
                _iren->Refresh(false);
        #else
@@ -67,6 +67,7 @@ void wxVtkBaseView::Refresh()  // virtual
 //-------------------------------------------------------------------
 void wxVtkBaseView::RefreshView()  // virtual 
 {
+       printf("EED wxVtkBaseView::RefreshView() \n");
 // EED 10 Oct 2007
 
        #if defined(WIN32)
index 849a6e7889d9586f4eb7e9f04d86b72d74432f35..0bd418b97977409f6bca5000cdc194fb7bc1fb46 100644 (file)
@@ -44,7 +44,10 @@ vtkMPRBaseData *wxVtkMPR2DView::GetVtkmprbasedata()
        return (vtkMPRBaseData*)GetVtkBaseData();
 }
 //-------------------------------------------------------------------
-void wxVtkMPR2DView::Configure(){
+void wxVtkMPR2DView::Configure()
+{
+       printf("EED wxVtkMPR2DView::Configure");
+       
        wxVtk2DBaseView::Configure();
 
 
@@ -225,6 +228,7 @@ void wxVtkMPR2DView::SetVisibleAxis(bool ok)
 void wxVtkMPR2DView::Refresh()
 {
 
+       printf("wxVtkMPR2DView::Refresh start\n");
 
        //wxVtk2DBaseView::Refresh();
 
@@ -346,6 +350,9 @@ void wxVtkMPR2DView::Refresh()
 _imageViewer2XYZ->GetVtkImageViewer2()->GetWindowLevel()->Modified();
 
                wxVtkBaseView::Refresh();
+               
+               printf("wxVtkMPR2DView::Refresh end\n");
+               
        }
 }
 //-------------------------------------------------------------------