From: Eduardo DAVILA Date: Tue, 3 Dec 2019 15:35:54 +0000 (+0100) Subject: #3320 creaContours Bug New Normal - Segmentation PolyData Cells X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=87eb16df886e4afe2d53ddf115de54cf8fe25665;p=creaContours.git #3320 creaContours Bug New Normal - Segmentation PolyData Cells --- diff --git a/appli/wxContourGUIExample/wxContourGUIExample.cxx b/appli/wxContourGUIExample/wxContourGUIExample.cxx index 6809764..420a894 100644 --- a/appli/wxContourGUIExample/wxContourGUIExample.cxx +++ b/appli/wxContourGUIExample/wxContourGUIExample.cxx @@ -29,14 +29,9 @@ #include "wxContourGUIExample.h" #include "wxContourMainFrame.h" -//#include "OutlineModelManager.h" -//#include "wxContourEventHandler.h" -//#include -//#include #include #include #include -//#include "wxContourMainPanel.h" #include "vtkMetaImageReader.h" #include #include "vtkImageData.h" diff --git a/bbtk/src/bbCreaContournDimensions.cxx b/bbtk/src/bbCreaContournDimensions.cxx index 143cd5e..d0a4504 100644 --- a/bbtk/src/bbCreaContournDimensions.cxx +++ b/bbtk/src/bbCreaContournDimensions.cxx @@ -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" ); } //----------------------------------------------------------------- diff --git a/bbtk/src/bbCreaContournDimensions.h b/bbtk/src/bbCreaContournDimensions.h index fac3b34..a4f6178 100644 --- a/bbtk/src/bbCreaContournDimensions.h +++ b/bbtk/src/bbCreaContournDimensions.h @@ -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*,""); diff --git a/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx b/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx index 764feea..a3f199a 100644 --- a/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx +++ b/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx @@ -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 vecCtrlPointZ; +printf("EED wxContourMainFrame::SegmentationOneSlice GetNumberOfLines=%d \n",polyDataResult->GetNumberOfLines() ); + +int numberOfPointsInCell; +int numberOfcells=polyDataResult->GetNumberOfCells(); +for (int jj=0; jjGetCell( 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 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 ; jAddPoint( 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