]> Creatis software - creaMaracasVisu.git/commitdiff
3508 Bug ShowNPoints intput points
authorEduardo DAVILA <davila@creatis.insa-lyon.fr>
Fri, 28 Apr 2023 09:15:15 +0000 (11:15 +0200)
committerEduardo DAVILA <davila@creatis.insa-lyon.fr>
Fri, 28 Apr 2023 09:15:15 +0000 (11:15 +0200)
bbtk/src/bbmaracasvisuImageChangeInformation.cxx
bbtk/src/bbmaracasvisuShowNPoints.cxx
bbtk/src/bbmaracasvisuShowNPoints.h
bbtk/src/bbmaracasvisuViewerNV.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/WidgetShowNPoints.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/WidgetShowNPoints.h

index 6cc53a3615ae61d0fa63a97f47827e01bb3f4b89..1eb17aecf1fb9891caf3736c386bde73143b802b 100644 (file)
@@ -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
 
 }
 
index 9292fd69f9240a4dd039b0b83e86e02b291a63cb..bca02d79090bb07defe2a29f865e7a63e06305a4 100644 (file)
@@ -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);
index 5c6a56a172301c52ba49c508822798f4cf93b8ee..2a276eebf9ef98de4c3348883f294cd2cd895003 100644 (file)
@@ -89,6 +89,7 @@ class /*BBTK_EXPORT*/ ShowNPoints
   void CreateWidget(wxWindow*);
 
 private:
+    bool                        firsttime;
        WidgetShowNPointsBox *mwxwidget; 
 };
 
index d54e3e88dd2f3ea36f4ef784a640e434436eabea..f798dcb30d44f2ef9004979fe93ec4a05e7ed49d 100644 (file)
@@ -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*,"");
index 56e924f238771611ad10d141c7c60f4f51edaddd..40575fd5ea550418bed40002b3ec0829f439d637 100644 (file)
@@ -965,8 +965,68 @@ void  WidgetShowNPoints::SetReferencePoint(std::vector<double> point)
 }
 
 //------------------------------------------------------------------------
-void  WidgetShowNPoints::SetInitLstPoints( std::vector<double> initLstPointsX,  std::vector<double> initLstPointsY, std::vector<double> initLstPointsZ, std::vector<std::string> initLstLabels )
+void  WidgetShowNPoints::SetInitLstPoints( std::vector<double> initLstPointsX,  std::vector<double> initLstPointsY, std::vector<double> initLstPointsZ, std::vector<std::string> initLstLabels,   std::vector<int> 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;iIndexs<sizeIndexs;iIndexs++ )
+        {
+            if (iIndexs!=0)
+            {
+                InsertCollectionAfter_();
+            }// if last iIndexs
+            sizeTmp = initLstIndexs[iIndexs];
+            for (ii=0;ii<sizeTmp;ii++)
+            {
+                x        = initLstPointsX[i];
+                y        = initLstPointsY[i];
+                z        = initLstPointsZ[i];
+                if (i<sizeLabels)
+                {
+                    label    = initLstLabels[i];
+                } else {
+                    label="";
+                }
+                AddPoint( x,y,z,label );
+                i++;
+            } // for i
+
+            
+        }// for ii
+        //    SetOutputBox();
+        //    renderer->GetRenderWindow()->Render();
+    } // if size
+
+    
+
+    
+    /*
+    
     // EED 2022-05-19
        //if (this->renderer==NULL)
     if (GetViewShowNPoints()->renderer==NULL)
@@ -998,6 +1058,8 @@ void  WidgetShowNPoints::SetInitLstPoints( std::vector<double> initLstPointsX,
                //      SetOutputBox(); 
                //      renderer->GetRenderWindow()->Render();
        } // if size
+     
+   */
 }
 
 //------------------------------------------------------------------------
index f4531493ef56572a95c5b013666c981bd324bc72..2ab28bb0c4bd9f50a707253ec06d0bb4ca15ebfb 100644 (file)
@@ -102,7 +102,7 @@ class WidgetShowNPoints : public wxPanel
       int GetLstModelShowNPointsSize();
          ModelShowNPoints* GetModelShowNPoints();
       ViewShowNPoints* GetViewShowNPoints();
-         void SetInitLstPoints( std::vector<double> initLstPointsX,  std::vector<double> initLstPointsY, std::vector<double> initLstPointsZ, std::vector<std::string> initLstLabels );
+         void SetInitLstPoints( std::vector<double> initLstPointsX,  std::vector<double> initLstPointsY, std::vector<double> initLstPointsZ, std::vector<std::string> initLstLabels,  std::vector<int> initLstIndexs );
 
       void          SetType(int type);
       int           GetType();