]> Creatis software - creaContours.git/commitdiff
#3320creaContours Bug NewNormal - Segmentation PolyData Cells
authorEduardo DAVILA <davila@ei-ed-606.creatis.insa-lyon.fr>
Mon, 16 Dec 2019 15:48:58 +0000 (16:48 +0100)
committerEduardo DAVILA <davila@ei-ed-606.creatis.insa-lyon.fr>
Mon, 16 Dec 2019 15:48:58 +0000 (16:48 +0100)
bbtk/src/bbcreaContoursSetViewerPosition.cxx
bbtk/src/bbcreaContoursSetViewerPosition.h
lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx

index 365c4a0973eda1ea94297c6cde112cb2b55e55c4..582f59b576361275e2599996acecddbbf7560adb 100644 (file)
@@ -33,30 +33,35 @@ void SetViewerPosition::Process()
        {
                if (bbGetInputPosition().size()==3 )
                {
-                       int x = bbGetInputPosition()[0];
-                       int y = bbGetInputPosition()[1];
-                       int z = bbGetInputPosition()[2];
-
-                       vtkImageData *img = bbGetInputwxContourMainFrame()->getImageData();
-                       int ext[6];
+                       double                  slice;
+                       int                     x                       = bbGetInputPosition()[0];
+                       int                     y                       = bbGetInputPosition()[1];
+                       int                     z                       = bbGetInputPosition()[2];
+                       vtkImageData    *img            = bbGetInputwxContourMainFrame()->getImageData();
+                       int                     ext[6];
                        img->GetExtent(ext);
                        int dimY=ext[3]-ext[2]+1;
-
                        if (bbGetInputDirection()==0)
                        {
-                               bbGetInputwxContourMainFrame()->setConceptValue( "Axe Depth", z );
+                               slice = z;
+                               slice = round( slice/bbGetInputJump() ) * bbGetInputJump() + bbGetInputShift();
+                               bbGetInputwxContourMainFrame()->setConceptValue( "Axe Depth", slice );
                                bbGetInputwxContourMainFrame()->SetXY(x,y);
                        } // if Direction1
 
                        if (bbGetInputDirection()==1)
                        {
-                               bbGetInputwxContourMainFrame()->setConceptValue( "Axe Depth", y );
+                               slice = y;
+                               slice = round( slice/bbGetInputJump() ) * bbGetInputJump() + bbGetInputShift();
+                               bbGetInputwxContourMainFrame()->setConceptValue( "Axe Depth", slice );
                                bbGetInputwxContourMainFrame()->SetXY(x,dimY-z-1);
                        } // if Direction1
 
                        if (bbGetInputDirection()==2)
                        {
-                               bbGetInputwxContourMainFrame()->setConceptValue( "Axe Depth", x );
+                               slice = x;
+                               slice = round( slice/bbGetInputJump() ) * bbGetInputJump() + bbGetInputShift();
+                               bbGetInputwxContourMainFrame()->setConceptValue( "Axe Depth", slice );
                                bbGetInputwxContourMainFrame()->SetXY(dimY-z-1,y);
                        } // if Direction1
 
@@ -77,6 +82,8 @@ void SetViewerPosition::bbUserSetDefaultValues()
 //  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
 //    Here we initialize the input 'In' to 0
    bbSetInputDirection(0);
+   bbSetInputJump(1);
+   bbSetInputShift(0);
    bbSetInputwxContourMainFrame(NULL);
   
 }
index af6e6eb18ce49b56261fe26bb7ebd79592f89783..934fe44cd0e4a891e3be15de2c9843bd90e0e4cf 100644 (file)
@@ -23,6 +23,8 @@ class bbcreaContours_EXPORT SetViewerPosition
   BBTK_DECLARE_INPUT(wxContourMainFrame,wxContourMainFrame*);
   BBTK_DECLARE_INPUT(Position,std::vector<int>);
   BBTK_DECLARE_INPUT(Direction,int);
+  BBTK_DECLARE_INPUT(Jump,int);
+  BBTK_DECLARE_INPUT(Shift,int);
 //  BBTK_DECLARE_OUTPUT(Out,double);
   BBTK_PROCESS(Process);
   void Process();
@@ -40,6 +42,8 @@ BBTK_BEGIN_DESCRIBE_BLACK_BOX(SetViewerPosition,bbtk::AtomicBlackBox);
   BBTK_INPUT(SetViewerPosition,wxContourMainFrame,"wxContourMainFrame",wxContourMainFrame*,"");
   BBTK_INPUT(SetViewerPosition,Position,"vector px py pz",std::vector<int>,"");
   BBTK_INPUT(SetViewerPosition,Direction,"(default 0) 0:XYZ 1:XZY 2:YZX",int,"");
+  BBTK_INPUT(SetViewerPosition,Jump,"Slice jump+shift",int,"");
+  BBTK_INPUT(SetViewerPosition,Shift,"Slice jump+shift",int,"");
 
   //BBTK_OUTPUT(SetViewerPosition,Out,"First output",double,"");
 
index 33db75f8652b799e2e366ebc8186d9058709bb5e..b3016751b1236497c2ca80c87f35646a5dc85885 100644 (file)
@@ -863,7 +863,6 @@ void wxContourMainFrame ::loadState(std::string filename)
        onLoadContours(filename,false);
 }
 
