From fb263161d35e038b20630dbf6566df07777ec027 Mon Sep 17 00:00:00 2001 From: Eduardo DAVILA Date: Wed, 2 Dec 2020 16:17:05 +0100 Subject: [PATCH] SetColorImage update --- bbtk/src/bbcreaContoursSetColorLayerImage.cxx | 96 +++++++++++++++++++ bbtk/src/bbcreaContoursSetColorLayerImage.h | 53 ++++++++++ .../wxContourMainFrame.cxx | 24 +++-- .../wxContourMainFrame.h | 1 + 4 files changed, 168 insertions(+), 6 deletions(-) create mode 100644 bbtk/src/bbcreaContoursSetColorLayerImage.cxx create mode 100644 bbtk/src/bbcreaContoursSetColorLayerImage.h diff --git a/bbtk/src/bbcreaContoursSetColorLayerImage.cxx b/bbtk/src/bbcreaContoursSetColorLayerImage.cxx new file mode 100644 index 0000000..781eb23 --- /dev/null +++ b/bbtk/src/bbcreaContoursSetColorLayerImage.cxx @@ -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 = " <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 index 0000000..8d93241 --- /dev/null +++ b/bbtk/src/bbcreaContoursSetColorLayerImage.h @@ -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__ + diff --git a/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx b/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx index 1ce5849..c0b9dd2 100644 --- a/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx +++ b/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx @@ -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 colorbarposition; colorbarposition.push_back( 10 ); diff --git a/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h b/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h index 3e31bbd..9a49da6 100644 --- a/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h +++ b/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h @@ -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----------------------------------------------------------------------------------------------- -- 2.47.1