]> Creatis software - creaMaracasVisu.git/commitdiff
#3465 SetwxVtkBaseViewSetOpacityAxis box
authorEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Thu, 10 Jun 2021 07:31:27 +0000 (09:31 +0200)
committerEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Thu, 10 Jun 2021 07:31:27 +0000 (09:31 +0200)
bbtk/src/bbcreaMaracasVisuSetwxVtkBaseViewSetOpacityAxis.cxx [new file with mode: 0644]
bbtk/src/bbcreaMaracasVisuSetwxVtkBaseViewSetOpacityAxis.h [new file with mode: 0644]
lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageView.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR2DView.cxx

diff --git a/bbtk/src/bbcreaMaracasVisuSetwxVtkBaseViewSetOpacityAxis.cxx b/bbtk/src/bbcreaMaracasVisuSetwxVtkBaseViewSetOpacityAxis.cxx
new file mode 100644 (file)
index 0000000..cae0c2f
--- /dev/null
@@ -0,0 +1,87 @@
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+#include "bbcreaMaracasVisuSetwxVtkBaseViewSetOpacityAxis.h"
+#include "bbcreaMaracasVisuPackage.h"
+
+#include <wxMPRBaseData.h>
+
+namespace bbcreaMaracasVisu
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,SetwxVtkBaseViewSetOpacityAxis)
+BBTK_BLACK_BOX_IMPLEMENTATION(SetwxVtkBaseViewSetOpacityAxis,bbtk::AtomicBlackBox);
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+void SetwxVtkBaseViewSetOpacityAxis::Process()
+{
+
+// THE MAIN PROCESSING METHOD BODY
+//   Here we simply set the input 'In' value to the output 'Out'
+//   And print out the output value
+// INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
+//    void bbSet{Input|Output}NAME(const TYPE&)
+//    const TYPE& bbGet{Input|Output}NAME() const 
+//    Where :
+//    * NAME is the name of the input/output
+//      (the one provided in the attribute 'name' of the tag 'input')
+//    * TYPE is the C++ type of the input/output
+//      (the one provided in the attribute 'type' of the tag 'input')
+//    bbSetOutputOut( bbGetInputIn() );
+//    std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
+  
+       if (bbGetInputwxVtkBaseView()!=NULL)
+       {
+               vtkMPRBaseData* vtkmprbasedata = (vtkMPRBaseData*) (bbGetInputwxVtkBaseView()->GetVtkBaseData());
+               vtkmprbasedata->SetOpacityAxis( bbGetInputOpacity() );
+               wxCommandEvent newevent(wxEVT_COMMAND_MENU_SELECTED,12121);  // Refresh
+//EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
+#if wxMAJOR_VERSION <= 2
+               bbGetInputwxVtkBaseView()->GetWxVTKRenderWindowInteractor ()->GetParent()->ProcessEvent( newevent );
+#else
+               bbGetInputwxVtkBaseView()->GetWxVTKRenderWindowInteractor ()->GetParent()->ProcessWindowEvent( newevent );
+#endif                         
+       } // bbGetInputwxVtkBaseView  
+}
+
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+void SetwxVtkBaseViewSetOpacityAxis::bbUserSetDefaultValues()
+{
+
+//  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
+//    Here we initialize the input 'In' to 0
+  bbSetInputOpacity( 1 ) ;  
+  bbSetInputwxVtkBaseView( NULL ) ;  
+}
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+void SetwxVtkBaseViewSetOpacityAxis::bbUserInitializeProcessing()
+{
+
+//  THE INITIALIZATION METHOD BODY :
+//    Here does nothing 
+//    but this is where you should allocate the internal/output pointers 
+//    if any 
+
+  
+}
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+void SetwxVtkBaseViewSetOpacityAxis::bbUserFinalizeProcessing()
+{
+
+//  THE FINALIZATION METHOD BODY :
+//    Here does nothing 
+//    but this is where you should desallocate the internal/output pointers 
+//    if any
+  
+}
+}
+// EO namespace bbcreaMaracasVisu
+
+
diff --git a/bbtk/src/bbcreaMaracasVisuSetwxVtkBaseViewSetOpacityAxis.h b/bbtk/src/bbcreaMaracasVisuSetwxVtkBaseViewSetOpacityAxis.h
new file mode 100644 (file)
index 0000000..57257ca
--- /dev/null
@@ -0,0 +1,49 @@
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+#ifndef __bbcreaMaracasVisuSetwxVtkBaseViewSetOpacityAxis_h_INCLUDED__
+#define __bbcreaMaracasVisuSetwxVtkBaseViewSetOpacityAxis_h_INCLUDED__
+
+#include "bbcreaMaracasVisu_EXPORT.h"
+#include "bbtkAtomicBlackBox.h"
+#include "iostream"
+
+#include "wxVtkBaseView.h"
+
+namespace bbcreaMaracasVisu
+{
+
+class bbcreaMaracasVisu_EXPORT SetwxVtkBaseViewSetOpacityAxis
+ : 
+   public bbtk::AtomicBlackBox
+{
+  BBTK_BLACK_BOX_INTERFACE(SetwxVtkBaseViewSetOpacityAxis,bbtk::AtomicBlackBox);
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+  BBTK_DECLARE_INPUT(Opacity,double);
+  BBTK_DECLARE_INPUT(wxVtkBaseView,wxVtkBaseView*);
+  BBTK_PROCESS(Process);
+  void Process();
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+};
+
+BBTK_BEGIN_DESCRIBE_BLACK_BOX(SetwxVtkBaseViewSetOpacityAxis,bbtk::AtomicBlackBox);
+  BBTK_NAME("SetwxVtkBaseViewSetOpacityAxis");
+  BBTK_AUTHOR("InfoDev");
+  BBTK_DESCRIPTION("No Description.");
+  BBTK_CATEGORY("empty");
+  BBTK_INPUT(SetwxVtkBaseViewSetOpacityAxis,Opacity,"Axis opacity",double,"");
+  BBTK_INPUT(SetwxVtkBaseViewSetOpacityAxis,wxVtkBaseView,"wxVtkBaseView",wxVtkBaseView*,"");
+//  BBTK_OUTPUT(SetPosition,Out,"First output",double,"");
+BBTK_END_DESCRIBE_BLACK_BOX(SetwxVtkBaseViewSetOpacityAxis);
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+}
+// EO namespace bbcreaMaracasVisu
+
+#endif // __bbcreaMaracasVisuSetwxVtkBaseViewSetOpacityAxis_h_INCLUDED__
+
index 3d848abee2afa6857b50a3fca8f74a69b46af89b..0ac45b649d867a372e35e754caa7e9305a67a290 100644 (file)
@@ -371,6 +371,12 @@ void ColorLayerImageView::ConfigLookupTable()  // virtual
   thresholdTable_range[0]= GetGreyLevelBoundaries(0);
 
   thresholdTable->SetTableRange(thresholdTable_range); 
