]> Creatis software - creaMaracasVisu.git/commitdiff
#3589 manualContourModelSplineForceOpen vtk9itk5wx3-macos
authoreduardo.davila@creatis.insa-lyon.fr <eduardo.davila@creatis.insa-lyon.fr>
Tue, 21 Apr 2026 08:34:20 +0000 (10:34 +0200)
committereduardo.davila@creatis.insa-lyon.fr <eduardo.davila@creatis.insa-lyon.fr>
Tue, 21 Apr 2026 08:34:20 +0000 (10:34 +0200)
13 files changed:
bbtk/src/bbcreaMaracasVisuReadCreaContourFile.cxx
bbtk/src/bbcreaMaracasVisuReadCreaContourFile.h
bbtk/src/bbcreaMaracasVisuTubeFilter.cxx
bbtk/src/bbcreaMaracasVisuTubeFilter.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/ViewShowNPoints.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/WidgetShowNPoints.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/creaContoursFactory.cpp
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualBaseModel.cpp
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualBaseModel.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualContourModel.cpp
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualContourModel.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualContourModelSplineForceOpen.cpp [new file with mode: 0644]
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualContourModelSplineForceOpen.h [new file with mode: 0644]

index 6aea2be219315664237a453066141d07bd70dd3a..c1a267aeda2cb175305fe823ca636815a130c513 100644 (file)
@@ -152,9 +152,10 @@ void ReadCreaContourFile::Process()
 //    bbSetOutputOut( bbGetInputIn() );
 //    std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
     
-    std::map<int,  std::vector<double> >  mapX;
-    std::map<int,  std::vector<double> >  mapY;
-    std::map<int,  std::vector<double> >  mapZ;
+    std::map<int,  std::vector<double> >    mapX;
+    std::map<int,  std::vector<double> >    mapY;
+    std::map<int,  std::vector<double> >    mapZ;
+    std::map<int,  int >                    mapTypeModel;
 
     if (bbGetInputFileNameRoi().compare("")==0)
     {
@@ -203,7 +204,7 @@ void ReadCreaContourFile::Process()
                     fscanf(ff,"%s",tmp);  //
                     fscanf(ff,"%s",tmp);  // TypeModel
                     fscanf(ff,"%d",&TypeModel);  //
-                    if ((TypeModel==1) || (TypeModel==6)  )
+                    if ((TypeModel==1) || (TypeModel==6)|| (TypeModel==14)  )   // 1:Slice 6:Line 14:SliceForceOpen
                     {
                         fscanf(ff,"%s",tmp);  // NumberOfControlPoints
                         fscanf(ff,"%d",&NumberOfControlPoints);  //
@@ -223,7 +224,8 @@ void ReadCreaContourFile::Process()
                             {
                                 LstX.push_back(zz);
                                 LstY.push_back(x);
-                                LstZ.push_back(y);
+//                                LstZ.push_back(y);
+                                LstZ.push_back( (y*(-1)) + (dimY-1) );
                             } // if FromDirection
                             if (bbGetInputFromDirection()==2)  // XZ
                             {
@@ -232,9 +234,10 @@ void ReadCreaContourFile::Process()
                                 LstZ.push_back( (y*(-1)) + (dimY-1) );
                             } // if FromDirection
                         } // for iControlPoint
-                        mapX[zz] = LstX;
-                        mapY[zz] = LstY;
-                        mapZ[zz] = LstZ;
+                        mapX[zz]        = LstX;
+                        mapY[zz]        = LstY;
+                        mapZ[zz]        = LstZ;
+                        mapTypeModel[zz]= TypeModel;
                     } // TypeModel
                     fscanf(ff,"%s",tmp);  // TypeView
                     fscanf(ff,"%s",tmp);  //
@@ -251,6 +254,7 @@ void ReadCreaContourFile::Process()
     std::vector<double> LstY;
     std::vector<double> LstZ;
     std::vector<int>    LstIndexs;
+    std::vector<int>    LstTypeModel;
 
     // Order block by zz
     for( std::map<int, std::vector<double> >::iterator iter = mapX.begin();
@@ -286,11 +290,25 @@ void ReadCreaContourFile::Process()
             LstZ.push_back( iter->second[i] );
         } // for i
     } // for mapZ
-    
+
+    for( std::map<int, int >::iterator iter = mapTypeModel.begin();
+         iter != mapTypeModel.end();
+         ++iter )
+    {
+        LstTypeModel.push_back( iter->second );
+        
+        //int i,size = iter->second.size();
+        //for (i=0;i<size;i++)
+        //{
+        //    LstTypeModel.push_back( iter->second[i] );
+        //} // for i
+    } // for mapTypeModel
+
     bbSetOutputLstX( LstX );
     bbSetOutputLstY( LstY );
     bbSetOutputLstZ( LstZ );
     bbSetOutputLstIndexs( LstIndexs );
+    bbSetOutputLstTypeModel( LstTypeModel );
 }
 
  
index 035e9997ff2c98e511fc19f3caba4efe433d6e8b..7620b5fd399d351b3e854e5cf61f3853c07679d0 100644 (file)
@@ -19,16 +19,17 @@ class bbcreaMaracasVisu_EXPORT ReadCreaContourFile
 //===== 
 // 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)
 //===== 