-
 void wxContourMainFrame::onLoad()
 {
        std::string fileNameContourROI = GetFileLocation();
@@ -880,20 +879,17 @@ void wxContourMainFrame::onLoad()
                if (dialog.ShowModal() == wxID_OK)
                {
                        fileNameContourROI = (const char *)(dialog.GetPath().mb_str());
-               }
-       }
-
+               } // if dialog
+       } // if FileLocation
        onLoadContours(fileNameContourROI,true);
 }
 
-
 void  wxContourMainFrame::SetZForAllContours(int pz)
 {
        //-- Normal Contours
        std::vector< std::string > lstNameThings;       
        int i,sizeLstNameThings;
-       int ii,sizeLstPoints;
-       
+       int ii,sizeLstPoints;   
        lstNameThings           = kernelManager->GetLstNameThings();
        sizeLstNameThings       = lstNameThings.size(); 
        for (i=0 ; i<sizeLstNameThings ; i++)
@@ -965,27 +961,18 @@ void wxContourMainFrame::onLoadContours(std::string fileNameContourROI, bool int
                        readDimSpc(pFile,false);                // DimSpc interactive OFF
                        openContours(pFile,pFileData,true);     // Load StaticContours
                        SetZForAllContours(-900);
-               }
-               //AD:02-06-09
-               else if (version=="1.0.1")
-               {
+               } else if (version=="1.0.1") { //AD:02-06-09
                        openContours(pFile,pFileData,false); //Skips ImageDimensions and ImageSpacing
                        openContours(pFile,pFileData,true); //Load StaticContours, skips ImageDimensions and ImageSpacing
-               }
-
-               //AD:02-06-09
-               else if (version=="1.0.0")
-               {
+               } else if (version=="1.0.0") { //AD:02-06-09
                        openContours(pFile,pFileData,false); //Skips ImageDimensions and ImageSpacing
                }
-
                fclose(pFile);
-
                if(pFileData != NULL)
                {
                        fclose(pFileData);
                } // if
-       }
+       } // pFile
        _theViewPanel->getSceneManager()->removeSceneContours();
        changeInstant();
 }
@@ -1005,7 +992,8 @@ void wxContourMainFrame::onImport()
                filename = dialog.GetPath().mb_str();
                filenamecontours = kernelManager->parseOsirixFile(filename);
 
-               if(filenamecontours.compare("") != 0){
+               if(filenamecontours.compare("") != 0)
+               {
                        onLoadContours(filenamecontours,true);
                } // if
        } // if
@@ -1020,7 +1008,6 @@ void wxContourMainFrame::onTest()
 #else
        wxFileDialog dialog(NULL, _T("Choose a File"), _T(""), _T(""), _T("*.*"), wxFD_OPEN );
 #endif
-
        if (dialog.ShowModal() == wxID_OK)
        {
                filename = dialog.GetPath().mb_str();
@@ -1028,9 +1015,9 @@ void wxContourMainFrame::onTest()
        } // if
 }
 
-
 //AD: 29-05-09
-void wxContourMainFrame::onSave(){
+void wxContourMainFrame::onSave()
+{
 //CMRU 03-09-09-----------------------------------------------------------------------------------------------
        if(GetFileLocation().empty())
        {
@@ -1047,10 +1034,7 @@ void wxContourMainFrame::onSave(){
                        kernelManager->setCurrentFileName(fileNameContourROI);
                        saveFileWithContours( fileNameContourROI );
                }
-       }
-//CMRU 03-09-09-----------------------------------------------------------------------------------------------
-       else
-       {
+       } else {//CMRU 03-09-09-----------------------------------------------------------------------------------------------
                std::cout<<"Nombre del archivo: "<<GetFileLocation()<<std::endl;
                std::string fileNameContourROI = GetFileLocation();
                std::cout<<"Nombre del archivo: "<<fileNameContourROI<<std::endl;
@@ -1899,6 +1883,10 @@ void wxContourMainFrame::onSegmentationOneSlice(int isovalue,int sampling,int me
 
 void wxContourMainFrame::SegmentationOneSlice( int x, int y, int z, int isovalue, int sampling, int method )
 {
+
+printf("EED wxContourMainFrame::SegmentationOneSlice Start=%d  %d\n",sampling,method );
+printf("EED wxContourMainFrame::SegmentationOneSlice %d %d %d  \n",x,y,z );
+
        int typeofcontour = 1;
        //--Extracting Contour
        vtkImageData    *imagedata      = getImageData();
@@ -2072,7 +2060,7 @@ polyDataResult->PrintSelf( std::cout, vtkIndent(0) );
                int ii,size=vtkcell->GetNumberOfPoints();
        printf("EED wxContourMainFrame::SegmentationOneSlice C \n");
                int id;
-               for (ii=1;ii<=size;ii++)
+               for (ii=0;ii<size;ii++)
                {
        //              id      = polyDataResult->GetLines()->GetData()->GetValue(ii);
        //              p       = polyDataResult->GetPoint(id);