+
+  thresholdTable->SetBelowRangeColor(1,1,1,0);  // White transparent 
+  thresholdTable->SetAboveRangeColor(1,1,1,0);  // White transparent 
+  thresholdTable->UseBelowRangeColorOn();
+  thresholdTable->UseAboveRangeColorOn();
+  
   thresholdTable->SetAlphaRange( 0,1 );
   thresholdTable->SetValueRange( 0,1 );
 
index f25333358eea03391346789dcde9ed9cc6953a28..bbb02ec611eaa1866393db0d064aea43ffcf52d1 100644 (file)
@@ -252,9 +252,9 @@ void wxVtkMPR2DView::SetVisibleAxis(bool ok)
 //-------------------------------------------------------------------
 void wxVtkMPR2DView::ResetBackXYZ()
 {
-       _backX=-9999;
-       _backY=-9999;
-       _backZ=-9999;
+       _backX = -9999;
+       _backY = -9999;
+       _backZ = -9999;
 }
 
 
@@ -320,10 +320,10 @@ void wxVtkMPR2DView::Refresh()
                                //_ptsA->SetPoint(1, x2, y2  , z );
                                //_ptsB->SetPoint(0, x2, y   , z1);
                                //_ptsB->SetPoint(1, x2, y   , z2);
-                               _ptsA->SetPoint(0, xx2, yy1  , z  );
-                               _ptsA->SetPoint(1, xx2, yy2  , z  );
-                               _ptsB->SetPoint(0, xx2, y    , zz1);
-                               _ptsB->SetPoint(1, xx2, y    , zz2);
+                               _ptsA->SetPoint(0, xx2+1, yy1  , z  );
+                               _ptsA->SetPoint(1, xx2+1, yy2  , z  );
+                               _ptsB->SetPoint(0, xx2+1, y    , zz1);
+                               _ptsB->SetPoint(1, xx2+1, y    , zz2);
                                position[1]             = y;    
                                position[2]             = z;    
                                focalpoint[1]   = y;    
@@ -339,10 +339,10 @@ void wxVtkMPR2DView::Refresh()
                                //_ptsA->SetPoint(1, x2 , y2 , z );
                                //_ptsB->SetPoint(0, x  , y2 , z1);
                                //_ptsB->SetPoint(1, x  , y2 , z2);
-                           _ptsA->SetPoint(0, xx1 , y1 , z  );
-                               _ptsA->SetPoint(1, xx2 , y1 , z  );
-                               _ptsB->SetPoint(0, x   , y1 , zz1);
-                               _ptsB->SetPoint(1, x   , y1 , zz2);
+                           _ptsA->SetPoint(0, xx1 , y1-1 , z  );
+                               _ptsA->SetPoint(1, xx2 , y1-1 , z  );
+                               _ptsB->SetPoint(0, x   , y1-1 , zz1);
+                               _ptsB->SetPoint(1, x   , y1-1 , zz2);
                                position[0]             = x;    
                                position[2]             = z;    
                                focalpoint[0]   = x;    
@@ -364,10 +364,12 @@ void wxVtkMPR2DView::Refresh()
                                //_ptsA->SetPoint(1, x2 , y , z2 );
                                //_ptsB->SetPoint(0, x  , y1, z2 );
                                //_ptsB->SetPoint(1, x  , y2, z2 );
-                               _ptsA->SetPoint(0, xx1 , y  , z1 );
-                               _ptsA->SetPoint(1, xx2 , y  , z1 );
-                               _ptsB->SetPoint(0, x   , yy1, z1 );
-                               _ptsB->SetPoint(1, x   , yy2, z1 );
+
+                               _ptsA->SetPoint(0, xx1 , y  , z1-1 );
+                               _ptsA->SetPoint(1, xx2 , y  , z1-1 );
+                               _ptsB->SetPoint(0, x   , yy1, z1-1 );
+                               _ptsB->SetPoint(1, x   , yy2, z1-1 );
+                               
                                position[0]             = x;    
                                position[1]             = y;    
                                focalpoint[0]   = x;