From: eduardo.davila@creatis.insa-lyon.fr Date: Thu, 9 Jan 2025 07:35:23 +0000 (+0100) Subject: #3396 Clean Contours With Empty Points X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=00691107e2febf4b20f21701028072cd44a8b05d;p=creaContours.git #3396 Clean Contours With Empty Points --- diff --git a/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx b/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx index 65cba57..bacc23c 100644 --- a/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx +++ b/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx @@ -399,6 +399,10 @@ void wxContourMainFrame::createContour( int typeContour ) std::vector instantVector; _instantPanel->getInstant( instantVector ); + //EED 2025-01-07 + CleanContoursWithEmptyPoints(); + + //EED 2024-12-28 std::vector lstOutlinesNames = kernelManager->getOutlinesNameAtInstant(instantVector); int sizeLstOutlinesNames = lstOutlinesNames.size(); @@ -522,7 +526,7 @@ void wxContourMainFrame::onDeleteContour() JCP 19 - 11 - 08*/ } -void wxContourMainFrame :: deleteContours( std::vector keyNamesVector ) +void wxContourMainFrame::deleteContours( std::vector keyNamesVector ) { int i,size=keyNamesVector.size(); for (i=0;i keyNamesVec } // for i } -void wxContourMainFrame :: deleteContour( std::string theKeyName ) +void wxContourMainFrame::deleteContour( std::string theKeyName ) { /* manualContourModel * cModel; manualViewBaseContour * cViewer; manualContourBaseControler * cControler; - ContourWrap_ViewControl *conwrapviewControl = _theViewPanel->getSceneManager()->getContourWrap_ViewControlOf( theKeyName ); cControler = conwrapviewControl->getControler();*/ - + //JCP 21 - 11 - 2008 bool isedit = _theViewPanel->isEditableCControler(theKeyName); bool ispartofstaticlst = kernelManager->IsPartOfStaticList(theKeyName); - if (isedit && ispartofstaticlst) { _theViewPanel->removeFromScene(theKeyName); - kernelManager->deleteCModel(theKeyName); //_theViewPanel->getSceneManager()->removeFromScene( theKeyName ); //cViewer = conwrapviewControl->getViewer(); @@ -563,42 +564,57 @@ void wxContourMainFrame :: deleteContour( std::string theKeyName ) void wxContourMainFrame::onDeleteContoursActSlice() { + //EED 2025-01-07 + CleanContoursWithEmptyPoints(); + //JCP 20-10-08 Undo redo implementation saveState(); //JCP 20-10-08 Undo redo implementation - std::vector tempVector; getInstantVector( tempVector ); deleteContours( getOutlinesName( tempVector[1] ) ); // deleteContours( (std::vector)_theViewPanel->getSceneManager()->GetlstContoursNameActualSlice() ); } -void wxContourMainFrame::onDeleteAllContours(){ +void wxContourMainFrame::CleanContoursWithEmptyPoints() +{ + std::vector tempVector; + getInstantVector( tempVector ); +// std::vector keyNamesVector = getOutlinesName( tempVector[1] ); + std::vector keyNamesVector = kernelManager->GetLstNameThings(); + int i,size=keyNamesVector.size(); + for ( i=0 ; igetOutlineByKeyName( keyNamesVector[i] ); + if ( manualModel->GetSizeLstPoints()==0 ) + { + deleteContour( keyNamesVector[i] ); + } // if + } // for i +} + +void wxContourMainFrame::onDeleteAllContours() +{ //JCP 20-10-08 Undo redo implementation saveState(); deleteAllContours(); } -void wxContourMainFrame::deleteAllContours(){ +void wxContourMainFrame::deleteAllContours() +{ //JCP 20-10-08 Undo redo implementation - wxBusyCursor wait; std::vector tempVector; _instantPanel->getInstant( tempVector ); - //JCP --08-09-2008 When using a diferent interface the _mbarrangeDeleteAll might not be initialize // the values in GetStart and GetEnd will then not be initialize also. // We use instead the values given when initializing the _deletepanel. - //int minZ = _mbarrangeDeleteAll->GetStart(); //int maxZ = _mbarrangeDeleteAll->GetEnd(); int minZ, maxZ; - minZ = 0; maxZ = _theViewPanel->getSceneManager()->GetImageDataSizeZ(); - //JCP --08-09-2008 - _theViewPanel->getSceneManager()->removeSceneContours( ); _theViewPanel->getSceneManager()->removeAllOutlines(); kernelManager->removeAllOutlines(); @@ -1043,7 +1059,9 @@ void wxContourMainFrame::onSave() //AD: 29-05-09 void wxContourMainFrame::saveFileWithContours( std::string filename ) { - + //EED 2025-01-07 + CleanContoursWithEmptyPoints(); + FILE *pFile=fopen(filename.c_str(),"w+"); //CMRU 03-09-09----------------------------------------------------------------------------------------------- diff --git a/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h b/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h index 12e07e1..b4b3ad5 100644 --- a/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h +++ b/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h @@ -331,14 +331,14 @@ class wxContourMainFrame : public wxPanel { void SetXY(int x,int y); void ResetCamera(); - void SetMaxContoursByInstant(int max); + void CleanContoursWithEmptyPoints(); + void SetMaxContoursByInstant(int max); private: //------------------------------------------------------------------------------------------------------------ // Private methods //------------------------------------------------------------------------------------------------------------ - //------------------------------------------------------------------------------------------------------------ // Attributtes //------------------------------------------------------------------------------------------------------------ @@ -395,9 +395,7 @@ private: void saveState(); void loadState(std::string filename); - // void loadContours( FILE *pFile, bool staticContour ); - void saveFileWithContours( std::string filename ); void onLoadContours(std::string fileNameContourROI, bool interactiveInterface); void SetZForAllContours(int pz); @@ -415,12 +413,9 @@ private: std::string _imageLocation; std::string _fileLocation; //------------------------------------------------------------------------------------------------------------ - wxFrame *_frameShowResultImages; - //EED 2025-01-01 int _maxContoursByInstant; - }; #endif diff --git a/lib/Interface_ManagerContour_NDimensions/wxVtkBaseView_SceneManager.cxx b/lib/Interface_ManagerContour_NDimensions/wxVtkBaseView_SceneManager.cxx index 5833875..c484a8b 100644 --- a/lib/Interface_ManagerContour_NDimensions/wxVtkBaseView_SceneManager.cxx +++ b/lib/Interface_ManagerContour_NDimensions/wxVtkBaseView_SceneManager.cxx @@ -179,6 +179,7 @@ wxDEFINE_EVENT(wxEVT_CHANGED_DEEP, wxCommandEvent); _lastInteraction->getControler()->SetActive( false ); this->_vtkInteractorStyleBaseView->SetRefresh_waiting(); } + manualContourBaseControler *manContourControl; manualViewBaseContour *manViewerContour; // Creating the view manualViewContour and the manualContourControler @@ -227,9 +228,9 @@ wxDEFINE_EVENT(wxEVT_CHANGED_DEEP, wxCommandEvent); manViewerContour = new manualViewContour(); } - _lastInteraction = insertWrap( theKeyName, manContourControl, manViewerContour ); - _lastInteractionName = theKeyName; - //Configuring the relations between the contour members representation + _lastInteraction = insertWrap( theKeyName, manContourControl, manViewerContour ); + _lastInteractionName = theKeyName; + //Configuring the relations between the contour members representation manViewerContour->SetModel( manModelContour ); manViewerContour->SetWxVtkBaseView( _wxVtk_BaseView ); manViewerContour->SetRange( _widthOfControlPoint ); @@ -249,7 +250,8 @@ wxDEFINE_EVENT(wxEVT_CHANGED_DEEP, wxCommandEvent); manContourControl->CreateNewManualContour(); manViewerContour->RefreshContour(); addToScene( theKeyName ); - } +} + //------------------------------------------------------------------------------------------------------------ void wxVtkBaseView_SceneManager :: configureSelectionROI( double * spc ) {