]> Creatis software - creaMaracasVisu.git/commitdiff
*** empty log message ***
authorEduardo Davila <Eduardo.Davila@creatis.insa-lyon.fr>
Mon, 18 Oct 2010 19:28:52 +0000 (19:28 +0000)
committerEduardo Davila <Eduardo.Davila@creatis.insa-lyon.fr>
Mon, 18 Oct 2010 19:28:52 +0000 (19:28 +0000)
bbtk/src/bbcreaMaracasVisuManualPaint.cxx [new file with mode: 0644]
bbtk/src/bbcreaMaracasVisuManualPaint.h [new file with mode: 0644]
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualContourBaseControler.cpp
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualContourControler.cpp
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualRoiControler.cpp

diff --git a/bbtk/src/bbcreaMaracasVisuManualPaint.cxx b/bbtk/src/bbcreaMaracasVisuManualPaint.cxx
new file mode 100644 (file)
index 0000000..3bde3b5
--- /dev/null
@@ -0,0 +1,187 @@
+//=====
+// Don't edit this file. This file is generated from xml description..
+//=====
+#include "bbcreaMaracasVisuManualPaint.h"
+#include "bbcreaMaracasVisuPackage.h"
+
+#include "wxVtk2DBaseView.h"
+#include "wxVTKRenderWindowInteractor.h"
+
+namespace bbcreaMaracasVisu
+{
+
+
+
+vtkInteractorManualPaint::vtkInteractorManualPaint()
+{
+       _state  =   false;
+       _image  =   NULL;
+       _auxZ   =   0;
+}
+
+//---------------------------------------------------------------------------
+vtkInteractorManualPaint::~vtkInteractorManualPaint()
+{
+}
+
+//---------------------------------------------------------------------------
+bool vtkInteractorManualPaint::OnLeftButtonDown()
+{
+       vtkRenderWindowInteractor *interactor = _vtkInteractorStyleBaseView->GetInteractor();
+       if ((interactor->GetControlKey()==1) || (interactor->GetShiftKey()==1) ){
+        _state  =   true;
+        wxVtk2DBaseView             *wxvtk2Dbaseview    = (wxVtk2DBaseView*)_vtkInteractorStyleBaseView->GetWxVtk2DBaseView();
+        _Z      =   wxvtk2Dbaseview->GetActualSlice();
+//             _sliceZ         = ((wxVtk2DBaseView*)_vtkInteractorStyleBaseView->GetWxVtk2DBaseView())->GetActualSlice();
+       }
+       return true;
+}
+
+//---------------------------------------------------------------------------
+bool vtkInteractorManualPaint::OnLeftButtonUp()
+{
+       _state = false;
+       return true;
+}
+
+//---------------------------------------------------------------------------
+bool vtkInteractorManualPaint::OnMouseMove ()
+{
+    printf("EED vtkInteractorManualPaint::OnMouseMove \n");
+       if (_state==true)
+       {
+        int px,py;
+        wxVtk2DBaseView             *wxvtk2Dbaseview    = (wxVtk2DBaseView*)_vtkInteractorStyleBaseView->GetWxVtk2DBaseView();
+        wxVTKRenderWindowInteractor *wxVTKiren          = wxvtk2Dbaseview->GetWxVTKRenderWindowInteractor();
+
+        wxVTKiren->GetEventPosition(px,py);
+
+        double X = (double)px;
+        double Y = (double)py;
+        double Z = _Z;
+        int typeView = 2;
+        wxvtk2Dbaseview->TransFromCoordScreenToWorld(X, Y, Z,false, typeView);
+
+//        int px = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[0];
+//        int py = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[1];
+        printf("EED vtkInteractorManualPaint::OnMouseMove  -----------------  %f %f %f\n", X,Y,Z);
+
+        PaintImage((int)X,(int)Y,(int)Z);
+
+        wxvtk2Dbaseview->Refresh();
+        wxvtk2Dbaseview->RefreshView();
+//        wxvtk2Dbaseview->SetActualSlice(_Z+_auxZ);
+        _auxZ=(_auxZ+1)%2;
+        wxvtk2Dbaseview->_imageViewer2XYZ->GetVtkImageViewer2()->GetRenderer()->Render();
+        this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
+//        wxvtk2Dbaseview->SetActualSlice(Z);
+       }// if _state
+       return true;
+}
+
+//---------------------------------------------------------------------------
+void vtkInteractorManualPaint::SetImage(vtkImageData *image)
+{
+       _image = image;
+}
+
+
+void vtkInteractorManualPaint::PaintImage(int px,int py, int pz)
+{
+    if (_image!=NULL)
+    {
+        float value=0;
+        printf("EED vtkInteractorManualPaint::PaintImage   %d %d %d\n", px,py,pz);
+        _image->SetScalarComponentFromFloat (px,py,pz, 0, value );
+        _image->Modified();
+    } else  {
+        printf("ERROR : bbcreaMaracasvisu::vtkInteractorManualPaint::PaintImage :  Image not set. \n");
+    }
+}
+
+
+
+//---------------------------------------------------------------------------------
+//---------------------------------------------------------------------------------
+//---------------------------------------------------------------------------------
+
+
+
+
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,ManualPaint)
+BBTK_BLACK_BOX_IMPLEMENTATION(ManualPaint,bbtk::WxBlackBox);
+//=====
+// Don't edit this file. This file is generated from xml description..
+//=====
+void ManualPaint::Process()
+{
+
+/*
+   std::string msg;
+    if (bbGetInputTitle()!="")
+      {
+       msg = bbGetInputTitle()+": " + bbGetInputIn();
+      }
+    else
+      {
+       msg = bbGetInputIn();
+      }
+   ((wxStaticText*)bbGetOutputWidget())->SetLabel( bbtk::std2wx( msg ) );
+  */
+
+    if (bbGetInputWxVtkBaseView()==NULL)
+    {
+        printf("WARNING : package creaMaracasVisu box ManualPaint : input WxVtkBaseView have to be defferent of NULL\n");
+    }
+
+    if (bbGetInputIn()==NULL)
+    {
+        printf("WARNING : package creaMaracasVisu box ManualPaint : input In (vtkImageData*) have to be defferent of NULL\n");
+    }
+
+
+    if (imp==NULL)
+    {
+        imp=new vtkInteractorManualPaint();
+        imp->SetImage( bbGetInputIn() );
+        vtkInteractorStyleBaseView *isbv = (vtkInteractorStyleBaseView*)(bbGetInputWxVtkBaseView()->GetInteractorStyleBaseView());
+        isbv->AddInteractorStyleMaracas(imp);
+    }
+
+}
+//=====
+// Don't edit this file. This file is generated from xml description..
+//=====
+void ManualPaint::CreateWidget(wxWindow* parent)
+{
+
+   bbSetOutputWidget( new wxStaticText ( parent , -1 , _T("UPS") ) );
+
+}
+//=====
+// Don't edit this file. This file is generated from xml description..
+//=====
+void ManualPaint::bbUserSetDefaultValues()
+{
+    imp=NULL;
+    bbSetInputIn(NULL);
+}
+//=====
+// Don't edit this file. This file is generated from xml description..
+//=====
+void ManualPaint::bbUserInitializeProcessing()
+{
+
+}
+//=====
+// Don't edit this file. This file is generated from xml description..
+//=====
+void ManualPaint::bbUserFinalizeProcessing()
+{
+
+}
+
+} // EO namespace bbcreaMaracasVisu
+
+
diff --git a/bbtk/src/bbcreaMaracasVisuManualPaint.h b/bbtk/src/bbcreaMaracasVisuManualPaint.h
new file mode 100644 (file)
index 0000000..cb3b6bf
--- /dev/null
@@ -0,0 +1,83 @@
+//=====
+// Don't edit this file. This file is generated from xml description..
+//=====
+#ifdef _USE_WXWIDGETS_
+#ifndef __bbcreaMaracasVisuManualPaint_h_INCLUDED__
+#define __bbcreaMaracasVisuManualPaint_h_INCLUDED__
+#include "bbcreaMaracasVisu_EXPORT.h"
+#include "bbtkWxBlackBox.h"
+
+#include "wxVtkBaseView.h"
+#include "vtkImageData.h"
+
+#include "InteractorStyleMaracas.h"
+
+namespace bbcreaMaracasVisu
+{
+
+
+
+class vtkInteractorManualPaint : public InteractorStyleMaracas {
+public:
+       vtkInteractorManualPaint();
+       virtual ~vtkInteractorManualPaint();
+
+       virtual bool  OnMouseMove();
+       virtual bool  OnLeftButtonDown();
+       virtual bool  OnLeftButtonUp();
+       void SetImage(vtkImageData *image);
+
+private:
+        double          _Z;
+        int             _auxZ;
+               bool            _state;
+               vtkImageData    *_image;
+        void PaintImage( int px, int py, int pz );
+
+protected:
+
+};
+
+
+
+
+
+
+class bbcreaMaracasVisu_EXPORT ManualPaint
+ :
+   public bbtk::WxBlackBox
+{
+  BBTK_BLACK_BOX_INTERFACE(ManualPaint,bbtk::WxBlackBox);
+//=====
+// Don't edit this file. This file is generated from xml description..
+//=====
+  BBTK_DECLARE_INPUT(In,vtkImageData*);
+  BBTK_DECLARE_INPUT(WxVtkBaseView,wxVtkBaseView*);
+  BBTK_PROCESS(Process);
+  void Process();
+  BBTK_CREATE_WIDGET(CreateWidget);
+  void CreateWidget(wxWindow*);
+
+    vtkInteractorManualPaint *imp;
+//=====
+// Don't edit this file. This file is generated from xml description..
+//=====
+};
+
+BBTK_BEGIN_DESCRIBE_BLACK_BOX(ManualPaint,bbtk::WxBlackBox);
+BBTK_NAME("ManualPaint");
+BBTK_AUTHOR("eduardo davila (Creatis)");
+BBTK_DESCRIPTION("Voxel manual paint");
+BBTK_CATEGORY("__CategoryBlackBox__");
+BBTK_INPUT(ManualPaint,In,"Input image to be modified",vtkImageData*,"");
+BBTK_INPUT(ManualPaint,WxVtkBaseView,"creaMaracasVisu viewer",wxVtkBaseView*,"");
+BBTK_END_DESCRIBE_BLACK_BOX(ManualPaint);
+//=====
+// Don't edit this file. This file is generated from xml description..
+//=====
+}
+// EO namespace bbcreaMaracasVisu
+
+#endif // __bbcreaMaracasVisuManualPaint_h_INCLUDED__
+#endif // _USE_WXWIDGETS_
+
index c32d56913c1839f8e747963fc927590d0d289c1b..f96fb484afeea85782bd74c89c561b0f915c57aa 100644 (file)
@@ -137,7 +137,6 @@ bool manualContourBaseControler::OnChar()
 // ----------------------------------------------------------------------------
 bool manualContourBaseControler::OnMouseMove()
 {
-       
        if ( _vtkInteractorStyleBaseView!=NULL)
        {
                int X,Y;
@@ -145,6 +144,7 @@ bool manualContourBaseControler::OnMouseMove()
                _wxVTKiren= _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
                _wxVTKiren->GetEventPosition( X , Y );
 
+       printf("EED manualContourBaseControler::OnMouseMove %d %d\n",X,Y);
 
                if ( (_vtkInteractorStyleBaseView->GetInteractor()->GetControlKey()==0) &&
                        (_vtkInteractorStyleBaseView->GetInteractor()->GetShiftKey()==0) ) {
@@ -290,7 +290,7 @@ void manualContourBaseControler::MouseDLeft(int x, int y )
 {
        if (_state==0)
        {
-               
+
                int z=GetZ();
                /*bool temp = */ _manViewBaseCont->SelectPosibleContour(x,y,z);
 
@@ -457,7 +457,7 @@ void manualContourBaseControler::AddPoint(int x, int y, int z) // virtual
                double  xx      = x;
                double  yy      = y;
                double  zz      = z;
-               
+
                GetManualViewBaseContour()->TransfromCoordViewWorld(xx,yy,zz);
                GetManualContourModel()->AddPoint(xx,yy,zz);
                GetManualViewBaseContour()->AddPoint();
index 33665fb521d4844125a77f29b8aa448a3290b5af..845f3c9d0121f0eee5647aaf10c264bbd5b1dfd4 100644 (file)
@@ -41,7 +41,8 @@ void manualContourControler::Configure() //virtual
 }
 
 // ----------------------------------------------------------------------------
-void manualContourControler::MouseClickLeft(int x, int y){
+void manualContourControler::MouseClickLeft(int x, int y)
+{
 
        bool ok = false;
        int z   = GetZ();
@@ -99,7 +100,7 @@ void manualContourControler::MouseClickLeft(int x, int y){
                SetPosibleToMove( true );
                GetManualViewBaseContour()->SetSelected( GetManualViewBaseContour()->GetPosibleSelected() );
        } // IsEditable
-       
+
        if ( GetState() == 0 && GetManualViewBaseContour()->GetPosibleSelected() )
        {
                SetMoving( true );
@@ -144,7 +145,7 @@ void manualContourControler::MouseDLeft( int x, int y)//virtual
        manualContourBaseControler::MouseDLeft( x, y);
        if ( IsEditable() )
        {
-               
+
                GetManualViewBaseContour()->AddControlPoints();
                GetManualViewBaseContour()->AddTextActor();
                GetManualViewBaseContour()->Refresh();
index 85f2068a9b5ae27f378c9bfa2a10c4697c053bdc..cbcdbd068caf63d6697cffb96fa0516942b2b1e9 100644 (file)
@@ -41,7 +41,7 @@ void manualRoiControler::Configure() //virtual
 
 void manualRoiControler::MouseClickLeft(int x, int y){
        int z = GetZ();
-       
+
        if( IsEditable() )
        {       // move control point
          if ( (GetState()==0) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)!=-1 ) ){
@@ -49,13 +49,13 @@ void manualRoiControler::MouseClickLeft(int x, int y){
                  SetState(5);
          }
        } // IsEditable
-       
+
        // Move contour
        if ((GetState()==0) && (GetManualViewBaseContour()->GetPosibleSelected()==true))        {
                GetManualViewBaseContour()->InitMove(x,y,z);
                SetState(6);
        }
-       
+
        // if the firs time create 4 control points and move one point
        int size=GetManualViewBaseContour()->GetNumberOfPoints();
        if (GetState()==0) {
@@ -68,7 +68,7 @@ void manualRoiControler::MouseClickLeft(int x, int y){
                        SetState(1);
                }
        }
-       
+
 /*EED 21 Avril 2009
        if (GetState()==0) {
                if (size==0){
@@ -86,18 +86,21 @@ void manualRoiControler::MouseClickLeft(int x, int y){
                SetState(5);
        }
 */
-       
+
        GetManualViewBaseContour()->Refresh();
 }
 
 // ----------------------------------------------------------------------------
 void manualRoiControler::MouseMove(int x, int y) // virtual
 {
+
+    printf("manualRoiControler::MouseClickLeft %d %d\n",x ,y);
+
        int z=GetZ();
 
 //     this->_vtkInteractorStyleBaseView->
 
-                  
+
        GetManualViewBaseContour()->SelectPosibleContour(x,y,z);
        GetManualViewBaseContour()->SelectPosiblePoint(x,y,z);