From 7bb4a2e269e8fc5d9344ddf5acdd6ef6a63409f5 Mon Sep 17 00:00:00 2001 From: "eduardo.davila@creatis.insa-lyon.fr" Date: Fri, 12 Jan 2024 17:52:46 +0100 Subject: [PATCH] #3388 wxContourMainFrame_tool box BBTK --- .../bbcreaContourswxContourMainFrame_tool.cxx | 15 +++++++++++++- .../bbcreaContourswxContourMainFrame_tool.h | 2 +- .../wxContourMainFrame.cxx | 20 ++++++++----------- .../wxContourMainFrame.h | 8 ++++---- 4 files changed, 27 insertions(+), 18 deletions(-) diff --git a/bbtk/src/bbcreaContourswxContourMainFrame_tool.cxx b/bbtk/src/bbcreaContourswxContourMainFrame_tool.cxx index ede2c0c..aa05239 100644 --- a/bbtk/src/bbcreaContourswxContourMainFrame_tool.cxx +++ b/bbtk/src/bbcreaContourswxContourMainFrame_tool.cxx @@ -37,7 +37,20 @@ void wxContourMainFrame_tool::Process() { if (bbGetInputImage()!=NULL) { - wxContourMainFrame::getInstance()->onSegmentationAllSlices2(10 ,128,5,2, bbGetInputImage() ); // step,isovalue,sampling,method + std::vector param1=bbGetInputParam1(); + if (param1.size()==6) + { + int step = param1[0]; + double isovalue = param1[1]; + int sampling = param1[2]; + int method = param1[3]; + int min = param1[4]; + int max = param1[5]; + wxContourMainFrame::getInstance()->onDeleteAllContours(); + wxContourMainFrame::getInstance()->onSegmentationAllSlices2(step ,isovalue,sampling,method,min,max, bbGetInputImage() ); // step,isovalue,sampling,method + } else { + printf("BBTK warnning!! wxContourMainFrame_tool box. In Type=1 the Param1 es not complite \n"); + }// size } // if Image } // Type==1 } diff --git a/bbtk/src/bbcreaContourswxContourMainFrame_tool.h b/bbtk/src/bbcreaContourswxContourMainFrame_tool.h index b4598f1..f5fc404 100644 --- a/bbtk/src/bbcreaContourswxContourMainFrame_tool.h +++ b/bbtk/src/bbcreaContourswxContourMainFrame_tool.h @@ -39,7 +39,7 @@ BBTK_BEGIN_DESCRIBE_BLACK_BOX(wxContourMainFrame_tool,bbtk::AtomicBlackBox); 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,Param1,"List of parameters Type1:[step,isovalue,sampling,method,min,max] ", std::vector,""); BBTK_INPUT(wxContourMainFrame_tool,Image,"Image", vtkImageData*,""); // BBTK_OUTPUT(wxContourMainFrame_tool,Out,"First output",double,""); BBTK_END_DESCRIBE_BLACK_BOX(wxContourMainFrame_tool); diff --git a/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx b/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx index 986a08e..92600cd 100644 --- a/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx +++ b/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx @@ -1710,7 +1710,7 @@ void wxContourMainFrame::SegmentationOneSliceITK(int x, int y, int z, wxString d } -void wxContourMainFrame::onSegmentationOneSlice(int isovalue,int sampling,int method){ +void wxContourMainFrame::onSegmentationOneSlice(double isovalue,int sampling,int method){ //JCP 20-10-08 Undo redo implementation saveState(); @@ -1725,7 +1725,7 @@ void wxContourMainFrame::onSegmentationOneSlice(int isovalue,int sampling,int me } -void wxContourMainFrame::SegmentationOneSlice( int x, int y, int z, int isovalue, int sampling, int method , vtkImageData *imagedata) +void wxContourMainFrame::SegmentationOneSlice( int x, int y, int z, double isovalue, int sampling, int method , vtkImageData *imagedata) { int typeofcontour = 1; //--Extracting Contour @@ -1977,10 +1977,8 @@ void wxContourMainFrame::GetImageDataRange(double *range) _theViewPanel->GetImageDataRange(range); } -void wxContourMainFrame::onSegmentationAllSlices2(int step ,int isovalue,int sampling,int method,vtkImageData* imagedata) +void wxContourMainFrame::onSegmentationAllSlices2(int step ,double isovalue,int sampling,int method,int minZ, int maxZ,vtkImageData* imagedata) { - printf("wxContourMainFrame::onSegmentationAllSlices2 start\n"); - //JCP 20-10-08 Undo redo implementation saveState(); //JCP 20-10-08 Undo redo implementation @@ -1991,13 +1989,13 @@ void wxContourMainFrame::onSegmentationAllSlices2(int step ,int isovalue,int sam // 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 ) + int sizeZ = ext[5]-ext[4]+1; + if (minZ<0) { minZ=0; } + if (maxZ>=sizeZ) { maxZ=sizeZ-1; } + for( z=minZ ; 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); @@ -2006,11 +2004,9 @@ void wxContourMainFrame::onSegmentationAllSlices2(int step ,int isovalue,int sam } // interfMainPanel::getInstance()->setLabelSegmentationPanelVTK(_T(" ")); RefreshInterface(); - printf("wxContourMainFrame::onSegmentationAllSlices2 end\n"); - } -void wxContourMainFrame::onSegmentationAllSlices(int minZ,int maxZ,int isovalue,int sampling,int method) +void wxContourMainFrame::onSegmentationAllSlices(int minZ,int maxZ,double isovalue,int sampling,int method) { //JCP 20-10-08 Undo redo implementation saveState(); diff --git a/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h b/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h index c2cd51e..a6c6105 100644 --- a/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h +++ b/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h @@ -213,15 +213,15 @@ class wxContourMainFrame : public wxPanel { void openContours( FILE *pFile, FILE *pFileData, bool staticContour ); void RefreshInterface(); vtkImageData* getImageData(); - void onSegmentationOneSlice(int isovalue,int sampling,int method); + void onSegmentationOneSlice(double 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 , vtkImageData *imagedata); + void SegmentationOneSlice( int x, int y, int z, double 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 onSegmentationAllSlices(int minZ,int maxZ,int isovalue,int sampling,int method); - void onSegmentationAllSlices2(int step ,int isovalue,int samplsing,int method,vtkImageData* imagedata); + void onSegmentationAllSlices(int minZ,int maxZ,double isovalue,int sampling,int method); + void onSegmentationAllSlices2(int step ,double isovalue,int samplsing,int method,int minZ, int maxZ,vtkImageData* imagedata); //AD void referenceLine(); -- 2.47.1