]> Creatis software - creaContours.git/commitdiff
#3320 creaContours Bug New Normal - Segmentation PolyData Cells
authorEduardo DAVILA <davila@ei-ed-606.univ-lyon1.fr>
Tue, 3 Dec 2019 15:35:54 +0000 (16:35 +0100)
committerEduardo DAVILA <davila@ei-ed-606.univ-lyon1.fr>
Tue, 3 Dec 2019 15:35:54 +0000 (16:35 +0100)
appli/wxContourGUIExample/wxContourGUIExample.cxx
bbtk/src/bbCreaContournDimensions.cxx
bbtk/src/bbCreaContournDimensions.h
lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx

index 680976430b23750464569d472ffacdc433109505..420a8941a80ee2620a13aca2d6a72550befbabfb 100644 (file)
 
 #include "wxContourGUIExample.h"
 #include "wxContourMainFrame.h"
-//#include "OutlineModelManager.h"
-//#include "wxContourEventHandler.h"
-//#include <creaImageIOWxGimmickDialog.h>
-//#include <creaImageIOWxGimmickReaderDialog.h>
 #include <creaImageIOWxSimpleDlg.h>
 #include <creaImageIOSystem.h>
 #include <creaVtkBasicSlicer.h>
-//#include "wxContourMainPanel.h"
 #include "vtkMetaImageReader.h"
 #include <map>
 #include "vtkImageData.h"
index 143cd5e471bf1174c66cce88cab4ab1737d5baa0..d0a4504dc68bcdef88777ba708a2e3712a68bd18 100644 (file)
@@ -34,6 +34,7 @@ BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaContours,nDimensions)
 BBTK_BLACK_BOX_IMPLEMENTATION(nDimensions,bbtk::WxBlackBox);
 void nDimensions::Process()
 {
+printf("EED nDimensions::Process Start \n" );
        double **vectx = 0, **vecty = 0, **vectz = 0;
 
        std::vector< void * > vectortemp;
@@ -48,21 +49,34 @@ void nDimensions::Process()
                wxContourMainFrame::getInstance()->ShowToolsPanel(true);
                currentimg=img;
                selectedimages.push_back(img);
+printf("EED nDimensions::Process 1 \n" );
                wxContourMainFrame::getInstance()->setVectImages(selectedimages);
+printf("EED nDimensions::Process 2 \n" );
        }
 
-       if(currentimg != NULL){
+       if(currentimg != NULL)
+   {
                int contourtype = bbGetInputContourType();
                //wxContourMainFrame::getInstance()->getValuesXYZ(vectx, vecty, vectz, &size);
                //wxContourMainFrame::getInstance()->getMaskValue(mask, value, contourtype);
        }
 
-       bbSetOutputX(vectx);
-       bbSetOutputY(vecty);
-       bbSetOutputZ(vectz);
-       bbSetOutputSizeContour(size);
-       bbSetOutputMask(*mask);
-       bbSetOutputValue(*value);
+    wxContourMainFrame::getInstance()->RefreshInterface();
+
+
+printf("EED nDimensions::Process 3.1 \n" );
+//     bbSetOutputX(vectx);
+printf("EED nDimensions::Process 3.2 \n" );
+//     bbSetOutputY(vecty);
+printf("EED nDimensions::Process 3.3 \n" );
+//     bbSetOutputZ(vectz);
+printf("EED nDimensions::Process 3.4 \n" );
+//     bbSetOutputSizeContour(size);
+printf("EED nDimensions::Process 3.5 \n" );
+//     bbSetOutputMask(*mask);
+printf("EED nDimensions::Process 3.6 \n" );
+//     bbSetOutputValue(*value);
+printf("EED nDimensions::Process End \n" );
 }
 
 //-----------------------------------------------------------------
@@ -96,12 +110,17 @@ printf("EED WARNING Verify that GetDllAppPath in  nDimensions::CreateWidget bbCr
 #endif // MACOSX       
        
        
-       printf("EED nDimensions::CreateWidget path=%s\n",datadir.c_str() );
+printf("EED nDimensions::CreateWidget path=%s\n",datadir.c_str() );
 
-       wxPanel* panel = wxContourMainFrame::getInstance(parent, wxID_ANY, wxString(_T("")), wxPoint(100,50), wxSize(800, 600), selectedimages,wxDEFAULT_FRAME_STYLE | wxSUNKEN_BORDER,datadir );
+       wxContourMainFrame* wxcontourmainframe = wxContourMainFrame::getInstance(parent, wxID_ANY, wxString(_T("")), wxPoint(100,50), wxSize(800, 600), selectedimages,wxDEFAULT_FRAME_STYLE | wxSUNKEN_BORDER,datadir );
+printf("EED nDimensions::CreateWidget 1 \n" );
        wxContourMainFrame::getInstance()->ShowToolsPanel(false);
-//EED  bbSetOutputWidget( panel );
-               bbSetOutputWidget( new wxPanel(parent,-1) );
+printf("EED nDimensions::CreateWidget 2 \n" );
+
+//             bbSetOutputWidget( new wxPanel(parent,-1) );
+               bbSetOutputWidget( wxcontourmainframe    );
+
+printf("EED nDimensions::CreateWidget 3 \n" );
 }
 
 //-----------------------------------------------------------------
index fac3b34808d7719e1af31733200d5bb0ce3921c1..a4f6178ca3c80634f28eb20597b230cbc3871872 100644 (file)
@@ -77,7 +77,7 @@ BBTK_DESCRIPTION("With a given image, the box shows the nDimension application")
 BBTK_CATEGORY("contours");
 BBTK_INPUT(nDimensions,WorkDir,"Working data directory where config and data files are located",std::string,"");
 BBTK_INPUT(nDimensions,In,"Image to be shown",vtkImageData*,"");
-BBTK_INPUT(nDimensions,ContourType,"Contour type to be exported: ",int,"");
+BBTK_INPUT(nDimensions,ContourType,"(default 0) Contour type to be exported: ",int,"");
 
 BBTK_OUTPUT(nDimensions, Mask, "Mask of the contours",vtkImageData*,"");
 BBTK_OUTPUT(nDimensions, Value, "Value of the contours",vtkImageData*,"");
