From 6b1e60b233628dde72721c9fac669f2fcf7eb49b Mon Sep 17 00:00:00 2001 From: Eduardo DAVILA Date: Wed, 8 Jan 2020 09:30:26 +0100 Subject: [PATCH] #3334 creaContours Feature New Normal - Control Refresh events from bbtk --- bbtk/src/bbcreaContoursSetViewerPosition.cxx | 91 ++++++++++--------- bbtk/src/bbcreaContoursSetViewerPosition.h | 2 + .../wxContourMainFrame.cxx | 4 - .../wxContourMainFrame.h | 8 +- 4 files changed, 56 insertions(+), 49 deletions(-) diff --git a/bbtk/src/bbcreaContoursSetViewerPosition.cxx b/bbtk/src/bbcreaContoursSetViewerPosition.cxx index 582f59b..5f0f233 100644 --- a/bbtk/src/bbcreaContoursSetViewerPosition.cxx +++ b/bbtk/src/bbcreaContoursSetViewerPosition.cxx @@ -29,48 +29,53 @@ void SetViewerPosition::Process() // bbSetOutputOut( bbGetInputIn() ); // std::cout << "Output value = " <getImageData(); - int ext[6]; - img->GetExtent(ext); - int dimY=ext[3]-ext[2]+1; - if (bbGetInputDirection()==0) - { - slice = z; - slice = round( slice/bbGetInputJump() ) * bbGetInputJump() + bbGetInputShift(); - bbGetInputwxContourMainFrame()->setConceptValue( "Axe Depth", slice ); - bbGetInputwxContourMainFrame()->SetXY(x,y); - } // if Direction1 - - if (bbGetInputDirection()==1) + if (bbGetInputwxContourMainFrame()!=NULL) { - slice = y; - slice = round( slice/bbGetInputJump() ) * bbGetInputJump() + bbGetInputShift(); - bbGetInputwxContourMainFrame()->setConceptValue( "Axe Depth", slice ); - bbGetInputwxContourMainFrame()->SetXY(x,dimY-z-1); - } // if Direction1 - - if (bbGetInputDirection()==2) - { - slice = x; - slice = round( slice/bbGetInputJump() ) * bbGetInputJump() + bbGetInputShift(); - bbGetInputwxContourMainFrame()->setConceptValue( "Axe Depth", slice ); - bbGetInputwxContourMainFrame()->SetXY(dimY-z-1,y); - } // if Direction1 + double slice; + vtkImageData *img = bbGetInputwxContourMainFrame()->getImageData(); + int ext[6]; + img->GetExtent(ext); + int dimY=ext[3]-ext[2]+1; + if (bbGetInputDirection()==0) + { + slice = z; + slice = round( slice/bbGetInputJump() ) * bbGetInputJump() + bbGetInputShift(); + bbGetInputwxContourMainFrame()->setConceptValue( "Axe Depth", slice ); + bbGetInputwxContourMainFrame()->SetXY(x,y); + } // if Direction1 + if (bbGetInputDirection()==1) + { + slice = y; + slice = round( slice/bbGetInputJump() ) * bbGetInputJump() + bbGetInputShift(); + bbGetInputwxContourMainFrame()->setConceptValue( "Axe Depth", slice ); + bbGetInputwxContourMainFrame()->SetXY(x,dimY-z-1); + } // if Direction1 - bbGetInputwxContourMainFrame()->showAxis(true); - bbGetInputwxContourMainFrame()->changeInstant(); - bbGetInputwxContourMainFrame()->RefreshInterface(); - } - } + if (bbGetInputDirection()==2) + { + slice = x; + slice = round( slice/bbGetInputJump() ) * bbGetInputJump() + bbGetInputShift(); + bbGetInputwxContourMainFrame()->setConceptValue( "Axe Depth", slice ); + bbGetInputwxContourMainFrame()->SetXY(dimY-z-1,y); + } // if Direction1 + bbGetInputwxContourMainFrame()->showAxis(true); + bbGetInputwxContourMainFrame()->changeInstant(); + bbGetInputwxContourMainFrame()->RefreshInterface(); + backX=x; + backY=y; + backZ=z; + } // if bbGetInputPosition + } // if bbGetInputwxContourMainFrame + } // if backX backY backZ } //===== @@ -81,10 +86,14 @@ 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); + bbSetInputDirection(0); + bbSetInputJump(1); + bbSetInputShift(0); + bbSetInputwxContourMainFrame(NULL); + + backX=-9999; + backY=-9999; + backZ=-9999; } //===== diff --git a/bbtk/src/bbcreaContoursSetViewerPosition.h b/bbtk/src/bbcreaContoursSetViewerPosition.h index 934fe44..c22c97e 100644 --- a/bbtk/src/bbcreaContoursSetViewerPosition.h +++ b/bbtk/src/bbcreaContoursSetViewerPosition.h @@ -28,6 +28,8 @@ class bbcreaContours_EXPORT SetViewerPosition // BBTK_DECLARE_OUTPUT(Out,double); BBTK_PROCESS(Process); void Process(); + + int backX, backY, backZ; //===== // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) //===== diff --git a/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx b/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx index 9d4319e..793e05d 100644 --- a/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx +++ b/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx @@ -3507,7 +3507,6 @@ void wxContourMainFrame::FlipLstOfContours(std::vector lstNameThing sizeLstNameThings = lstNameThings.size(); for (i=0 ; igetOutlineByKeyName(lstNameThings[i]); if (flipDirection==0) { @@ -3535,8 +3534,6 @@ void wxContourMainFrame::FlipLstOfContours(std::vector lstNameThing void wxContourMainFrame::FlipContours(int typeContourFlip, int flipDirection) { - printf("EED wxContourMainFrame::FlipContours( %d , %d ) \n",typeContourFlip, flipDirection ); - saveState(); if (typeContourFlip==0) // @@ -3556,7 +3553,6 @@ void wxContourMainFrame::FlipContours(int typeContourFlip, int flipDirection) RefreshInterface(); } - void wxContourMainFrame::SetXY(int x, int y) { _theViewPanel->SetXY(x,y); diff --git a/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h b/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h index 2434fb4..fac56dd 100644 --- a/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h +++ b/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h @@ -336,7 +336,7 @@ private: // Attributtes //------------------------------------------------------------------------------------------------------------ - int _contourGroup; + int _contourGroup; static wxContourMainFrame *instance; KernelManagerContour *kernelManager; interfMainPanel *_pannew; @@ -352,9 +352,9 @@ private: wxAuiManager m_mgr; wxAuiNotebook *notebook; - long m_notebook_style; - long m_notebook_theme; - int _numberOfVariablesStatistics; + long m_notebook_style; + long m_notebook_theme; + int _numberOfVariablesStatistics; // Contour Image Mask ThresholdImageView *_viewMaskImage; -- 2.47.1