]> Creatis software - creaContours.git/commitdiff
SetColorImage update
authorEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Wed, 2 Dec 2020 15:17:05 +0000 (16:17 +0100)
committerEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Wed, 2 Dec 2020 15:17:05 +0000 (16:17 +0100)
bbtk/src/bbcreaContoursSetColorLayerImage.cxx [new file with mode: 0644]
bbtk/src/bbcreaContoursSetColorLayerImage.h [new file with mode: 0644]
lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx
lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h

diff --git a/bbtk/src/bbcreaContoursSetColorLayerImage.cxx b/bbtk/src/bbcreaContoursSetColorLayerImage.cxx
new file mode 100644 (file)
index 0000000..781eb23
--- /dev/null
@@ -0,0 +1,96 @@
+//===== 
+// 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 "bbcreaContoursSetColorLayerImage.h"
+#include "bbcreaContoursPackage.h"
+
+#include "wxContourMainFrame.h"
+
+namespace bbcreaContours
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaContours,SetColorLayerImage)
+BBTK_BLACK_BOX_IMPLEMENTATION(SetColorLayerImage,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 SetColorLayerImage::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 (wxContourMainFrame::getInstance()!=NULL)
+       { 
+               if (bbGetInputIn()!=NULL) 
+               {
+                       wxContourMainFrame::getInstance()->SetColorLayerImage( bbGetInputIn() );
+               } // InputIn
+/*     
+               if (wxContourMainFrame::getInstance()->GetFileLocation().empty()==true)
+               {
+                       wxContourMainFrame::getInstance()->SetFileLocation(bbGetInputFileLocation() );
+               }else {
+                       wxContourMainFrame::getInstance()->onSave();
+                       wxContourMainFrame::getInstance()->deleteAllContours();
+                       wxContourMainFrame::getInstance()->SetFileLocation(bbGetInputFileLocation() );
+               } // if FileLocaton
+
+               wxContourMainFrame::getInstance()->onLoad();
+               wxContourMainFrame::getInstance()->RefreshInterface();
+*/             
+       } // if Instance
+}
+//===== 
+// 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 SetColorLayerImage::bbUserSetDefaultValues()
+{
+
+//  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
+//    Here we initialize the input 'In' to 0
+   bbSetInputIn(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 SetColorLayerImage::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 SetColorLayerImage::bbUserFinalizeProcessing()
+{
+
+//  THE FINALIZATION METHOD BODY :
+//    Here does nothing 
+//    but this is where you should desallocate the internal/output pointers 
+//    if any
+  
+}
+}
+// EO namespace bbcreaContours
+
+
diff --git a/bbtk/src/bbcreaContoursSetColorLayerImage.h b/bbtk/src/bbcreaContoursSetColorLayerImage.h
new file mode 100644 (file)
index 0000000..8d93241
--- /dev/null
@@ -0,0 +1,53 @@
+//===== 
+// 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 __bbcreaContoursSetColorLayerImage_h_INCLUDED__
+#define __bbcreaContoursSetColorLayerImage_h_INCLUDED__
+
+#include "bbcreaContours_EXPORT.h"
+#include "bbtkAtomicBlackBox.h"
+#include "iostream"
+
+#include "vtkImageData.h"
+
+
+namespace bbcreaContours
+{
+
+class bbcreaContours_EXPORT SetColorLayerImage
+ : 
+   public bbtk::AtomicBlackBox
+{
+  BBTK_BLACK_BOX_INTERFACE(SetColorLayerImage,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(wxContourMainFrame,wxContourMainFrame*);
+  BBTK_DECLARE_INPUT(In,vtkImageData*);
+//  BBTK_DECLARE_OUTPUT(Out,double);
+  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(SetColorLayerImage,bbtk::AtomicBlackBox);
+  BBTK_NAME("SetColorLayerImage");
+  BBTK_AUTHOR("InfoDev");
+  BBTK_DESCRIPTION("No Description.");
+  BBTK_CATEGORY("empty");
+
+//  BBTK_INPUT(SetColorLayerImage,wxContourMainFrame,"wxContourMainFrame",wxContourMainFrame*,"");
+  BBTK_INPUT(SetColorLayerImage,In,"Input image",vtkImageData*,"");
+//  BBTK_OUTPUT(SetColorLayerImage,Out,"First output",double,"");
+BBTK_END_DESCRIBE_BLACK_BOX(SetColorLayerImage);
+//===== 
+// 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 bbcreaContours
+
+#endif // __bbcreaContoursSetColorLayerImage_h_INCLUDED__
+
index 1ce584994fc26d25f27de8c341be8249d293c964..c0b9dd263a2d008a69bc51d548ac0b3d5645362b 100644 (file)
@@ -3178,6 +3178,17 @@ wxPanel *wxContourMainFrame::getColorLayerImageViewPanel(wxWindow *parent)
        return _viewColorLayerImagePanel;
 }
 
+void wxContourMainFrame::SetColorLayerImage(vtkImageData* img)
+{
+       if (_viewColorLayerImagePanel!=NULL) 
+       {
+               if (img!=NULL)
+               {
+                       _viewColorLayerImagePanel->SetImage( img );
+                       RefreshInterface();
+               } // img
+       } // _viewColorLayerImagePanel
+}
 
 wxPanel *wxContourMainFrame::getThresholdImageViewPanel(wxWindow *parent)
 {
@@ -3185,13 +3196,14 @@ wxPanel *wxContourMainFrame::getThresholdImageViewPanel(wxWindow *parent)
        {
                double range[2];
                _theViewPanel->getImageData()->GetScalarRange(range);
-               int min = (int)floor (range[0]);
-               int max = (int)ceil (range[1]);
-               int start= (max+min)/2 - (max-min)*0.25; 
-               int end= (max+min)/2 + (max-min)*0.25; 
-               _viewThresholdImagePanel = new ThresholdImageViewPanel( parent, min, max, start, end , 1);
-               _viewThresholdImage = new ThresholdImageView();
+               int min                                         = (int)floor (range[0]);
+               int max                                         = (int)ceil (range[1]);
+               int start                                       = (max+min)/2 - (max-min)*0.25; 
+               int end                                         = (max+min)/2 + (max-min)*0.25; 
+               _viewThresholdImagePanel        = new ThresholdImageViewPanel( parent, min, max, start, end , 1);
+               _viewThresholdImage             = new ThresholdImageView();
                _viewThresholdImage->SetminMaxValue(start,end);
+//             _viewThresholdImage->SetminMaxValue(range[0],range[1]);
                _viewThresholdImage->SetImage( _theViewPanel->getImageData() );
                std::vector<int> colorbarposition;
                colorbarposition.push_back( 10 );
index 3e31bbd1a7a3542d77c138ba78d6232e74861d45..9a49da6b1599c50f3ab1360deabb5de70c797fd7 100644 (file)
@@ -272,6 +272,7 @@ class wxContourMainFrame : public wxPanel {
        void    SetContourGroup(int contourGroup);
        wxPanel *getThresholdImageViewPanel(wxWindow *parent);
        wxPanel *getColorLayerImageViewPanel(wxWindow *parent);
+       void    SetColorLayerImage(vtkImageData*);
 
 //CMRU 17-08-09-----------------------------------------------------------------------------------------------