index 764feea43abd60fdcdf67f197c9b64f3aa5fbf94..a3f199a412109c5c46f425a5fe230be2e1804256 100644 (file)
@@ -1887,6 +1887,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 )
 {
+printf("EED wxContourMainFrame::SegmentationOneSlice   Start\n");
        int typeofcontour = 1;
        //--Extracting Contour
        //vtkImageData  *imagedata      = _theViewPanel->getSceneManager()->GetImageData();
@@ -1983,6 +1984,7 @@ void wxContourMainFrame::SegmentationOneSlice( int x, int y, int z, int isovalue
        cpd2->UpdateInformation();
 
        vtkStripper* vtkstripper = vtkStripper::New( );
+       vtkstripper->SetMaximumLength(20000);
 //EED 2017-01-01 Migration VTK7
 #if VTK_MAJOR_VERSION <= 5
        vtkstripper->SetInput( cpd2->GetOutput() );
@@ -2030,6 +2032,23 @@ myfile.close();
        std::vector<double> vecCtrlPointZ;
 
 
+printf("EED wxContourMainFrame::SegmentationOneSlice GetNumberOfLines=%d \n",polyDataResult->GetNumberOfLines() );
+
+int numberOfPointsInCell;
+int numberOfcells=polyDataResult->GetNumberOfCells();
+for (int jj=0; jj<numberOfcells ; jj++)
+{
+       vtkCell* vtkcell = polyDataResult->GetCell( jj );
+       numberOfPointsInCell=vtkcell->GetNumberOfPoints();
+       printf("EED wxContourMainFrame::SegmentationOneSlice cell=%d  points=%d \n",jj,numberOfPointsInCell );
+}// for jj
+
+printf("EED wxContourMainFrame::SegmentationOneSlice PrintSelf \n");
+
+polyDataResult->PrintSelf( std::cout, vtkIndent(0) );
+
+
+
        double *p;
        int ii,size=polyDataResult->GetNumberOfPoints();
        int id;
@@ -2037,6 +2056,7 @@ myfile.close();
        {
                id      = polyDataResult->GetLines()->GetData()->GetValue(ii);
                p       = polyDataResult->GetPoint(id);
+printf("EED wxContourMainFrame::SegmentationOneSlice (%d) id=%d  px=%f py=%f\n",ii,id, p[0],p[1]);
 //             double x=p[0];
 //             double y=p[1];
                vecX.push_back( p[0] );
@@ -2062,27 +2082,30 @@ myfile.close();
                extractcontrolpoints2d->GetSamplingControlPoints(  &vecCtrlPointX , &vecCtrlPointY , &vecCtrlPointZ );
        }*/
 
-       if (method==0){
+       if (method==0)
+       {
                extractcontrolpoints2d->GetInitialControlPoints( &vecCtrlPointX , &vecCtrlPointY , &vecCtrlPointZ );
-       }
-       else if (method==1){
+       } else if (method==1){
                extractcontrolpoints2d->GetControlPoints(  &vecCtrlPointX , &vecCtrlPointY , &vecCtrlPointZ );
-       }
-       else if (method==2){
+       } else if (method==2){
                extractcontrolpoints2d->SetSamplingControlPoints( sampling );
                extractcontrolpoints2d->GetSamplingControlPoints(  &vecCtrlPointX , &vecCtrlPointY , &vecCtrlPointZ );
        }
 
        //--Adding contour to the system
-
        std::vector<int> actualInstantVector;
        _instantPanel->getInstant( actualInstantVector );
        actualInstantVector[1]=z;
 
        int j,sizeCtrPt = vecCtrlPointX.size();
        manualBaseModel *manModelContour =  kernelManager->factoryManualContourModel( typeofcontour );
-       manModelContour->SetNumberOfPointsSpline( ((sizeCtrPt/100)+1)*100 );
-       if (sizeCtrPt>=3){
+printf("EED  wxContourMainFrame::SegmentationOneSlice  sizeCtrPt=%d   %d  %d\n"        , sizeCtrPt
+                                                                                                                                                               , ((sizeCtrPt/100)+1)*100 *2
+                                                                                                                                                               , manModelContour->GetNumberOfPointsSpline()
+       );
+       manModelContour->SetNumberOfPointsSpline( ((sizeCtrPt/100)+1)*100 *2 );
+       if (sizeCtrPt>=3)
+       {
                for (j=0 ; j<sizeCtrPt ; j++)
                {
                        manModelContour->AddPoint( vecCtrlPointX[j] , vecCtrlPointY[j] , vecCtrlPointZ[j]  );
@@ -2102,16 +2125,21 @@ myfile.close();
                        //_theViewPanel->getSceneManager()->configureViewControlTo( theName, manModelContour,spc, typeofcontour ) ;
                }       // if addedModel
        } // if sizeCtrPt
+printf("EED wxContourMainFrame::SegmentationOneSlice   End\n");
 }
-int wxContourMainFrame::GetImageDataSizeZ(){
+
+int wxContourMainFrame::GetImageDataSizeZ()
+{
        return _theViewPanel->GetImageDataSizeZ();
 }
 
-void wxContourMainFrame::GetImageDataRange(double *range){
+void wxContourMainFrame::GetImageDataRange(double *range)
+{
        _theViewPanel->GetImageDataRange(range);
 }
 
-void wxContourMainFrame::onSegmentationAllSlice(int minZ,int maxZ,int isovalue,int sampling,int method){
+void wxContourMainFrame::onSegmentationAllSlice(int minZ,int maxZ,int isovalue,int sampling,int method)
+{
        //JCP 20-10-08 Undo redo implementation
        saveState();
        //JCP 20-10-08 Undo redo implementation