-  BBTK_DECLARE_INPUT(FileNameRoi,std::string);
-  BBTK_DECLARE_INPUT(FromDirection,int);
-
-  BBTK_DECLARE_OUTPUT(LstX,std::vector<double>);
-  BBTK_DECLARE_OUTPUT(LstY,std::vector<double>);
-  BBTK_DECLARE_OUTPUT(LstZ,std::vector<double>);
-  BBTK_DECLARE_OUTPUT(LstIndexs,std::vector<int>);
-  BBTK_PROCESS(Process);
-  void Process();
-//===== 
+    BBTK_DECLARE_INPUT(FileNameRoi,std::string);
+    BBTK_DECLARE_INPUT(FromDirection,int);
+
+    BBTK_DECLARE_OUTPUT(LstX,std::vector<double>);
+    BBTK_DECLARE_OUTPUT(LstY,std::vector<double>);
+    BBTK_DECLARE_OUTPUT(LstZ,std::vector<double>);
+    BBTK_DECLARE_OUTPUT(LstIndexs,std::vector<int>);
+    BBTK_DECLARE_OUTPUT(LstTypeModel,std::vector<int>);
+    BBTK_PROCESS(Process);
+    void Process();
+//=====
 // 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)
 //===== 
 };
@@ -46,6 +47,7 @@ BBTK_BEGIN_DESCRIBE_BLACK_BOX(ReadCreaContourFile,bbtk::AtomicBlackBox);
   BBTK_OUTPUT(ReadCreaContourFile,LstY,"Vetor Y",std::vector<double>,"");
   BBTK_OUTPUT(ReadCreaContourFile,LstZ,"Vetor Z",std::vector<double>,"");
   BBTK_OUTPUT(ReadCreaContourFile,LstIndexs,"List of : number of elements by segments",std::vector<int>,"");
+  BBTK_OUTPUT(ReadCreaContourFile,LstTypeModel,"List of : Type Model ( 1:Slice 6:Line 14:SliceForceOpen)",std::vector<int>,"");
 
 BBTK_END_DESCRIBE_BLACK_BOX(ReadCreaContourFile);
 //===== 
index e3989b55f32b3b274128bc5fdc82736f6db175f9..a8d856f44037d7034f2327bebe923d5e888acae4 100644 (file)
 #include "bbcreaMaracasVisuTubeFilter.h"
 #include "bbcreaMaracasVisuPackage.h"
 
-
-#include <vtkPolyData.h>
-#include <vtkPoints.h>
-#include <vtkCellArray.h>
-#include <vtkDoubleArray.h>
-#include <vtkPolyData.h>
-#include <vtkPointData.h>
-
-#include <vtkCell.h>
-#include <vtkCellData.h>
-#include <vtkDataSet.h>
-#include <vtkDataSetAttributes.h>
-#include <vtkProperty.h>
-#include <vtkTubeFilter.h>
-
-#include <vtkDataSetMapper.h>
-#include <vtkPolyDataMapper.h>
-
-
 namespace bbcreaMaracasVisu
 {
-
        MaracasTubeFilter::MaracasTubeFilter()
        {
+        points      = NULL;
+        lines       = NULL;
+        polyData    = NULL;
+        tubeRadius  = NULL;
+        colors      = NULL;
+        tube        = NULL;
+        mapper      = NULL;
        }
 
        MaracasTubeFilter::~MaracasTubeFilter()
@@ -62,17 +49,13 @@ namespace bbcreaMaracasVisu
                {
                        renderer->RemoveActor(actor);
                }
-               
        }
        
-
        void MaracasTubeFilter::SetvtkRenderer(vtkRenderer *render)
        {
                this->renderer = render;
        }
        
-
-       
        void MaracasTubeFilter::SetlstPoints( std::vector<double> lstPointX , std::vector<double> lstPointY , std::vector<double> lstPointZ )
        {
                this->lstPointX = lstPointX;
@@ -80,13 +63,11 @@ namespace bbcreaMaracasVisu
                this->lstPointZ = lstPointZ;
        }
        
-       
        void MaracasTubeFilter::SetlstColour( std::vector<double> lstColour  )
        {
                this->lstColour=lstColour;
        }
 
-       
        void MaracasTubeFilter::SetlstRadius( std::vector<double> lstRadius  )
        {
                this->lstRadius = lstRadius;
@@ -102,15 +83,167 @@ namespace bbcreaMaracasVisu
                this->transform = transform;
        }
 
