From: eduardo.davila@creatis.insa-lyon.fr Date: Tue, 21 Apr 2026 08:34:20 +0000 (+0200) Subject: #3589 manualContourModelSplineForceOpen X-Git-Url: http://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=refs%2Fheads%2Fvtk9itk5wx3-macos;p=creaMaracasVisu.git #3589 manualContourModelSplineForceOpen --- diff --git a/bbtk/src/bbcreaMaracasVisuReadCreaContourFile.cxx b/bbtk/src/bbcreaMaracasVisuReadCreaContourFile.cxx index 6aea2be..c1a267a 100644 --- a/bbtk/src/bbcreaMaracasVisuReadCreaContourFile.cxx +++ b/bbtk/src/bbcreaMaracasVisuReadCreaContourFile.cxx @@ -152,9 +152,10 @@ void ReadCreaContourFile::Process() // bbSetOutputOut( bbGetInputIn() ); // std::cout << "Output value = " < > mapX; - std::map > mapY; - std::map > mapZ; + std::map > mapX; + std::map > mapY; + std::map > mapZ; + std::map 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 LstY; std::vector LstZ; std::vector LstIndexs; + std::vector LstTypeModel; // Order block by zz for( std::map >::iterator iter = mapX.begin(); @@ -286,11 +290,25 @@ void ReadCreaContourFile::Process() LstZ.push_back( iter->second[i] ); } // for i } // for mapZ - + + for( std::map::iterator iter = mapTypeModel.begin(); + iter != mapTypeModel.end(); + ++iter ) + { + LstTypeModel.push_back( iter->second ); + + //int i,size = iter->second.size(); + //for (i=0;isecond[i] ); + //} // for i + } // for mapTypeModel + bbSetOutputLstX( LstX ); bbSetOutputLstY( LstY ); bbSetOutputLstZ( LstZ ); bbSetOutputLstIndexs( LstIndexs ); + bbSetOutputLstTypeModel( LstTypeModel ); } diff --git a/bbtk/src/bbcreaMaracasVisuReadCreaContourFile.h b/bbtk/src/bbcreaMaracasVisuReadCreaContourFile.h index 035e999..7620b5f 100644 --- a/bbtk/src/bbcreaMaracasVisuReadCreaContourFile.h +++ b/bbtk/src/bbcreaMaracasVisuReadCreaContourFile.h @@ -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); - BBTK_DECLARE_OUTPUT(LstY,std::vector); - BBTK_DECLARE_OUTPUT(LstZ,std::vector); - BBTK_DECLARE_OUTPUT(LstIndexs,std::vector); - BBTK_PROCESS(Process); - void Process(); -//===== + BBTK_DECLARE_INPUT(FileNameRoi,std::string); + BBTK_DECLARE_INPUT(FromDirection,int); + + BBTK_DECLARE_OUTPUT(LstX,std::vector); + BBTK_DECLARE_OUTPUT(LstY,std::vector); + BBTK_DECLARE_OUTPUT(LstZ,std::vector); + BBTK_DECLARE_OUTPUT(LstIndexs,std::vector); + BBTK_DECLARE_OUTPUT(LstTypeModel,std::vector); + 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,""); BBTK_OUTPUT(ReadCreaContourFile,LstZ,"Vetor Z",std::vector,""); BBTK_OUTPUT(ReadCreaContourFile,LstIndexs,"List of : number of elements by segments",std::vector,""); + BBTK_OUTPUT(ReadCreaContourFile,LstTypeModel,"List of : Type Model ( 1:Slice 6:Line 14:SliceForceOpen)",std::vector,""); BBTK_END_DESCRIBE_BLACK_BOX(ReadCreaContourFile); //===== diff --git a/bbtk/src/bbcreaMaracasVisuTubeFilter.cxx b/bbtk/src/bbcreaMaracasVisuTubeFilter.cxx index e3989b5..a8d856f 100644 --- a/bbtk/src/bbcreaMaracasVisuTubeFilter.cxx +++ b/bbtk/src/bbcreaMaracasVisuTubeFilter.cxx @@ -29,30 +29,17 @@ #include "bbcreaMaracasVisuTubeFilter.h" #include "bbcreaMaracasVisuPackage.h" - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include -#include - - 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 lstPointX , std::vector lstPointY , std::vector lstPointZ ) { this->lstPointX = lstPointX; @@ -80,13 +63,11 @@ namespace bbcreaMaracasVisu this->lstPointZ = lstPointZ; } - void MaracasTubeFilter::SetlstColour( std::vector lstColour ) { this->lstColour=lstColour; } - void MaracasTubeFilter::SetlstRadius( std::vector 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 points = vtkSmartPointer::New(); + points = vtkPoints::New(); + + for(i = 0; i < lstPointX.size(); i++) + { + points->InsertPoint(i, lstPointX[i], lstPointY[i], lstPointZ[i]); + } + + //EED1 vtkSmartPointer lines = vtkSmartPointer::New(); + lines = vtkCellArray::New(); + + lines->InsertNextCell( lstPointX.size() ); + for (i = 0; i < lstPointX.size(); i++) + { + lines->InsertCellPoint(i); + } + + //EED1 vtkSmartPointer polyData = vtkSmartPointer::New(); + polyData = vtkPolyData::New(); + + polyData->SetPoints(points); + polyData->SetLines(lines); + + double radio; + // Varying tube radius using sine-function + + //EED1 vtkSmartPointer tubeRadius = vtkSmartPointer::New(); + tubeRadius = vtkDoubleArray::New(); + + tubeRadius->SetName("TubeRadius"); + tubeRadius->SetNumberOfTuples( lstPointX.size() ); + for (i=0 ;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 colors = vtkSmartPointer::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 (iInsertTuple3(i, 255*lstColour[indexcolour+0] , 255*lstColour[indexcolour+1] , 255*lstColour[indexcolour+2] ); + } + } // for + polyData->GetPointData()->AddArray(colors); + + //EED1 vtkSmartPointer tube = vtkSmartPointer::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 mapper = vtkSmartPointer::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 actor =vtkSmartPointer::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 points = vtkSmartPointer::New(); @@ -126,7 +259,7 @@ namespace bbcreaMaracasVisu lines->InsertCellPoint(i); } - vtkSmartPointer polyData = vtkSmartPointer::New(); + vtkSmartPointer polyData = vtkSmartPointer::New(); polyData->SetPoints(points); polyData->SetLines(lines); @@ -188,7 +321,12 @@ namespace bbcreaMaracasVisu tube->SetVaryRadiusToVaryRadiusByAbsoluteScalar(); vtkSmartPointer mapper = vtkSmartPointer::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 actor =vtkSmartPointer::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 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 colour; // 0- gray colour.push_back(1.0); colour.push_back(0.0); colour.push_back(0.0); bbSetInputColour(colour); - std::vector lstRadius; lstRadius.push_back(1); - bbSetInputColour(lstRadius); + bbSetInputColour(lstRadius); } //===== @@ -316,7 +449,6 @@ void TubeFilter::bbUserFinalizeProcessing() // if any } -} -// EO namespace bbcreaMaracasVisu +}// EO namespace bbcreaMaracasVisu diff --git a/bbtk/src/bbcreaMaracasVisuTubeFilter.h b/bbtk/src/bbcreaMaracasVisuTubeFilter.h index 5228422..d7c1a37 100644 --- a/bbtk/src/bbcreaMaracasVisuTubeFilter.h +++ b/bbtk/src/bbcreaMaracasVisuTubeFilter.h @@ -36,8 +36,29 @@ #include #include #include +#include #include -#include +// #include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include + + + namespace bbcreaMaracasVisu { @@ -47,19 +68,31 @@ namespace bbcreaMaracasVisu public: MaracasTubeFilter(); ~MaracasTubeFilter(); - void SetvtkRenderer( vtkRenderer *render); void SetlstPoints( std::vector lstPointX , std::vector lstPointY , std::vector lstPointZ ); void SetlstRadius( std::vector lstRadius ); void SetlstColour( std::vector lstColour ); void SetOpacity(double opacity); void SetTransform( vtkLinearTransform* transform ); - vtkActor *GetActor(); - void Run(); - - vtkRenderer *renderer; - vtkSmartPointer actor; - + vtkActor *GetActor(); + vtkPolyData *GetPolyDataTube(); + void Run(); + vtkRenderer *renderer; + vtkSmartPointer actor; + +// vtkSmartPointer polyData; + vtkSmartPointer polydataTube; + + + vtkPoints *points; + vtkCellArray *lines; + vtkPolyData *polyData; + vtkDoubleArray *tubeRadius; + vtkUnsignedCharArray *colors; + vtkTubeFilter *tube; + vtkPolyDataMapper *mapper; + + double opacity; vtkLinearTransform *transform; std::vector lstPointX; @@ -67,7 +100,6 @@ namespace bbcreaMaracasVisu std::vector lstPointZ; std::vector lstRadius; std::vector 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) diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ViewShowNPoints.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ViewShowNPoints.cxx index 80f127a..b7e7a54 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ViewShowNPoints.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ViewShowNPoints.cxx @@ -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 (idAddActor( lstActorsSphere[id] ); + renderer->AddActor( lstActorsText[id] ); + } // if lstActorAdded false + } // if id 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 ) { diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/creaContoursFactory.cpp b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/creaContoursFactory.cpp index c502c56..3210844 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/creaContoursFactory.cpp +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/creaContoursFactory.cpp @@ -42,20 +42,17 @@ #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; } diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualBaseModel.cpp b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualBaseModel.cpp index fa9360b..5484b68 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualBaseModel.cpp +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualBaseModel.cpp @@ -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; diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualBaseModel.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualBaseModel.h index e30c00f..bad13f4 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualBaseModel.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualBaseModel.h @@ -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(); /* diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualContourModel.cpp b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualContourModel.cpp index 433e1da..1acf649 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualContourModel.cpp +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualContourModel.cpp @@ -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 manualContourModel::ExploseModel( ) return lstTmp; } - // ---------------------------------------------------------------------------- void manualContourModel::Transform_Ax_Plus_B (double Ax, double Bx, double Ay, double By) { diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualContourModel.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualContourModel.h index b39f843..2a8a082 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualContourModel.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualContourModel.h @@ -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 _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 index 0000000..0a5e0bd --- /dev/null +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualContourModelSplineForceOpen.cpp @@ -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 index 0000000..bbc743d --- /dev/null +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualContourModelSplineForceOpen.h @@ -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