From cc5335c400c0186080bde08a41071433c807b2bd Mon Sep 17 00:00:00 2001 From: Eduardo DAVILA Date: Mon, 16 Dec 2019 16:48:58 +0100 Subject: [PATCH] #3320creaContours Bug NewNormal - Segmentation PolyData Cells --- bbtk/src/bbcreaContoursSetViewerPosition.cxx | 27 +++++++----- bbtk/src/bbcreaContoursSetViewerPosition.h | 4 ++ .../wxContourMainFrame.cxx | 44 +++++++------------ 3 files changed, 37 insertions(+), 38 deletions(-) diff --git a/bbtk/src/bbcreaContoursSetViewerPosition.cxx b/bbtk/src/bbcreaContoursSetViewerPosition.cxx index 365c4a0..582f59b 100644 --- a/bbtk/src/bbcreaContoursSetViewerPosition.cxx +++ b/bbtk/src/bbcreaContoursSetViewerPosition.cxx @@ -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); } diff --git a/bbtk/src/bbcreaContoursSetViewerPosition.h b/bbtk/src/bbcreaContoursSetViewerPosition.h index af6e6eb..934fe44 100644 --- a/bbtk/src/bbcreaContoursSetViewerPosition.h +++ b/bbtk/src/bbcreaContoursSetViewerPosition.h @@ -23,6 +23,8 @@ class bbcreaContours_EXPORT SetViewerPosition BBTK_DECLARE_INPUT(wxContourMainFrame,wxContourMainFrame*); BBTK_DECLARE_INPUT(Position,std::vector); 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,""); 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,""); diff --git a/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx b/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx index 33db75f..b301675 100644 --- a/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx +++ b/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx @@ -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 ; igetSceneManager()->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: "<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;iiGetLines()->GetData()->GetValue(ii); // p = polyDataResult->GetPoint(id); -- 2.45.1