-       vtkActor *MaracasTubeFilter::GetActor()
-       {
-               return actor;
-       }
-       
+    vtkActor* MaracasTubeFilter::GetActor()
+    {
+        return actor;
+    }
+
+    vtkPolyData* MaracasTubeFilter::GetPolyDataTube()
+    {
+        return polydataTube;
+    }
+
+
+void MaracasTubeFilter::Run()
+{
+    unsigned int i;
+    unsigned int nTv = 32;       // No. of surface elements for each tube vertex
+    
+    if (points!=NULL)       points->Delete();
+    if (lines!=NULL)        lines->Delete();
+    if (polyData!=NULL)     polyData->Delete();
+    if (tubeRadius!=NULL)   tubeRadius->Delete();
+    if (colors!=NULL)       colors->Delete();
+    if (tube!=NULL)         tube->Delete();
+    if (mapper!=NULL)       mapper->Delete();
+    
+    // Create points and cells
+//EED1    vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();
+    points = vtkPoints::New();
+    
+    for(i = 0; i < lstPointX.size(); i++)
+    {
+        points->InsertPoint(i, lstPointX[i],  lstPointY[i],  lstPointZ[i]);
+    }
+    
+    //EED1    vtkSmartPointer<vtkCellArray> lines =    vtkSmartPointer<vtkCellArray>::New();
+    lines = vtkCellArray::New();
+    
+    lines->InsertNextCell( lstPointX.size() );
+    for (i = 0; i < lstPointX.size(); i++)
+    {
+        lines->InsertCellPoint(i);
+    }
+    
+    //EED1    vtkSmartPointer<vtkPolyData> polyData =    vtkSmartPointer<vtkPolyData>::New();
+    polyData = vtkPolyData::New();
+    
+    polyData->SetPoints(points);
+    polyData->SetLines(lines);
+    
+    double radio;
+    // Varying tube radius using sine-function
+    
+    //EED1    vtkSmartPointer<vtkDoubleArray> tubeRadius = vtkSmartPointer<vtkDoubleArray>::New();
+    tubeRadius = vtkDoubleArray::New();
+
+    tubeRadius->SetName("TubeRadius");
+    tubeRadius->SetNumberOfTuples( lstPointX.size() );
+    for (i=0 ;i<lstPointX.size() ; i++)
+    {
+        if (lstRadius.size()==0)
+        {
+           radio=1;
+        } else if (i<lstRadius.size()) {
+          radio = lstRadius[i];
+        } else if (i>=lstRadius.size()) {
+          radio= lstRadius[ lstRadius.size()-1 ];
+        }
+        tubeRadius->SetTuple1(i, radio );
+    }
+    polyData->GetPointData()->AddArray(tubeRadius);
+    polyData->GetPointData()->SetActiveScalars("TubeRadius");
+    
+    // RBG array (could add Alpha channel too I guess...)
+    // Varying from blue to red
+    
+    //EED1    vtkSmartPointer<vtkUnsignedCharArray> colors = vtkSmartPointer<vtkUnsignedCharArray>::New();
+    colors = vtkUnsignedCharArray::New();
+
+    colors->SetName("Colors");
+    colors->SetNumberOfComponents(3);
+    colors->SetNumberOfTuples( lstPointX.size() );
+    int numberOfColours = lstColour.size()/3;
+    int indexcolour;
+    for (i = 0; i < lstPointX.size() ;i++)
+    {
+        if (numberOfColours==0){
+            colors->InsertTuple3(i, 1 ,  1 ,  1 );
+        } else {
+            if (i<numberOfColours){
+                indexcolour=i*3;
+            } else {
+                indexcolour=(numberOfColours-1)*3;
+            }
+            colors->InsertTuple3(i, 255*lstColour[indexcolour+0] ,  255*lstColour[indexcolour+1] ,  255*lstColour[indexcolour+2] );
+        }
+    } // for
+    polyData->GetPointData()->AddArray(colors);
+    
+    //EED1    vtkSmartPointer<vtkTubeFilter> tube = vtkSmartPointer<vtkTubeFilter>::New();
+    tube = vtkTubeFilter::New();
+    
+    tube->CappingOn();
+
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
+    tube->SetInput(polyData);
+#else
+    tube->SetInputData(polyData);
+#endif
+
+    tube->SetNumberOfSides(nTv);
+    tube->SetVaryRadiusToVaryRadiusByAbsoluteScalar();
+    tube->Update();
+    
+    //EED1    vtkSmartPointer<vtkPolyDataMapper> mapper =    vtkSmartPointer<vtkPolyDataMapper>::New();
+    mapper = vtkPolyDataMapper::New();
+    
+//EED1    mapper->SetInputConnection( tube->GetOutputPort() );
+    mapper->SetInputDataObject( tube->GetOutput() );
+    polydataTube = tube->GetOutput();
+
+//        mapper->ScalarVisibilityOn();
+//        mapper->SetScalarModeToUsePointFieldData();
+    
+    mapper->ScalarVisibilityOn();
+    
+//        mapper->SetScalarModeToUseCellData();
+//        mapper->SetScalarModeToUseCellFieldData();
+//        mapper->SetScalarModeToUseFieldData();
+//        mapper->SetScalarModeToUsePointData();
+    mapper->SetScalarModeToUsePointFieldData();
+    
+    mapper->SetColorModeToDefault();
+//        mapper->SetColorModeToMapScalars();
+            
+    mapper->SelectColorArray("Colors");
+    
+    //EED1        vtkSmartPointer<vtkActor> actor =vtkSmartPointer<vtkActor>::New();
+    actor = vtkActor::New();
+    
+    actor->SetMapper(mapper);
+    actor->GetProperty()->SetOpacity( opacity );
+
+    if ( transform!=NULL )
+    {
+        actor->SetUserTransform( transform );
+    } // if transform NULL
+    
+    // Interface Update
+    if (renderer!=NULL )
+    {
+        renderer->AddActor(actor);
+    } // if render NULL
+}
+
+
+
+/*
        void MaracasTubeFilter::Run()
        {
                unsigned int i;
-               unsigned int nTv = 8;       // No. of surface elements for each tube vertex             
+               unsigned int nTv = 32;       // No. of surface elements for each tube vertex            
                
                // Create points and cells 
                vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();
@@ -126,7 +259,7 @@ namespace bbcreaMaracasVisu
                        lines->InsertCellPoint(i);
                }
                
-               vtkSmartPointer<vtkPolyData> polyData = vtkSmartPointer<vtkPolyData>::New();
+        vtkSmartPointer<vtkPolyData> polyData =        vtkSmartPointer<vtkPolyData>::New();
                polyData->SetPoints(points);
                polyData->SetLines(lines);
                
@@ -188,7 +321,12 @@ namespace bbcreaMaracasVisu
                tube->SetVaryRadiusToVaryRadiusByAbsoluteScalar();
                
                vtkSmartPointer<vtkPolyDataMapper> mapper =     vtkSmartPointer<vtkPolyDataMapper>::New();
-               mapper->SetInputConnection(tube->GetOutputPort());
+               mapper->SetInputConnection( tube->GetOutputPort() );
+
+        polydataTube = vtkPolyData::New();
+        polydataTube->ShallowCopy ( tube->GetOutput() );
+        //        polydataTube = tube->GetOutput();
+
 //             mapper->ScalarVisibilityOn();
 //             mapper->SetScalarModeToUsePointFieldData();
                
@@ -202,8 +340,7 @@ namespace bbcreaMaracasVisu
                
                mapper->SetColorModeToDefault();
 //             mapper->SetColorModeToMapScalars();             
-               
-               
+                               
                mapper->SelectColorArray("Colors");
                
                //              vtkSmartPointer<vtkActor> actor =vtkSmartPointer<vtkActor>::New();
@@ -214,19 +351,18 @@ namespace bbcreaMaracasVisu
                if ( transform!=NULL )
                {
                        actor->SetUserTransform( transform );
-               }
+               } // if transform NULL
                
                // Interface Update
                if (renderer!=NULL )
                {
                        renderer->AddActor(actor);
-               }
-                               
+               } // if render NULL
        }
-       
-       
-       
-       
+*/
 BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,TubeFilter)
 BBTK_BLACK_BOX_IMPLEMENTATION(TubeFilter,bbtk::AtomicBlackBox);
 //===== 
