]> Creatis software - creaContours.git/commitdiff
#3395 Define max contours bye Instant
authoreduardo.davila@creatis.insa-lyon.fr <eduardo.davila@creatis.insa-lyon.fr>
Fri, 3 Jan 2025 11:00:56 +0000 (12:00 +0100)
committereduardo.davila@creatis.insa-lyon.fr <eduardo.davila@creatis.insa-lyon.fr>
Fri, 3 Jan 2025 11:00:56 +0000 (12:00 +0100)
bbtk/src/bbCreaContournDimensions.cxx
bbtk/src/bbcreaContourswxContourMainFrame_tool.cxx
lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx
lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h
lib/Interface_ManagerContour_NDimensions/wxContourViewPanel.cxx
lib/kernel_ManagerContour_NDimensions/KernelManagerContour.cxx

index 336a7637b53964296a4f5c239c662f6fe72dc369..75b3b91ea9ecc67f4356b2b07d09f8c42474c621 100644 (file)
@@ -39,7 +39,6 @@ void nDimensions::Process()
 //        std::vector< void * > vectortemp;
 //        std::vector<int> size;
 //        vtkImageData **mask = 0, **value = 0;
-
     if (firsttime==true)
     {
         firsttime=false;
@@ -50,19 +49,16 @@ void nDimensions::Process()
             selectedimages.push_back( bbGetInputIn() );
             wxContourMainFrame::getInstance()->ShowToolsPanel(true);
             wxContourMainFrame::getInstance()->configure(selectedimages);
+            wxContourMainFrame::getInstance()->SetMaxContoursByInstant(1);
         } // if In
     } else{
-
         //wxContourMainFrame::getInstance()->getValuesXYZ(vectx, vecty, vectz, &size);
         //wxContourMainFrame::getInstance()->getMaskValue(mask, value, contourtype);
-
         if ( currentimg!=bbGetInputIn() )
         {
             wxContourMainFrame::getInstance()->changeImage(0, bbGetInputIn() );
             currentimg=bbGetInputIn();
         } // if currentimg!=In
-
-        
     } // if firsttime
     wxContourMainFrame::getInstance()->RefreshInterface();
     bbSetOutputwxContourMainFrame( wxContourMainFrame::getInstance() );
index 3dfe221f80e378ea9ff2739b362bf1d7f22cbbf9..ae33330d21fa6429307e313ecf3ddfdf2e725cd5 100644 (file)
@@ -16,7 +16,7 @@ BBTK_BLACK_BOX_IMPLEMENTATION(wxContourMainFrame_tool,bbtk::AtomicBlackBox);
 //===== 
 void wxContourMainFrame_tool::Process()
 {
-
+    printf("EED wxContourMainFrame_tool::Process start type=%d \n", bbGetInputType() );
 // THE MAIN PROCESSING METHOD BODY
 //   Here we simply set the input 'In' value to the output 'Out'
 //   And print out the output value
@@ -50,10 +50,8 @@ void wxContourMainFrame_tool::Process()
 //                    int     y           = param1[7];
                     int     x           = 0;
                     int     y           = 0;
-
                     wxContourMainFrame::getInstance()->onDeleteAllContours();
                     wxContourMainFrame::getInstance()->onSegmentationAllSlices2(step ,isovalue ,sampling,method,x,y,minZ,maxZ, bbGetInputImage() );
-                    
                 } else {
                     printf("BBTK warnning!!  wxContourMainFrame_tool box. In Type=1 the Param1 es not complite \n");
                 }// size
@@ -93,6 +91,8 @@ void wxContourMainFrame_tool::Process()
         } // Type 3
     } // if wxContourMainFrame::getInstance()!=NULL
     
+    printf("EED wxContourMainFrame_tool::Process end\n" );
+
 }
 //===== 
 // 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 34b3d151211ee2cf5ad65949fb9e7a0c4578811b..65cba57c91c60e1b82d34b394155fe3a86d366f5 100644 (file)
@@ -61,6 +61,7 @@ char wxContourMainFrame::COPY = 'C';
                : wxPanel(parent, id, pos, size, style)
        {
                m_mgr.SetManagedWindow(this);
+        _maxContoursByInstant       = 1000;
                _contourGroup                           = 1;
                _creatingContoursActive         = false;
                _theViewPanel                           = NULL;
@@ -167,31 +168,31 @@ void wxContourMainFrame::configure(std::vector<vtkImageData*> imgs)
 }
 
 wxContourMainFrame* wxContourMainFrame::getInstance(wxWindow* parent, wxWindowID id,const wxString& title,const wxPoint& pos,const wxSize& size,std::vector<vtkImageData*> images, long style,std::string datadir )
-       {
+{
                if(instance == NULL)
                {
                        instance=new wxContourMainFrame(parent, id, title, pos, size, images, style,datadir);
                }
                return instance;
-       }
+}
 
 std::vector<vtkImageData*> wxContourMainFrame::getVectImages()
-       {
+{
                return kernelManager->getVectImages();
-       }
+}
 
 wxContourMainFrame* wxContourMainFrame::getInstance()
-       {
+{
                return instance;
-       }
+}
 
 void wxContourMainFrame::resetInstance()
-       {
+{
                instance->Destroy();
-       }
+}
 
 wxContourMainFrame::~wxContourMainFrame()
-       {
+{
                delete _contourextractdata;
                deleteAllContours();
                _pannew->Close();
@@ -212,8 +213,7 @@ wxContourMainFrame::~wxContourMainFrame()
                //EED????               delete _buttonsBar;
                //EED????               delete _actualInstant;
                //EED????               delete _sceneManager;
-       }
-
+}
 
        //------------------------------------------------------------------------------------------------------------
        // Creational and initialization methods using WxAui
@@ -227,7 +227,6 @@ wxContourMainFrame::~wxContourMainFrame()
                return noteBook;
        }
 
-
        //------------------------------------------------------------------------------------------------------------
        // Creational and initialization methods
        //------------------------------------------------------------------------------------------------------------
@@ -253,7 +252,6 @@ wxContourMainFrame::~wxContourMainFrame()
                return configured;
        }
 
-
        bool wxContourMainFrame::addNewPanel(wxPanel* panel)
                {
                bool configured = panel!=NULL;
@@ -270,9 +268,6 @@ wxContourMainFrame::~wxContourMainFrame()
        //------------------------------------------------------------------------------------------------------------
        //  Attributes getters and setters
        //------------------------------------------------------------------------------------------------------------
-
-
-
        void wxContourMainFrame :: setInstantChooserPanel(  wxInstantChooserPanel * theInstantChooserPanel )
        {
                _instantPanel = theInstantChooserPanel;
@@ -318,8 +313,6 @@ wxContourMainFrame::~wxContourMainFrame()
 //             _listViewPanel = theListViewPanel;
 //     }
 
-
-
 void wxContourMainFrame::onCreateContourSpline( ){
 
        //JCP 20-10-08 Undo redo implementation
@@ -403,34 +396,43 @@ void wxContourMainFrame :: onCreateContourBullEye(wxPanel* panel )
 
 void wxContourMainFrame::createContour( int typeContour )
 {
-       //Creating the manualContourModel and including in the model
-       manualBaseModel * manModelContour = kernelManager->factoryManualContourModel(typeContour);
        std::vector<int> instantVector;
        _instantPanel->getInstant( instantVector );
 
-       std::vector<int> tempVector;
-       getInstantVector( tempVector );
-       manModelContour->SetLabel2( std::to_string(tempVector[1]) );
+    std::vector<std::string> lstOutlinesNames = kernelManager->getOutlinesNameAtInstant(instantVector);
+    int sizeLstOutlinesNames = lstOutlinesNames.size();
 
-       std::string theName = kernelManager->createOutline(manModelContour, instantVector);
-       /*std::vector<int> instantVector;
-       _instantPanel->getInstant( instantVector );
-       std::string theName;
-       theName= _modelManager->createOutline( manModelContour, instantVector );*/
-       bool addedModel = theName.compare("") != 0;//??
-       if( addedModel )
-       {
-               double spc[3];//Si no hay imagen pero hay contornos que spacing se pone por default
-               _theViewPanel->getSpacing(spc);
-               //Adding the manualContourControler to interface objects structure
-               //Adding the manualViewContour to interface objects structure
-               //_sceneManager->setControlActiveStateOfALL( false );//This call is being done here because if the ROI is created underneath the previously created ROIS will still be active.
-               _theViewPanel->getSceneManager()->configureViewControlTo( theName, manModelContour,spc , typeContour) ;
-       } // if addedModel
+    if (sizeLstOutlinesNames < _maxContoursByInstant)
+    {
+        
+        //Creating the manualContourModel and including in the model
+        manualBaseModel * manModelContour = kernelManager->factoryManualContourModel(typeContour);
+        
+        
+        std::vector<int> tempVector;
+        getInstantVector( tempVector );
+        manModelContour->SetLabel2( std::to_string(tempVector[1]) );
+        
+        std::string theName = kernelManager->createOutline(manModelContour, instantVector);
+        /*std::vector<int> instantVector;
+         _instantPanel->getInstant( instantVector );
+         std::string theName;
+         theName= _modelManager->createOutline( manModelContour, instantVector );*/
+        bool addedModel = theName.compare("") != 0;//??
+        if( addedModel )
+        {
+            double spc[3];//Si no hay imagen pero hay contornos que spacing se pone por default
+            _theViewPanel->getSpacing(spc);
+            //Adding the manualContourControler to interface objects structure
+            //Adding the manualViewContour to interface objects structure
+            //_sceneManager->setControlActiveStateOfALL( false );//This call is being done here because if the ROI is created underneath the previously created ROIS will still be active.
+            _theViewPanel->getSceneManager()->configureViewControlTo( theName, manModelContour,spc , typeContour) ;
+        } // if addedModel
+    } // if < maxContoursByInstant
 }
 
-manualBaseModel * wxContourMainFrame::factoryManualContourModel(wxPanel* panel){
-
+manualBaseModel * wxContourMainFrame::factoryManualContourModel(wxPanel* panel)
+{
        manualContourModelBullEye *manModelContourBullEye = new manualContourModelBullEye();
        manualBaseModel *manModelContour=NULL;
        manModelContour = manModelContourBullEye;
@@ -458,7 +460,6 @@ manualBaseModel * wxContourMainFrame::factoryManualContourModel(wxPanel* panel){
                        } // for iSector
                } // for iCrown
        } // if _panelBullEyeOptions
-
        return manModelContour;
 }
 
@@ -527,7 +528,7 @@ void wxContourMainFrame :: deleteContours( std::vector<std::string>  keyNamesVec
        for (i=0;i<size;i++)
        {
                deleteContour( keyNamesVector[i] );
-       }
+       } // for i
 }
 
 void wxContourMainFrame :: deleteContour( std::string theKeyName )
@@ -570,13 +571,14 @@ void wxContourMainFrame::onDeleteContoursActSlice()
        getInstantVector( tempVector );
        deleteContours( getOutlinesName( tempVector[1] ) );
 //     deleteContours( (std::vector<std::string>)_theViewPanel->getSceneManager()->GetlstContoursNameActualSlice() );
-
 }
