]> Creatis software - creaContours.git/commitdiff
#3388 wxContourMainFrame_tool box BBTK
authoreduardo.davila@creatis.insa-lyon.fr <eduardo.davila@creatis.insa-lyon.fr>
Fri, 12 Jan 2024 16:52:46 +0000 (17:52 +0100)
committereduardo.davila@creatis.insa-lyon.fr <eduardo.davila@creatis.insa-lyon.fr>
Fri, 12 Jan 2024 16:52:46 +0000 (17:52 +0100)
bbtk/src/bbcreaContourswxContourMainFrame_tool.cxx
bbtk/src/bbcreaContourswxContourMainFrame_tool.h
lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx
lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h

index ede2c0cbb245d4e4c27162e1db27e29a76669713..aa05239e7eea5c372e24a728bde5a97b60448ef3 100644 (file)
@@ -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<double> 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
     }
index b4598f18608b8c42139c41f2dc2dca146d938aa7..f5fc404637b34f233f4a51fb1429bec86387a5d1 100644 (file)
@@ -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<double>,"");
+  BBTK_INPUT(wxContourMainFrame_tool,Param1,"List of parameters  Type1:[step,isovalue,sampling,method,min,max] ", std::vector<double>,"");
   BBTK_INPUT(wxContourMainFrame_tool,Image,"Image", vtkImageData*,"");
 //  BBTK_OUTPUT(wxContourMainFrame_tool,Out,"First output",double,"");
 BBTK_END_DESCRIBE_BLACK_BOX(wxContourMainFrame_tool);
index 986a08ef45278f6de839d0090a7d12c740a34cbb..92600cd969d8240fb56ffb7a969e0bae5f1fcf97 100644 (file)
@@ -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();
index c2cd51e967dd0bda2717a9dff5ba45debb1bbe26..a6c610564d3ee1e84120dee6e19bdf58ae17fc2a 100644 (file)
@@ -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();