@@ -234,7 +370,6 @@ BBTK_BLACK_BOX_IMPLEMENTATION(TubeFilter,bbtk::AtomicBlackBox);
 //===== 
 void TubeFilter::Process()
 {
-
 // THE MAIN PROCESSING METHOD BODY
 //   Here we simply set the input 'In' value to the output 'Out'
 //   And print out the output value
@@ -251,24 +386,24 @@ void TubeFilter::Process()
        { 
                delete tubefilter;
        }
-       
        tubefilter = new MaracasTubeFilter();
        tubefilter->SetvtkRenderer( bbGetInputRenderer() );     
        tubefilter->SetlstPoints( bbGetInputlstPointX(), bbGetInputlstPointY(), bbGetInputlstPointZ() );
 
        // Sets the default value for radius to 1 everywhere, if the radius input vevctor is empty.
        if (bbGetInputlstRadio().size() == 0)
-         {
+    {
            std::vector<double> radio;
            radio.resize(bbGetInputlstPointX().size(), 1.);
            bbSetInputlstRadio(radio);
-         }
+    }
        tubefilter->SetlstRadius( bbGetInputlstRadio() );
        tubefilter->SetOpacity( bbGetInputOpacity() );
        tubefilter->SetTransform( bbGetInputTransform() );      
        tubefilter->SetlstColour( bbGetInputColour() ); 
        tubefilter->Run();
-    bbSetOutputOutAxis( tubefilter->GetActor() );      
+    bbSetOutputOutMesh( tubefilter->GetPolyDataTube() );
+    bbSetOutputOutAxis( tubefilter->GetActor() );
 }
        
 //===== 
@@ -280,17 +415,15 @@ void TubeFilter::bbUserSetDefaultValues()
 //    Here we initialize the input 'In' to 0
        bbSetInputOpacity(1);
        bbSetInputTransform(NULL);
-       
        std::vector<double> colour;
        // 0- gray
        colour.push_back(1.0);
        colour.push_back(0.0);
        colour.push_back(0.0);
        bbSetInputColour(colour);
-
        std::vector<double> lstRadius;
        lstRadius.push_back(1);
-        bbSetInputColour(lstRadius);
+    bbSetInputColour(lstRadius);
 }
        
 //===== 
@@ -316,7 +449,6 @@ void TubeFilter::bbUserFinalizeProcessing()
 //    if any
 }
        
-}
-// EO namespace bbcreaMaracasVisu
+}// EO namespace bbcreaMaracasVisu
 
 
index 5228422d36a8c3249c2a42757cf3fb0a8bbdad9f..d7c1a374d2052ee880272ac11581e810008046ec 100644 (file)
 #include <vtkRenderer.h>
 #include <vtkTransform.h>
 #include <vtkActor.h>
+#include <vtkPolyData.h>
 #include <vtkLinearTransform.h>