+
 void wxContourMainFrame::onDeleteAllContours(){
        //JCP 20-10-08 Undo redo implementation
        saveState();
        deleteAllContours();
 }
+
 void wxContourMainFrame::deleteAllContours(){
        //JCP 20-10-08 Undo redo implementation
 
@@ -631,20 +633,16 @@ void wxContourMainFrame::setConceptValue( std::string name, int value )
        _instantPanel->setConceptValue(name, value);
 }
 
-
 ConceptDataWrap* wxContourMainFrame::getLastConceptData()
 {
        return _instantPanel->getLastConceptData();
 }
 
-
 bool wxContourMainFrame::getIfConceptCheckedAt( std::string name, int pos )
 {
        return _instantPanel->getIfConceptCheckedAt( name, pos );
 }
 
-
-
 void wxContourMainFrame::ShowResultImages(int typeContourGroup, int selection, int minZ, int maxZ)
 {
        vtkImageData * mask;
@@ -672,7 +670,6 @@ void wxContourMainFrame::ShowResultImages(int typeContourGroup, int selection, i
                wxPanel *panelViewer1 = new wxMaracas_N_ViewersWidget(noteBookViewerResult, value,&nTypeView);
                wxPanel *panelViewer2 = new wxMaracas_N_ViewersWidget(noteBookViewerResult, mask,&nTypeView);
 
-
                noteBookViewerResult->AddPage( panelViewer1, wxT("Image result") );
                noteBookViewerResult->AddPage( panelViewer2, wxT("Mask result") );
                m_mgr_noteBookViewerResult->Update();
@@ -680,9 +677,6 @@ void wxContourMainFrame::ShowResultImages(int typeContourGroup, int selection, i
        } // if _frameShowResultImages
 }
 
-
-
-
 void wxContourMainFrame::changeInstant()
 {
                std::vector<int> instantVect;
@@ -714,13 +708,10 @@ void wxContourMainFrame::changeInstant()
                updateInstantAxes();
 }
 
-
-
 void wxContourMainFrame::updateInstantOutlines()
 {
        _theViewPanel->removeSceneContours();
        _theViewPanel->addNameWrapperToScene();
-
        //for( int i=0; i<size; i++)
        //{
        //      _theViewPanel->getSceneManager()->addToScene(namesWrapping[i]->getKeyName(), true, true, true, false, false );
@@ -3431,4 +3422,8 @@ void wxContourMainFrame::ResetCamera()
     GetWxVtkBaseView()->GetRenderer()->ResetCamera();
 }
 
+void wxContourMainFrame::SetMaxContoursByInstant(int max)
+{
+    _maxContoursByInstant = max;
+}
 
index 56414a17aba74019d4b7be38636efe851de5cc58..12e07e1e6f7ec27e9b38bfaeee2127c4071379e9 100644 (file)
@@ -331,6 +331,8 @@ class wxContourMainFrame : public wxPanel {
        void    SetXY(int x,int y);
     void    ResetCamera();
 
+    void SetMaxContoursByInstant(int max);
+    
 private:
        //------------------------------------------------------------------------------------------------------------
        //  Private methods
@@ -415,7 +417,10 @@ private:
 //------------------------------------------------------------------------------------------------------------
 
        wxFrame                                         *_frameShowResultImages;
-    
+
+//EED 2025-01-01
+    int                         _maxContoursByInstant;
+
 };
 
 #endif
index ea57095e0669edb0bd261db60ad4608808ad18f0..9e7c9ab4817f93379b12b30f6420cbbf58bd67db 100644 (file)
@@ -716,12 +716,9 @@ DEFINE_EVENT_TYPE( wxINSTANT_CHANGE )
                        std::string name = wxContourMainFrame::getInstance()->getNameWrapping(i);
                        _sceneManager->addToScene(name, true, true, true, false, false );
                } // for i
