X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=vv%2FvvStructureSetActor.cxx;h=82ef95b43948723d9e7edbbbf3fad2ef5c47b8eb;hb=573d80d0f7a17607d2ee883c21c940c0ba020282;hp=ce0060d4e72bf10fe9d462ce98d534774eecfe32;hpb=1e034c70105f0926939acaaa27ddb46e904ae8bf;p=clitk.git diff --git a/vv/vvStructureSetActor.cxx b/vv/vvStructureSetActor.cxx index ce0060d..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" @@ -30,6 +30,23 @@ vvStructureSetActor::vvStructureSetActor() //------------------------------------------------------------------------------ vvStructureSetActor::~vvStructureSetActor() { + +} +//------------------------------------------------------------------------------ + + +//------------------------------------------------------------------------------ +int vvStructureSetActor::GetNumberOfROIs() +{ + return mROIActors.size(); +} +//------------------------------------------------------------------------------ + + +//------------------------------------------------------------------------------ +std::vector< QSharedPointer > & vvStructureSetActor::GetROIList() +{ + return mROIActors; } //------------------------------------------------------------------------------ @@ -57,13 +74,13 @@ vvROIActor * vvStructureSetActor::GetROIActor(int n) std::cerr << "No ROI number " << n << std::endl; return NULL; } - return mROIActors[mMapROIIndex[n]]; + return mROIActors[mMapROIIndex[n]].data(); } //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ -void vvStructureSetActor::CreateNewROIActor(int n) +void vvStructureSetActor::CreateNewROIActor(int n, bool modeBG) { // Check clitk::DicomRT_ROI * roi = mStructureSet->GetROI(n); @@ -72,15 +89,22 @@ void vvStructureSetActor::CreateNewROIActor(int n) exit(0); } + // If already exist : delete it + int old = -1; + if (mMapROIIndex.find(n) != mMapROIIndex.end()) + old = mMapROIIndex[n]; + // Add ROI Actors - vvROIActor * actor = new vvROIActor; - mROIActors.push_back(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); actor->Initialize(); mMapROIIndex[n] = mROIActors.size()-1; - - // actor->Update(); } //------------------------------------------------------------------------------