-#include <vtkSmartPointer.h>
+// #include <vtkSmartPointer.h>
+
+#include <vtkPolyData.h>
+#include <vtkPoints.h>
+#include <vtkCellArray.h>
+#include <vtkDoubleArray.h>
+#include <vtkPolyData.h>
+#include <vtkPointData.h>
+
+#include <vtkCell.h>
+#include <vtkCellData.h>
+#include <vtkDataSet.h>
+#include <vtkDataSetAttributes.h>
+#include <vtkProperty.h>
+#include <vtkTubeFilter.h>
+
+#include <vtkDataSetMapper.h>
+#include <vtkPolyDataMapper.h>
+
+
+
 
 namespace bbcreaMaracasVisu
 {
@@ -47,19 +68,31 @@ namespace bbcreaMaracasVisu
        public:
                MaracasTubeFilter();
                ~MaracasTubeFilter();
-
                void SetvtkRenderer( vtkRenderer *render);
                void SetlstPoints( std::vector<double> lstPointX , std::vector<double> lstPointY , std::vector<double> lstPointZ );
                void SetlstRadius( std::vector<double> lstRadius  );
                void SetlstColour( std::vector<double> lstColour  );
                void SetOpacity(double opacity);
                void SetTransform( vtkLinearTransform* transform  );
-               vtkActor *GetActor();
-               void Run();
-
-               vtkRenderer *renderer;
-               vtkSmartPointer<vtkActor> actor;
-
+               vtkActor    *GetActor();
+        vtkPolyData *GetPolyDataTube();
+               void        Run();
+               vtkRenderer                     *renderer;
+               vtkSmartPointer<vtkActor>       actor;
+                
+//        vtkSmartPointer<vtkPolyData>    polyData;
+        vtkSmartPointer<vtkPolyData>    polydataTube;
+        
+        
+        vtkPoints               *points;
+        vtkCellArray            *lines;
+        vtkPolyData             *polyData;
+        vtkDoubleArray          *tubeRadius;
+        vtkUnsignedCharArray    *colors;
+        vtkTubeFilter           *tube;
+        vtkPolyDataMapper       *mapper;
+        
+        
                double opacity;
                vtkLinearTransform *transform;
                std::vector<double> lstPointX;
@@ -67,7 +100,6 @@ namespace bbcreaMaracasVisu
                std::vector<double> lstPointZ;
                std::vector<double> lstRadius;
                std::vector<double> lstColour;
-
        };
 
 class bbcreaMaracasVisu_EXPORT TubeFilter
@@ -88,6 +120,7 @@ class bbcreaMaracasVisu_EXPORT TubeFilter
        BBTK_DECLARE_INPUT(Transform, vtkLinearTransform *);
 
        BBTK_DECLARE_OUTPUT(OutAxis,vtkProp3D *);
+    BBTK_DECLARE_OUTPUT(OutMesh,vtkPolyData *);
   BBTK_PROCESS(Process);
   void Process();
 
@@ -112,6 +145,7 @@ BBTK_BEGIN_DESCRIBE_BLACK_BOX(TubeFilter,bbtk::AtomicBlackBox);
        BBTK_INPUT(TubeFilter,Transform,"vtkTransform", vtkLinearTransform *,"");
        BBTK_INPUT(TubeFilter,Opacity,"Opacity (default 1)",double,"");
        BBTK_OUTPUT(TubeFilter,OutAxis,"Tube Actor",vtkProp3D *,"");
+    BBTK_OUTPUT(TubeFilter,OutMesh,"PolyData output tube",vtkPolyData *,"");
 BBTK_END_DESCRIBE_BLACK_BOX(TubeFilter);
 //=====
 // 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)
index 80f127ad10bad71a59e05ddf591114cd36947843..b7e7a546e0d02b6762999dd343e75d536b471fb0 100644 (file)
@@ -38,8 +38,11 @@ void ViewShowNPoints::RefreshPoint(int id)
 #else
     lstSourceSphere[id]->Update();
 #endif
-    lstActorsText[id]->SetInput( label.c_str()  );
-    lstActorsText[id]->SetPosition(  radio+spc[0]*x , spc[1]*y , spc[2]*z );
+    if (id < lstActorsText.size() )
+    {
+        lstActorsText[id]->SetInput( label.c_str()  );
+        lstActorsText[id]->SetPosition(  radio+spc[0]*x , spc[1]*y , spc[2]*z );
+    } // if  id < lstActorsText.size
 }
 
 //------------------------------------------------------------------------
@@ -165,12 +168,14 @@ void ViewShowNPoints::TryToShowActorInRender( int id, bool show )
             renderer->RemoveActor( lstActorsText[id] );
         } // if lstActorAdded  true
     } else { // try to add actor to render
-        if (lstActorAdded[id]==false)
-        {
-            lstActorAdded[id]=true;
-            renderer->AddActor( lstActorsSphere[id] );
-            renderer->AddActor( lstActorsText[id] );
-        } // if lstActorAdded  false
+        if (id<lstActorAdded.size() ) {
+            if (lstActorAdded[id]==false)
+            {
+                lstActorAdded[id]=true;
+                renderer->AddActor( lstActorsSphere[id] );
+                renderer->AddActor( lstActorsText[id] );
+            } // if lstActorAdded  false
+        } // if  id<lstActorAdded.size
     } // if show
 }
 
index f6301e7ce23fade1788793cab70f4d4b4733f433..6ef7c20e65d348fba6eb29f9614da29b5232cc58 100644 (file)
@@ -1732,8 +1732,6 @@ void WidgetShowNPoints::RefreshColourCollection()
     colourActualGroup.push_back(0.8);
     colourActualGroup.push_back(0.4);
     colourActualGroup.push_back(0.4);