-
                _sceneManager->SetLabelNumberOfContours( "contours:"+std::to_string(size) );
-
                std::vector<int> tempVector;
                wxContourMainFrame::getInstance()->getInstantVector( tempVector );
-
                if (_showBeforeContour==true)
                {
                        size=0;
@@ -742,7 +739,6 @@ DEFINE_EVENT_TYPE( wxINSTANT_CHANGE )
                                _sceneManager->addToScene(lstNameBefor[i], true, true, false, false, false );
                        } // for i
                } // if _before Contour
-       
                if (_showAfterContour==true)
                {
                        size=0;
index 4a96eae2505cb2f510c1575b14bb4a5e088d9a76..f0fa9d523339bf23f8a328f57d0e8185e3185cf5 100644 (file)
@@ -470,7 +470,8 @@ manualBaseModel *KernelManagerContour::factoryManualContourModel(int typeContour
        return manModelContour;
 }
 
-std::vector<std::string> KernelManagerContour::getOutlinesNameAtInstant(std::vector<int> tempvector){
+std::vector<std::string> KernelManagerContour::getOutlinesNameAtInstant(std::vector<int> tempvector)
+{
        Instant instant(&tempvector);
        std::vector<ContourThing**> vectcont = modelManager->getOutlinesAtInstant( &instant );
        std::vector<std::string> vectname;
@@ -481,11 +482,13 @@ std::vector<std::string> KernelManagerContour::getOutlinesNameAtInstant(std::vec
     return vectname;
 }
 
-std::vector<ContourThing**> KernelManagerContour::getOutlinesAtInstant(Instant* instant ){
+std::vector<ContourThing**> KernelManagerContour::getOutlinesAtInstant(Instant* instant )
+{
        return modelManager->getOutlinesAtInstant(instant);
 }
 
-std::vector<manualBaseModel*> KernelManagerContour::ExploseEachModel( std::vector<manualBaseModel*> lstManConMod ){
+std::vector<manualBaseModel*> KernelManagerContour::ExploseEachModel( std::vector<manualBaseModel*> lstManConMod )
+{
        std::vector<manualBaseModel*> lstTmp;
        std::vector<manualBaseModel*> lstResult;
        int j,jSize;
@@ -502,7 +505,8 @@ std::vector<manualBaseModel*> KernelManagerContour::ExploseEachModel( std::vecto
        return lstResult;
 }
 
-void KernelManagerContour::getConceptsInformation(std::vector<std::string>& conceptNameVect, std::vector<int>& conceptSizeVect){
+void KernelManagerContour::getConceptsInformation(std::vector<std::string>& conceptNameVect, std::vector<int>& conceptSizeVect)
+{
        modelManager-> getConceptsInformation(conceptNameVect, conceptSizeVect);
 }