From 86d4ba5b08d175ca80f620a245a3ec0477e6dc93 Mon Sep 17 00:00:00 2001 From: Eduardo DAVILA Date: Fri, 28 Apr 2023 11:15:15 +0200 Subject: [PATCH] 3508 Bug ShowNPoints intput points --- .../bbmaracasvisuImageChangeInformation.cxx | 6 +- bbtk/src/bbmaracasvisuShowNPoints.cxx | 23 ++++--- bbtk/src/bbmaracasvisuShowNPoints.h | 1 + bbtk/src/bbmaracasvisuViewerNV.h | 2 +- .../wxWindows/widgets/WidgetShowNPoints.cxx | 64 ++++++++++++++++++- .../wxWindows/widgets/WidgetShowNPoints.h | 2 +- 6 files changed, 85 insertions(+), 13 deletions(-) diff --git a/bbtk/src/bbmaracasvisuImageChangeInformation.cxx b/bbtk/src/bbmaracasvisuImageChangeInformation.cxx index 6cc53a3..1eb17ae 100644 --- a/bbtk/src/bbmaracasvisuImageChangeInformation.cxx +++ b/bbtk/src/bbmaracasvisuImageChangeInformation.cxx @@ -80,7 +80,11 @@ void ImageChangeInformation::Process() mchange->Modified(); //important mchange->Update(); //important bbSetOutputOut( mchange->GetOutput() ); - } // if img + } else { + printf("EED ImageChangeInformation::Process NULL\n"); + bbSetOutputOut( NULL ); + + } // if img } diff --git a/bbtk/src/bbmaracasvisuShowNPoints.cxx b/bbtk/src/bbmaracasvisuShowNPoints.cxx index 9292fd6..bca02d7 100644 --- a/bbtk/src/bbmaracasvisuShowNPoints.cxx +++ b/bbtk/src/bbmaracasvisuShowNPoints.cxx @@ -111,16 +111,20 @@ void ShowNPoints::Process() mwxwidget->SetOpacity( bbGetInputOpacity() ); mwxwidget->SetRadio( bbGetInputRadio() ); - if ( mwxwidget->GetModelShowNPoints()->GetFirstTime()==false ) + if (firsttime==true) { - mwxwidget->DetectCollectionActive(); - } - if ( mwxwidget->GetModelShowNPoints()->GetFirstTime()==true ) - { - mwxwidget->GetModelShowNPoints()->SetFirstTime(false); - mwxwidget->SetInitLstPoints( bbGetInputInitLstPointsX() , bbGetInputInitLstPointsY() , bbGetInputInitLstPointsZ() , bbGetInputInitLstLabels() ); - } - + firsttime=false; + if ( mwxwidget->GetModelShowNPoints()->GetFirstTime()==false ) + { + mwxwidget->DetectCollectionActive(); + } + if ( mwxwidget->GetModelShowNPoints()->GetFirstTime()==true ) + { + mwxwidget->GetModelShowNPoints()->SetFirstTime(false); + mwxwidget->SetInitLstPoints( bbGetInputInitLstPointsX() , bbGetInputInitLstPointsY() , bbGetInputInitLstPointsZ() , bbGetInputInitLstLabels() , bbGetInputInitLstIndexs() ); + } + } // firsttime OJO machete Eduardo pour Adreas a verificar + mwxwidget->AutoAddPoints(); mwxwidget->TrackingPoint(); bbSetOutputlstPointsX( mwxwidget->GetLstPointsX() ); @@ -147,6 +151,7 @@ void ShowNPoints::CreateWidget(wxWindow* parent) //----------------------------------------------------------------- void ShowNPoints::bbUserSetDefaultValues() { + firsttime=true; mwxwidget = NULL; bbSetInputRadio(10); bbSetInputOpacity(1); diff --git a/bbtk/src/bbmaracasvisuShowNPoints.h b/bbtk/src/bbmaracasvisuShowNPoints.h index 5c6a56a..2a276ee 100644 --- a/bbtk/src/bbmaracasvisuShowNPoints.h +++ b/bbtk/src/bbmaracasvisuShowNPoints.h @@ -89,6 +89,7 @@ class /*BBTK_EXPORT*/ ShowNPoints void CreateWidget(wxWindow*); private: + bool firsttime; WidgetShowNPointsBox *mwxwidget; }; diff --git a/bbtk/src/bbmaracasvisuViewerNV.h b/bbtk/src/bbmaracasvisuViewerNV.h index d54e3e8..f798dcb 100644 --- a/bbtk/src/bbmaracasvisuViewerNV.h +++ b/bbtk/src/bbmaracasvisuViewerNV.h @@ -116,7 +116,7 @@ private: BBTK_BEGIN_DESCRIBE_BLACK_BOX(ViewerNV,bbtk::WxBlackBox); BBTK_NAME("ViewerNV"); BBTK_AUTHOR("eduardo.davila [at] creatis.insa-lyon.fr"); -BBTK_DESCRIPTION("Viewer : N view configuration 2D and 3D"); +BBTK_DESCRIPTION("Viewer : N view configuration 2D and 3D (C++,Python)"); BBTK_CATEGORY("viewer"); BBTK_INPUT(ViewerNV,Title,"Title prepended to the text",std::string,""); BBTK_INPUT(ViewerNV,In,"Input image",vtkImageData*,""); diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/WidgetShowNPoints.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/WidgetShowNPoints.cxx index 56e924f..40575fd 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/WidgetShowNPoints.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/WidgetShowNPoints.cxx @@ -965,8 +965,68 @@ void WidgetShowNPoints::SetReferencePoint(std::vector point) } //------------------------------------------------------------------------ -void WidgetShowNPoints::SetInitLstPoints( std::vector initLstPointsX, std::vector initLstPointsY, std::vector initLstPointsZ, std::vector initLstLabels ) +void WidgetShowNPoints::SetInitLstPoints( std::vector initLstPointsX, std::vector initLstPointsY, std::vector initLstPointsZ, std::vector initLstLabels, std::vector initLstIndexs ) { + + printf("EED WidgetShowNPoints::SetInitLstPoints flag 1\n"); + + if (GetViewShowNPoints()->renderer==NULL) + { + return; + } + double x,y,z; + std::string label; + int i,sizeX,sizeY,sizeZ,sizeTmp,sizeLabels; + int ii,iIndexs,sizeIndexs; + + sizeX = (int)initLstPointsX.size(); + sizeY = (int)initLstPointsY.size(); + sizeZ = (int)initLstPointsZ.size(); + sizeLabels = (int)initLstLabels.size(); + sizeIndexs = (int)initLstIndexs.size(); + + if (sizeIndexs==0) + { + initLstIndexs.push_back(sizeX); + sizeIndexs = (int)initLstIndexs.size(); + } + + if ( (sizeX==sizeY) && (sizeX==sizeZ) ) + { + i=0; + for (iIndexs=0;iIndexsGetRenderWindow()->Render(); + } // if size + + + + + /* + // EED 2022-05-19 //if (this->renderer==NULL) if (GetViewShowNPoints()->renderer==NULL) @@ -998,6 +1058,8 @@ void WidgetShowNPoints::SetInitLstPoints( std::vector initLstPointsX, // SetOutputBox(); // renderer->GetRenderWindow()->Render(); } // if size + + */ } //------------------------------------------------------------------------ diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/WidgetShowNPoints.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/WidgetShowNPoints.h index f453149..2ab28bb 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/WidgetShowNPoints.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/WidgetShowNPoints.h @@ -102,7 +102,7 @@ class WidgetShowNPoints : public wxPanel int GetLstModelShowNPointsSize(); ModelShowNPoints* GetModelShowNPoints(); ViewShowNPoints* GetViewShowNPoints(); - void SetInitLstPoints( std::vector initLstPointsX, std::vector initLstPointsY, std::vector initLstPointsZ, std::vector initLstLabels ); + void SetInitLstPoints( std::vector initLstPointsX, std::vector initLstPointsY, std::vector initLstPointsZ, std::vector initLstLabels, std::vector initLstIndexs ); void SetType(int type); int GetType(); -- 2.47.1