-
-    
     // For all collections
     SetColour( colourAll );
     int sizeLstPoints;
@@ -1747,7 +1745,6 @@ void WidgetShowNPoints::RefreshColourCollection()
             lstViewShowNPoints[mActualCollection] -> mopacity   = sCtrlOpacity->GetValue()*10.0/100.0;
             lstViewShowNPoints[mActualCollection] -> ratioRadio = 1.2;
             lstViewShowNPoints[mActualCollection] -> RefreshEachPoint();
-            
             //Actual Point
             int curPnt      = lstModelShowNPoints[mActualCollection]->GetIdCurrentPoint();
             sizeLstPoints   = lstModelShowNPoints[mActualCollection]->GetLstPointsSize();
@@ -1775,6 +1772,7 @@ void WidgetShowNPoints::RefreshColourCollection()
                 lstViewShowNPoints[iCollection]->TryToShowActorsInRender(true);
       //          lstViewShowNPoints[i] -> mopacity   = sCtrlOpacity->GetValue()*10.0/100.0;
             }
+
             lstViewShowNPoints[iCollection]->RefreshEachPoint();
         }// if mActualCollection
     } // for i
@@ -1878,7 +1876,7 @@ void WidgetShowNPoints::OnLoadCollections_( std::string filename )
     if (lstModelShowNPoints.size()==1)
     {
         if (GetModelShowNPoints()->GetLstPointsSize()==0) { okEraseFirstGroup=true; }
-    }
+    } // if  lstModelShowNPoints.size()==1
     FILE *ff = fopen( filename.c_str() , "r+" );
     if (ff!=NULL)
     {
@@ -1916,7 +1914,6 @@ void WidgetShowNPoints::OnLoadCollections_( std::string filename )
     StopTrackPoint();
 }
 
-
 //------------------------------------------------------------------------
 void WidgetShowNPoints::OnLoadCollectionsIdsCurrent_( std::string filename )
 {
index c502c56df4126f0f989d63fa18b03f58f8c4f04b..3210844a13b101a1325ccc8d40dfd2646d73038d 100644 (file)
 #include "manualContourModelRotationTool.h"
 #include "manualViewRotationTool.h"
 #include "manualContourModelPolygon.h"
+#include "manualContourModelSplineForceOpen.h"
 #include "manualView3DContour.h"
 #include "manualContour3DControler.h"
 #include "manualContour3V3DControler.h"
 
-
 creaContoursFactory::creaContoursFactory()
 {
-
 }
 
-
 creaContoursFactory::~creaContoursFactory()
 {
-
 }
 
 manualContourBaseControler* creaContoursFactory::getContourControler(int typeContour)
@@ -109,7 +106,6 @@ manualContourBaseControler* creaContoursFactory::getContourControler(int typeCon
                manContourControl       = new manualContourControler();
        }
 
-
        //JPReyes 13/04/2010
        //Spline 3D
        if(typeContour==12)
@@ -117,6 +113,13 @@ manualContourBaseControler* creaContoursFactory::getContourControler(int typeCon
                manContourControl = new manualContour3V3DControler();
        }
 
+    //EED 2026-04
+    //spline Force Open
+    if (typeContour==14)
+    {
+        manContourControl    = new manualContourControler();
+    }
+
        return manContourControl;
 
 }
@@ -170,6 +173,14 @@ manualContourBaseControler* creaContoursFactory::getContourControler(std::string
        {
                manContourControl = getContourControler(12);
        }
+    
+    //EED 2026-04
+    if (typeContour.compare("splineforceopen")==0)
+    {
+            manContourControl = getContourControler(14);
+    }
+
+    
        return manContourControl;
 }
 
@@ -231,6 +242,14 @@ manualViewBaseContour* creaContoursFactory::getCountourView (int typeContour)
        {
                manViewerContour        = new manualView3DContour();
        }
+    
+    //EED 2026-04
+    //spline force open
+    if (typeContour==14)
+    {
+        manViewerContour    = new manualViewContour();
+    }
+
        return manViewerContour;
 }
 
@@ -286,6 +305,14 @@ manualViewBaseContour* creaContoursFactory::getCountourView (std::string typeCon
                manViewerContour = getCountourView(12);
        }
 
+    // EED  2026-04
+    // spine force open
+    if (typeContour.compare("splineforceopen")==0)
+    {
+        manViewerContour = getCountourView(14);
+    }
+
+
        return manViewerContour;
 
 }
@@ -374,12 +401,20 @@ manualBaseModel* creaContoursFactory::getContourModel(int typeContour)
        }
 
        
-       //JPReyes 13/04/2010
-       //Spline 3D
-       if(typeContour==12)
-       {
-               manModelContour = new manualContourModel();
-       }
+    //JPReyes 13/04/2010
+    //Spline 3D
+    if(typeContour==12)
+    {
+        manModelContour = new manualContourModel();
+    }
+
+    //EED 2026-04
+    //spline force open
+    if(typeContour==14)
+    {
+        manModelContour = new manualContourModelSplineForceOpen();
+//        manModelContour->SetForceOpenContour(true);
+    }
 
        return manModelContour;
 }
@@ -430,7 +465,6 @@ manualBaseModel* creaContoursFactory::getContourModel(std::string typeContour)
                manModelContour = getContourModel(10);
        }
 
-       
        //JPReyes 13/04/2010
        //Spline 3D
        if (typeContour.compare("spline3D")==0)
@@ -438,5 +472,12 @@ manualBaseModel* creaContoursFactory::getContourModel(std::string typeContour)
                manModelContour = getContourModel(12);
        }
 
+    // EED 2026-04
+    // spline force open
+    if (typeContour.compare("splineforceopen")==0)
+    {
+        manModelContour = getContourModel(14);
+    }
+
        return manModelContour;
 }
index fa9360b417c56597917bbf8af58ca63d80dc076e..5484b68fb1594197369482e1ed69cb339342f361 100644 (file)
@@ -357,12 +357,21 @@ double manualBaseModel::GetPathArea( double *spc )
 {
        return 0.0;
 }
+
 void manualBaseModel::GetNearestPointAndNormal(double *p, double *rp,  double *rn)
 {
 }
+
+// virtual
+void manualBaseModel::SetForceOpenContour(bool forceOpenContour)
+{
+}
+
+// virtual
 void manualBaseModel::SetCloseContour(bool closeContour)
 {
 }
+
 bool manualBaseModel::IfCloseContour()
 {
        return false;
index e30c00f8bf0319fd9d77224a86985d5cc0f5d120..bad13f402821cdc27742c3d884a4999b1669985f 100644 (file)
@@ -89,6 +89,7 @@ public:
        virtual void                    GetNearestPointAndNormal(double *p, double *rp,  double *rn);
 
        virtual void                    SetCloseContour(bool closeContour);
+    virtual void            SetForceOpenContour(bool closeContour);
        virtual bool                    IfCloseContour();
 
        // RaC 27-09-09 ----
@@ -108,9 +109,9 @@ public:
        * Assigns the parameter value to the label
        * @param newLabel New label of the contour
        */
-       void SetLabel(std::string newLabel);
+       void        SetLabel(std::string newLabel);
        std::string GetLabel();
-       void SetLabel2(std::string newLabel);
+       void        SetLabel2(std::string newLabel);
        std::string GetLabel2();
        
        /*
index 433e1dacd011b16f80e960cae4581fb6b335d4bc..1acf649c47edb02e8247aba9212a646721a3a3bf 100644 (file)
@@ -34,6 +34,7 @@ manualContourModel::manualContourModel()
     _cntSplineX = vtkKochanekSpline::New( );
     _cntSplineY = vtkKochanekSpline::New( );
     _cntSplineZ = vtkKochanekSpline::New( );
+//EED2026    this->SetForceOpenContour(false);
        this->SetCloseContour(true);
     _cntSplineX->SetDefaultTension( 0 );
        _cntSplineX->SetDefaultBias( 0 );
@@ -282,19 +283,37 @@ void manualContourModel::SetNumberOfPointsSpline(int size)
 
 // ----------------------------------------------------------------------------
 
+/*EED2026
+//EED 2026-04
+// ----------------------------------------------------------------------------
+void manualContourModel::SetForceOpenContour(bool forceOpenContour)
+{
+    _forceOpenContour = forceOpenContour;
+}
+*/
+
+//Virtual
 void manualContourModel::SetCloseContour(bool closeContour)
 {
-       _closeContour = closeContour;
-       if (_closeContour==true)
-       {
-               _cntSplineX->ClosedOn();
-               _cntSplineY->ClosedOn();
-               _cntSplineZ->ClosedOn();
-       } else {
-               _cntSplineX->ClosedOff();
-               _cntSplineY->ClosedOff();
-               _cntSplineZ->ClosedOff();
-       }
+//EED2026
+//EED 2026-04
+//    if (_forceOpenContour==true)
+//    {
+//        _closeContour = false;
+//    } else {
+//        _closeContour = closeContour;
+//    }
+    _closeContour = closeContour;
+    if (_closeContour==true)
+    {
+        _cntSplineX->ClosedOn();
+        _cntSplineY->ClosedOn();
+        _cntSplineZ->ClosedOn();
+    } else {
+        _cntSplineX->ClosedOff();
+        _cntSplineY->ClosedOff();
+        _cntSplineZ->ClosedOff();
+    }
 }
 
 // ----------------------------------------------------------------------------
@@ -698,10 +717,7 @@ void manualContourModel::OpenData(FILE *ff)
        SetRealSize(atof(tmp));
 }
 
-//------------------------------------------------------------------------------------------------------------
-
 // ---------------------------------------------------------------------------
-
 void manualContourModel::CopyAttributesTo( manualContourModel * cloneObject)
 {
        // Fathers object
@@ -714,11 +730,12 @@ void manualContourModel::CopyAttributesTo( manualContourModel * cloneObject)
                cloneObject->AddManualPoint( GetManualPoint( i )->Clone() );
        }
        cloneObject->SetNumberOfPointsSpline( GetNumberOfPointsSpline () );
-       cloneObject->SetCloseContour( _closeContour );
+    cloneObject->SetCloseContour( _closeContour );
+//EED2026
+//    cloneObject->SetForceOpenContour( _forceOpenContour );
        cloneObject->UpdateSpline();
 }
 
-
 // ---------------------------------------------------------------------------
 void manualContourModel::AddManualPoint( manualPoint* theManualPoint )//private
 {
@@ -732,7 +749,6 @@ std::vector<manualBaseModel*> manualContourModel::ExploseModel(  )
        return lstTmp;
 }
 
-
 // ----------------------------------------------------------------------------
 void manualContourModel::Transform_Ax_Plus_B (double Ax, double Bx, double Ay, double By)
 {
index b39f8439f000e1858fee4f113020f87f2e461f26..2a8a082e09ff7f2a7bd130365cdf65f625102bcb 100644 (file)
@@ -68,7 +68,11 @@ public:
        virtual void                    SetNumberOfPointsSpline(int size);
 
        virtual void                    UpdateSpline();
-       void                                    SetCloseContour(bool closeContour);
+    virtual void            SetCloseContour(bool closeContour);
+    
+//EED2026
+//    void                    SetForceOpenContour(bool forceOpenContour);
+    
        bool                                    IfCloseContour();
 //JSTG 25-02-08 -----------------------------------------------------------------
        //void                  GetSplinePoint(double t, double &x, double &y, double &z);      //Method Original
@@ -117,6 +121,10 @@ public:
        //int                                                   _sizePointsContour;
        //std::vector<manualPoint*>     _lstPoints;
        bool                                            _closeContour;
+  
+//EED2026
+//    bool                        _forceOpenContour;
+    
     vtkKochanekSpline                  *_cntSplineX;
     vtkKochanekSpline                  *_cntSplineY;
     vtkKochanekSpline                  *_cntSplineZ;
diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualContourModelSplineForceOpen.cpp b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualContourModelSplineForceOpen.cpp
new file mode 100644 (file)
index 0000000..0a5e0bd
--- /dev/null
@@ -0,0 +1,53 @@
+/*# ---------------------------------------------------------------------
+#
+# Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
+#                        pour la Sant�)
+# Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
+# Previous Authors : Laurent Guigues, Jean-Pierre Roux
+# CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
+#
+#  This software is governed by the CeCILL-B license under French law and
+#  abiding by the rules of distribution of free software. You can  use,
+#  modify and/ or redistribute the software under the terms of the CeCILL-B
+#  license as circulated by CEA, CNRS and INRIA at the following URL
+#  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+#  or in the file LICENSE.txt.
+#
+#  As a counterpart to the access to the source code and  rights to copy,
+#  modify and redistribute granted by the license, users are provided only
+#  with a limited warranty  and the software's author,  the holder of the
+#  economic rights,  and the successive licensors  have only  limited
+#  liability.
+#
+#  The fact that you are presently reading this means that you have had
+#  knowledge of the CeCILL-B license and that you accept its terms.
+# ------------------------------------------------------------------------ */
+
+#include "manualContourModelSplineForceOpen.h"
+
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+
+manualContourModelSplineForceOpen::manualContourModelSplineForceOpen() 
+: manualContourModel()
+{
+//EED2026
+//    SetForceOpenContour(true);
+    SetCloseContour(false);  // This is just for init the parameter
+}
+
+manualContourModelSplineForceOpen::~manualContourModelSplineForceOpen()
+{
+}
+
+//----------------------------------------------------------------
+int manualContourModelSplineForceOpen::GetTypeModel() //virtual 
+{
+       return 14;
+}
+
+void manualContourModelSplineForceOpen::SetCloseContour(bool closeContour)
+{
+    manualContourModel::SetCloseContour(false);  // This for open contour always for this manualContour
+}
diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualContourModelSplineForceOpen.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualContourModelSplineForceOpen.h
new file mode 100644 (file)
index 0000000..bbc743d
--- /dev/null
@@ -0,0 +1,47 @@
+/*# ---------------------------------------------------------------------
+#
+# Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
+#                        pour la Sant�)
+# Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
+# Previous Authors : Laurent Guigues, Jean-Pierre Roux
+# CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
+#
+#  This software is governed by the CeCILL-B license under French law and
+#  abiding by the rules of distribution of free software. You can  use,
+#  modify and/ or redistribute the software under the terms of the CeCILL-B
+#  license as circulated by CEA, CNRS and INRIA at the following URL
+#  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+#  or in the file LICENSE.txt.
+#
+#  As a counterpart to the access to the source code and  rights to copy,
+#  modify and redistribute granted by the license, users are provided only
+#  with a limited warranty  and the software's author,  the holder of the
+#  economic rights,  and the successive licensors  have only  limited
+#  liability.
+#
+#  The fact that you are presently reading this means that you have had
+#  knowledge of the CeCILL-B license and that you accept its terms.
+# ------------------------------------------------------------------------ */
+
+#ifndef manualContourModelSplineForceOpen_h
+#define manualContourModelSplineForceOpen_h
+
+#include "manualContourModel.h"
+
+//--------------------------------------------------------
+
+class creaMaracasVisu_EXPORT manualContourModelSplineForceOpen : public manualContourModel
+{
+public:
+       manualContourModelSplineForceOpen();
+       virtual ~manualContourModelSplineForceOpen();
+//     virtual manualContourModelSplineForceOpen *Clone();
+//     void CopyAttributesTo( manualContourModelSplineForceOpen *cloneObject);
+//     virtual void GetSpline_i_Point(int i, double *x, double *y, double *z);
+       virtual int             GetTypeModel();
+    virtual void    SetCloseContour(bool closeContour);
+
+//     virtual void UpdateSpline();
+};
+
+#endif // manualContourModelSplineForceOpen_h