X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=vv%2FvvStructureSetActor.cxx;h=82ef95b43948723d9e7edbbbf3fad2ef5c47b8eb;hb=fdc1613169b9725128ad19aaa4c4a5c39f2920d7;hp=9a9ac8c674f4dd6e61aa84832c1dd260d6f7b30f;hpb=c93a32f96e61514b8b945d515ffcf11c2a12ae66;p=clitk.git diff --git a/vv/vvStructureSetActor.cxx b/vv/vvStructureSetActor.cxx index 9a9ac8c..82ef95b 100644 --- a/vv/vvStructureSetActor.cxx +++ b/vv/vvStructureSetActor.cxx @@ -3,7 +3,7 @@ Authors belong to: - University of LYON http://www.universite-lyon.fr/ - - Léon Bérard cancer center http://oncora1.lyon.fnclcc.fr + - Léon Bérard cancer center http://www.centreleonberard.fr - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr This software is distributed WITHOUT ANY WARRANTY; without even @@ -14,7 +14,7 @@ - BSD See included LICENSE.txt file - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html -======================================================================-====*/ +===========================================================================**/ #include "vvStructureSetActor.h" #include "vvROIActor.h" @@ -44,7 +44,7 @@ int vvStructureSetActor::GetNumberOfROIs() //------------------------------------------------------------------------------ -std::vector & vvStructureSetActor::GetROIList() +std::vector< QSharedPointer > & vvStructureSetActor::GetROIList() { return mROIActors; } @@ -74,7 +74,7 @@ vvROIActor * vvStructureSetActor::GetROIActor(int n) std::cerr << "No ROI number " << n << std::endl; return NULL; } - return mROIActors[mMapROIIndex[n]]; + return mROIActors[mMapROIIndex[n]].data(); } //------------------------------------------------------------------------------ @@ -91,15 +91,15 @@ void vvStructureSetActor::CreateNewROIActor(int n, bool modeBG) // If already exist : delete it int old = -1; - if (mMapROIIndex.find(n) != mMapROIIndex.end()) { - delete mROIActors[mMapROIIndex[n]]; + if (mMapROIIndex.find(n) != mMapROIIndex.end()) old = mMapROIIndex[n]; - } // Add ROI Actors - vvROIActor * actor = new vvROIActor; - if (old == -1) mROIActors.push_back(actor); - else mROIActors[old] = actor; + QSharedPointer actor = QSharedPointer(new vvROIActor); + if (old == -1) + mROIActors.push_back(actor); + else + mROIActors[old] = actor; actor->SetBGMode(modeBG); actor->SetROI(roi); actor->SetSlicerManager(mSlicerManager);