]> Creatis software - creaMaracasVisu.git/commitdiff
2315 creaMaracasVisu Feature New Normal Color Layer synchronisation
authorEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Mon, 24 Feb 2014 15:16:58 +0000 (16:16 +0100)
committerEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Mon, 24 Feb 2014 15:16:58 +0000 (16:16 +0100)
lib/maracasVisuLib/CMakeLists.txt
lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.h

index 4929a371bad173f7d95847725bbabfdefc965c6c..fe7909c9be782b8c27157cc3140f8bd140843fbc 100644 (file)
@@ -63,6 +63,7 @@ IF ( BUILD_${LIBRARY_NAME} )
   #FILE(GLOB ${LIBRARY_NAME}_HEADERS "*.h")
   # OR MANUALLY LIST YOUR HEADERS WITH NEXT COMMAND
 
+
   FILE(GLOB ${LIBRARY_NAME}_HEADERS_WXWIN "src/interface/wxWindows/*.h")
   FILE(GLOB ${LIBRARY_NAME}_SOURCES_WXWIN src/interface/wxWindows/*.cxx src/interface/wxWindows/*.cpp src/interface/wxWindows/*.cc)
 
@@ -98,10 +99,10 @@ IF ( BUILD_${LIBRARY_NAME} )
   FILE(GLOB ${LIBRARY_NAME}_HEADERS_KERNEL "src/kernel/*.h")
   FILE(GLOB ${LIBRARY_NAME}_SOURCES_KERNEL src/kernel/*.cxx src/kernel/*.cpp src/kernel/*.cc)
 
-FILE(GLOB ${LIBRARY_NAME}_HEADERS_CUTMODULE src/CutModule/interface/*.h src/CutModule/kernel/*.h)
+  FILE(GLOB ${LIBRARY_NAME}_HEADERS_CUTMODULE src/CutModule/interface/*.h src/CutModule/kernel/*.h)
   FILE(GLOB ${LIBRARY_NAME}_SOURCES_CUTMODULE src/CutModule/interface/*.cxx src/CutModule/kernel/*.cxx)
 
-FILE(GLOB ${LIBRARY_NAME}_HEADERS_MARACASVISULIB_INCLUDE include/*.h )
+  FILE(GLOB ${LIBRARY_NAME}_HEADERS_MARACASVISULIB_INCLUDE include/*.h )
 
   SET ( ${LIBRARY_NAME}_HEADERS
        ${${LIBRARY_NAME}_HEADERS_WXWIN}
@@ -117,7 +118,6 @@ FILE(GLOB ${LIBRARY_NAME}_HEADERS_MARACASVISULIB_INCLUDE include/*.h )
        ${${LIBRARY_NAME}_HEADERS_CBUTTONCONTAINER}
        ${${LIBRARY_NAME}_HEADERS_CPBUTTONCONTAINER}
        ${${LIBRARY_NAME}_HEADERS_UNDO_REDO}
-       
   )
   #----------------------------------------------------------------------------
 
@@ -208,7 +208,6 @@ FILE(GLOB ${LIBRARY_NAME}_HEADERS_MARACASVISULIB_INCLUDE include/*.h )
   SET(${LIBRARY_NAME}_INSTALL_FOLDER ${LIBRARY_NAME})
 
   SET(${LIBRARY_NAME}_LIBRARIES 
-
              BaseVolumeRenderer
              BaseSurfaceRenderer
              KernelVolumeRenderer
index d340e7f71f0ff5c13a83bad8da12ac0e03b7796a..0a2ccf959eab243e9f9b3b602fe1fca641fa28d9 100644 (file)
@@ -30,6 +30,9 @@
 
 #include "LayerImageBase.h"
 
+#include "wxVtk2DBaseView.h"
+#include "wxVTKRenderWindowInteractor.h"
+
 
 //---------------------------------------------------------------------------------------------
 //---------------------------------------------------------------------------------------------
@@ -37,7 +40,9 @@
 
 ColorLayerImageBasevtkInteractor::ColorLayerImageBasevtkInteractor(LayerImageBase* layerImageBase)
 {
+    _state=false;
     _layerImageBase=layerImageBase;
+
 }
 
 //---------------------------------------------------------------------------------------------
@@ -47,15 +52,56 @@ ColorLayerImageBasevtkInteractor::~ColorLayerImageBasevtkInteractor()
 
 
 //---------------------------------------------------------------------------------------------
-bool ColorLayerImageBasevtkInteractor::OnMouseMove()
+bool ColorLayerImageBasevtkInteractor::OnMouseMove()   // vitual
 {
        printf("EED ColorLayerImageBasevtkInteractor::OnMouseMove \n");
-    if  (_vtkInteractorStyleBaseView->GetRefresh_waiting()==true)
-    {
-        _layerImageBase->GetvtkImageReslice()->Modified();
-    }
+       
+       if (_state==true)
+       {
+
+               wxVtk2DBaseView *wxvtk2Dbaseview = (wxVtk2DBaseView*) _vtkInteractorStyleBaseView->GetWxVtk2DBaseView();
+               wxVTKRenderWindowInteractor *wxVTKiren = wxvtk2Dbaseview->GetWxVTKRenderWindowInteractor();
+               int px, py;
+               wxVTKiren->GetEventPosition(px, py);
 
-    return true;
+//        int     typeView = 1;
+               double X = (double) px;
+               double Y = (double) py;
+               double Z = wxvtk2Dbaseview->GetActualSlice();
+//             wxvtk2Dbaseview->TransFromCoordScreenToWorld(X, Y, Z,true, typeView);
+               wxvtk2Dbaseview->TransFromCoordScreenToWorld(X, Y, Z, true);
+
+//             _manualPaintControler->PaintImage((int) X, (int) Y, (int) Z);
+
+               _layerImageBase->SetZ( (int)Z );
+               _layerImageBase->onThreshold();
+//             _layerImageBase->Refresh();
+
+
+               this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
+
+               if  (_vtkInteractorStyleBaseView->GetRefresh_waiting()==true)
+               {
+                               _layerImageBase->GetvtkImageReslice()->Modified();
+               }
+       printf("EED ColorLayerImageBasevtkInteractor::YESSSSSS \n");
+       }
+       return true;
+}
+
+
+bool  ColorLayerImageBasevtkInteractor::OnRightButtonDown() // virtual
+{
+       printf("EED ColorLayerImageBasevtkInteractor::OnRightButtonDown \n");
+       _state=true;
+       return true;
+}
+
+bool  ColorLayerImageBasevtkInteractor::OnRightButtonUp()  // virtual
+{
+       printf("EED ColorLayerImageBasevtkInteractor::OnRightButtonUp \n");
+       _state=false;
+       return true;
 }
 
 
@@ -173,12 +219,19 @@ int LayerImageBase::CleanZ(int z)
 //----------------------------------------------------------------------------
 void LayerImageBase::onThreshold()
 {
-       
+
        printf("EED LayerImageBase::onThreshold start \n");
        
        if ((_image!=NULL) && (_baseView!=NULL))
        {
-               int z=CleanZ( GetZ() );
+               double spc[3];
+               GetImage()-> GetSpacing(spc);
+               double  z = CleanZ( GetZ() );
+                       z = z*spc[2];
+
+       printf("EED LayerImageBase::onThreshold z = %d   spcZ%f\n" , z, spc[2]);
+               
+
 
                if (!GetActorPresent())
                {
@@ -225,7 +278,7 @@ void LayerImageBase::onThreshold()
                
                
                } // _image
-       printf("EED LayerImageBase::onThreshold end");
+       printf("EED LayerImageBase::onThreshold end \n");
 }
 
 
index 3731e9ee1db3464e11a319de1cd66874b0f1fad7..c96d748736c6114b56cfa864d4d5799bf383a055 100644 (file)
@@ -56,9 +56,12 @@ public:
        virtual ~ColorLayerImageBasevtkInteractor();
 
        virtual bool  OnMouseMove();
+       virtual bool  OnRightButtonDown();
+       virtual bool  OnRightButtonUp();
 
 private:
-    LayerImageBase* _layerImageBase;
+    bool               _state;
+    LayerImageBase*    _layerImageBase;
 
 protected: