From: eduardo.davila@creatis.insa-lyon.fr Date: Tue, 9 Jan 2024 17:32:15 +0000 (+0100) Subject: #3388 wxContourMainFrame_tool box BBTK X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=86f5e10e3c87848b546e96700c4d94233246c94e;p=creaContours.git #3388 wxContourMainFrame_tool box BBTK --- diff --git a/bbtk/src/bbcreaContoursSetColorLayerImage.cxx b/bbtk/src/bbcreaContoursSetColorLayerImage.cxx index c9dc9f8..430ac4f 100644 --- a/bbtk/src/bbcreaContoursSetColorLayerImage.cxx +++ b/bbtk/src/bbcreaContoursSetColorLayerImage.cxx @@ -16,7 +16,6 @@ BBTK_BLACK_BOX_IMPLEMENTATION(SetColorLayerImage,bbtk::AtomicBlackBox); //===== 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 @@ -40,45 +39,40 @@ void SetColorLayerImage::Process() wxcontourmainframe->SetColorLayerImage( bbGetInputIn() ); } // InputIn } // 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 - - +// 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 + +}// EO namespace bbcreaContours diff --git a/bbtk/src/bbcreaContoursSetFileLocation.cxx b/bbtk/src/bbcreaContoursSetFileLocation.cxx index fde62e0..d05a301 100644 --- a/bbtk/src/bbcreaContoursSetFileLocation.cxx +++ b/bbtk/src/bbcreaContoursSetFileLocation.cxx @@ -11,12 +11,12 @@ namespace bbcreaContours BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaContours,SetFileLocation) BBTK_BLACK_BOX_IMPLEMENTATION(SetFileLocation,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 SetFileLocation::Process() { - // THE MAIN PROCESSING METHOD BODY // Here we simply set the input 'In' value to the output 'Out' // And print out the output value @@ -31,8 +31,6 @@ void SetFileLocation::Process() // bbSetOutputOut( bbGetInputIn() ); // std::cout << "Output value = " <GetFileLocation().empty()==true) @@ -43,49 +41,43 @@ void SetFileLocation::Process() wxContourMainFrame::getInstance()->deleteAllContours(); wxContourMainFrame::getInstance()->SetFileLocation( bbGetInputFileLocation() ); } // if FileLocaton - wxContourMainFrame::getInstance()->onLoad( false ); - 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 SetFileLocation::bbUserSetDefaultValues() { - // SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX // Here we initialize the input 'In' to 0 bbSetInputFileLocation(""); - } -//===== + +//===== // 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 SetFileLocation::bbUserInitializeProcessing() { - // THE INITIALIZATION METHOD BODY : // Here does nothing // but this is where you should allocate the internal/output pointers -// if any - - +// 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 SetFileLocation::bbUserFinalizeProcessing() { - // THE FINALIZATION METHOD BODY : // Here does nothing // but this is where you should desallocate the internal/output pointers // if any - } -} -// EO namespace bbcreaContours + +}// EO namespace bbcreaContours diff --git a/bbtk/src/bbcreaContourswxContourMainFrame_tool.cxx b/bbtk/src/bbcreaContourswxContourMainFrame_tool.cxx new file mode 100644 index 0000000..ede2c0c --- /dev/null +++ b/bbtk/src/bbcreaContourswxContourMainFrame_tool.cxx @@ -0,0 +1,79 @@ +//===== +// 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 "bbcreaContourswxContourMainFrame_tool.h" +#include "bbcreaContoursPackage.h" + +#include "wxContourMainFrame.h" + +namespace bbcreaContours +{ + +BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaContours,wxContourMainFrame_tool) +BBTK_BLACK_BOX_IMPLEMENTATION(wxContourMainFrame_tool,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 wxContourMainFrame_tool::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 = " <onSegmentationAllSlices2(10 ,128,5,2, bbGetInputImage() ); // step,isovalue,sampling,method + } // if Image + } // Type==1 + } + +} +//===== +// 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 wxContourMainFrame_tool::bbUserSetDefaultValues() +{ +// SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX +// Here we initialize the input 'In' to 0 + bbSetInputType(0); + bbSetInputImage(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 wxContourMainFrame_tool::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 wxContourMainFrame_tool::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/bbcreaContourswxContourMainFrame_tool.h b/bbtk/src/bbcreaContourswxContourMainFrame_tool.h new file mode 100644 index 0000000..b4598f1 --- /dev/null +++ b/bbtk/src/bbcreaContourswxContourMainFrame_tool.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 __bbcreaContourswxContourMainFrame_tool_h_INCLUDED__ +#define __bbcreaContourswxContourMainFrame_tool_h_INCLUDED__ + +#include "bbcreaContours_EXPORT.h" +#include "bbtkAtomicBlackBox.h" +#include "iostream" + +#include "vtkImageData.h" + +namespace bbcreaContours +{ + +class bbcreaContours_EXPORT wxContourMainFrame_tool + : + public bbtk::AtomicBlackBox +{ + BBTK_BLACK_BOX_INTERFACE(wxContourMainFrame_tool,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( Type , int ); + BBTK_DECLARE_INPUT( Param1, std::vector ); + BBTK_DECLARE_INPUT( Image , 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(wxContourMainFrame_tool,bbtk::AtomicBlackBox); + BBTK_NAME("wxContourMainFrame_tool"); + BBTK_AUTHOR("InfoDev"); + BBTK_DESCRIPTION("No Description."); + BBTK_CATEGORY("empty"); + BBTK_INPUT(wxContourMainFrame_tool,Type,"(default 0) Type 0:nothing 1:Isovalue segmentation of Image",int,""); + BBTK_INPUT(wxContourMainFrame_tool,Param1,"List of parameters Type1:[isovalue] ", std::vector,""); + BBTK_INPUT(wxContourMainFrame_tool,Image,"Image", vtkImageData*,""); +// BBTK_OUTPUT(wxContourMainFrame_tool,Out,"First output",double,""); +BBTK_END_DESCRIBE_BLACK_BOX(wxContourMainFrame_tool); +//===== +// 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 // __bbcreaContourswxContourMainFrame_tool_h_INCLUDED__ + diff --git a/lib/Interface_Icons_NDimensions/interfMainPanel.cxx b/lib/Interface_Icons_NDimensions/interfMainPanel.cxx index 4aeacae..34b3e74 100644 --- a/lib/Interface_Icons_NDimensions/interfMainPanel.cxx +++ b/lib/Interface_Icons_NDimensions/interfMainPanel.cxx @@ -520,9 +520,9 @@ int interfMainPanel::GetImageDataSizeZ() return wxContourMainFrame::getInstance()->GetImageDataSizeZ(); } -void interfMainPanel::onSegmentationAllSlice(int minZ,int maxZ,int isovalue,int sampling,int method) +void interfMainPanel::onSegmentationAllSlices(int minZ,int maxZ,int isovalue,int sampling,int method) { - wxContourMainFrame::getInstance()->onSegmentationAllSlice(minZ, maxZ,isovalue,sampling,method); + wxContourMainFrame::getInstance()->onSegmentationAllSlices(minZ, maxZ,isovalue,sampling,method); } void interfMainPanel::setLabelSegmentationPanelVTK(wxString tmpString) diff --git a/lib/Interface_Icons_NDimensions/interfMainPanel.h b/lib/Interface_Icons_NDimensions/interfMainPanel.h index 25a0fda..e6eb6e8 100644 --- a/lib/Interface_Icons_NDimensions/interfMainPanel.h +++ b/lib/Interface_Icons_NDimensions/interfMainPanel.h @@ -152,7 +152,7 @@ public: void onSegmentationOneSlice(int isovalue,int sampling,int method); void onSegmentationOneSliceITK(wxString distance, wxString sigma, wxString alfa, wxString beta, wxString propagation, wxString iterations, wxString inflation); int GetImageDataSizeZ(); - void onSegmentationAllSlice(int minZ,int maxZ,int isovalue,int sampling,int method); + void onSegmentationAllSlices(int minZ,int maxZ,int isovalue,int sampling,int method); void onMirrorPressed(); void onMirror(); void onMirrorAxisShow(); diff --git a/lib/Interface_Icons_NDimensions/interfSegmentationPanels.cxx b/lib/Interface_Icons_NDimensions/interfSegmentationPanels.cxx index 5578696..3e137cd 100644 --- a/lib/Interface_Icons_NDimensions/interfSegmentationPanels.cxx +++ b/lib/Interface_Icons_NDimensions/interfSegmentationPanels.cxx @@ -126,7 +126,7 @@ void interfSegmentationPanelVTK::onSegmentationAllSlice( wxCommandEvent& event ) int isovalue = _isovalue->GetValue(); int sampling = _sampling->GetValue(); int method = methodRadiobox->GetSelection(); - interfMainPanel::getInstance()->onSegmentationAllSlice(minZ, maxZ, isovalue, sampling, method); + interfMainPanel::getInstance()->onSegmentationAllSlices(minZ, maxZ, isovalue, sampling, method); } void interfSegmentationPanelVTK::setLabel(wxString tmpString) diff --git a/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx b/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx index 9dffcd6..986a08e 100644 --- a/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx +++ b/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx @@ -1720,16 +1720,17 @@ void wxContourMainFrame::onSegmentationOneSlice(int isovalue,int sampling,int me int x = _theViewPanel->GetX(); int y = _theViewPanel->GetY(); int z = _theViewPanel->GetZ(); - SegmentationOneSlice( x,y,z,isovalue, sampling, method ); + SegmentationOneSlice( x,y,z,isovalue, sampling, method , getImageData() ); RefreshInterface(); } -void wxContourMainFrame::SegmentationOneSlice( int x, int y, int z, int isovalue, int sampling, int method ) +void wxContourMainFrame::SegmentationOneSlice( int x, int y, int z, int isovalue, int sampling, int method , vtkImageData *imagedata) { int typeofcontour = 1; //--Extracting Contour - vtkImageData *imagedata = getImageData(); +// 2024-01-09 +// vtkImageData *imagedata = getImageData(); vtkImageReslice *imageReslice = vtkImageReslice::New(); //EED @@ -1976,7 +1977,40 @@ void wxContourMainFrame::GetImageDataRange(double *range) _theViewPanel->GetImageDataRange(range); } -void wxContourMainFrame::onSegmentationAllSlice(int minZ,int maxZ,int isovalue,int sampling,int method) +void wxContourMainFrame::onSegmentationAllSlices2(int step ,int isovalue,int sampling,int method,vtkImageData* imagedata) +{ + printf("wxContourMainFrame::onSegmentationAllSlices2 start\n"); + + //JCP 20-10-08 Undo redo implementation + saveState(); + //JCP 20-10-08 Undo redo implementation + wxBusyCursor wait; +// int x = _theViewPanel->GetX(); +// int y = _theViewPanel->GetY(); + int z; +// double porcent; +// wxString tmpString; +// double totalZ = maxZ-minZ+1; + + int ext[6]; + imagedata->GetExtent(ext); + int maxZ = ext[5]-ext[4]+1; + for( z=0 ; z<=maxZ ; z=z+step ) + { + printf("wxContourMainFrame::onSegmentationAllSlices2 z=%d \n",z ); +// porcent = 100.0* (z-minZ)/totalZ; +// tmpString.Printf(_T(" %d %c %d/%d %d"), (int)porcent , 37 , z-minZ+1, (int)totalZ,z ); +// interfMainPanel::getInstance()->setLabelSegmentationPanelVTK(tmpString); + //_staticTextSegmentation->SetLabel(tmpString); + SegmentationOneSlice( 100,100,z,isovalue, sampling,method , imagedata ); + } +// interfMainPanel::getInstance()->setLabelSegmentationPanelVTK(_T(" ")); + RefreshInterface(); + printf("wxContourMainFrame::onSegmentationAllSlices2 end\n"); + +} + +void wxContourMainFrame::onSegmentationAllSlices(int minZ,int maxZ,int isovalue,int sampling,int method) { //JCP 20-10-08 Undo redo implementation saveState(); @@ -1995,7 +2029,7 @@ void wxContourMainFrame::onSegmentationAllSlice(int minZ,int maxZ,int isovalue,i tmpString.Printf(_T(" %d %c %d/%d %d"), (int)porcent , 37 , z-minZ+1, (int)totalZ,z ); interfMainPanel::getInstance()->setLabelSegmentationPanelVTK(tmpString); //_staticTextSegmentation->SetLabel(tmpString); - SegmentationOneSlice( x,y,z,isovalue, sampling,method ); + SegmentationOneSlice( x,y,z,isovalue, sampling,method , getImageData() ); } interfMainPanel::getInstance()->setLabelSegmentationPanelVTK(_T(" ")); RefreshInterface(); diff --git a/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h b/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h index 7b80e5b..c2cd51e 100644 --- a/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h +++ b/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h @@ -215,12 +215,13 @@ class wxContourMainFrame : public wxPanel { vtkImageData* getImageData(); void onSegmentationOneSlice(int isovalue,int sampling,int method); void onSegmentationOneSliceITK(wxString distance, wxString sigma, wxString alfa, wxString beta, wxString propagation, wxString iterations, wxString inflation); - void SegmentationOneSlice( int x, int y, int z, int isovalue, int sampling, int method ); + void SegmentationOneSlice( int x, int y, int z, int isovalue, int sampling, int method , vtkImageData *imagedata); void SegmentationOneSliceITK(int x, int y, int z, wxString distance, wxString sigma, wxString alfa, wxString beta, wxString propagation, wxString iterations, wxString inflation); void Mirror( int x, int y, int z, int isovalue, int sampling, int method ); int GetImageDataSizeZ(); void GetImageDataRange(double *range); - void onSegmentationAllSlice(int minZ,int maxZ,int isovalue,int sampling,int method); + void onSegmentationAllSlices(int minZ,int maxZ,int isovalue,int sampling,int method); + void onSegmentationAllSlices2(int step ,int isovalue,int samplsing,int method,vtkImageData* imagedata); //AD void referenceLine();