1 /*=========================================================================
2 Program: vv http://www.creatis.insa-lyon.fr/rio/vv
5 - University of LYON http://www.universite-lyon.fr/
6 - Léon Bérard cancer center http://oncora1.lyon.fnclcc.fr
7 - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr
9 This software is distributed WITHOUT ANY WARRANTY; without even
10 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11 PURPOSE. See the copyright notices for more information.
13 It is distributed under dual licence
15 - BSD See included LICENSE.txt file
16 - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
17 ======================================================================-====*/
20 #include "vvToolStructureSetManager.h"
21 #include "vvImageReader.h"
22 #include "vvStructureSetActor.h"
24 #include "vvROIActor.h"
27 #include <QFileDialog>
28 #include <QMessageBox>
29 #include <QColorDialog>
32 #include <vtkLookupTable.h>
33 #include <vtkRenderWindow.h>
35 //------------------------------------------------------------------------------
36 // Create the tool and automagically (I like this word) insert it in
37 // the main window menu.
38 ADD_TOOL(vvToolStructureSetManager);
39 //------------------------------------------------------------------------------
41 int vvToolStructureSetManager::m_NumberOfTool = 0;
42 std::vector<vvSlicerManager*> vvToolStructureSetManager::mListOfInputs;
43 std::map<vvSlicerManager*, vvToolStructureSetManager*> vvToolStructureSetManager::mListOfOpenTool;
45 //------------------------------------------------------------------------------
46 vvToolStructureSetManager::vvToolStructureSetManager(vvMainWindowBase * parent,
48 vvSlicerManager * current):
49 vvToolWidgetBase(parent, f),
50 // if Qt::Widget -> No dialog in this case (in tab) ; PB = "invisible widget on menu" !
51 // if "f" normal widget
52 vvToolBase<vvToolStructureSetManager>(parent),
53 Ui::vvToolStructureSetManager()
55 Ui_vvToolStructureSetManager::setupUi(mToolWidget);
57 // this->setFixedWidth(120);
59 mCurrentStructureSetActor = 0;
60 connect(mCloseButton, SIGNAL(clicked()), this, SLOT(close()));
61 mCloseButton->setVisible(false);
63 mTree->header()->resizeSection(0, 30);
64 mMainWindowBase->GetTab()->setTabIcon(mTabNumber, GetToolIcon());
65 mCurrentStructureSet = NULL;
66 mCurrentStructureSetIndex = -1;
67 mGroupBoxROI->setEnabled(false);
68 mCurrentROIActor = NULL;
69 mIsAllVisibleEnabled = false;
70 mNumberOfVisibleROI = 0;
71 mNumberOfVisibleContourROI = 0;
72 mDefaultLUTColor = vtkSmartPointer<vtkLookupTable>::New();
73 for(int i=0; i<mDefaultLUTColor->GetNumberOfTableValues(); i++) {
74 double r = (rand()/(RAND_MAX+1.0));
75 double v = (rand()/(RAND_MAX+1.0));
76 double b = (rand()/(RAND_MAX+1.0));
77 mDefaultLUTColor->SetTableValue(i, r, v, b);
78 // std::cout << "mDefaultLUTColor->SetTableValue(" << i << ", " << r << ", " << v << ", " << b << ");" << std::endl;
80 #include "vvDefaultLut.h"
83 if (current == NULL) {
84 MustOpenDialogWhenCreated = true;
85 AddInputSelector("Select image");
88 MustOpenDialogWhenCreated = false;
89 mMainButtonBox->setEnabled(true);
90 mCurrentSlicerManager = current;
91 mCurrentImage = mCurrentSlicerManager->GetImage();
92 mToolWidget->setEnabled(true);
93 InputIsSelected(mCurrentSlicerManager);
96 //------------------------------------------------------------------------------
99 //------------------------------------------------------------------------------
100 vvToolStructureSetManager::~vvToolStructureSetManager()
104 std::map<clitk::DicomRT_ROI::Pointer, QTreeWidgetItem *>::iterator it;
105 for (it = mMapROIToTreeWidget.begin(); it!=mMapROIToTreeWidget.end(); it++)
107 for(unsigned int i=0; i< mStructureSetActorsList.size(); i++)
108 delete mStructureSetActorsList[i];
111 //------------------------------------------------------------------------------
114 //------------------------------------------------------------------------------
116 void vvToolStructureSetManager::Initialize() {
117 SetToolName("ROIManager");
118 SetToolMenuName("Display ROI (binary image)");
119 SetToolIconFilename(":/common/icons/tool-roi.png");
120 SetToolTip("Display ROI from a binary image.");
121 SetToolExperimental(false);
123 //------------------------------------------------------------------------------
126 //------------------------------------------------------------------------------
127 void vvToolStructureSetManager::InputIsSelected(vvSlicerManager *m)
129 //int mTabNumber = parent->GetTab()->addTab(this, "");
130 // this->setFixedWidth(120);
131 //this->setPreferedHeight(441);
133 if (mCurrentImage->GetNumberOfDimensions() != 3) {
134 QMessageBox::information(this,tr("Sorry only 3D yet"), tr("Sorry only 3D yet"));
138 HideInputSelector(); // splitter
139 mToolInputSelectionWidget->hide();
140 mLabelInputInfo->setText(QString("%1").arg(m->GetFileName().c_str()));
143 // if (!isWindow()) {
144 mListOfInputs.push_back(mCurrentSlicerManager);
145 mListOfOpenTool[mCurrentSlicerManager] = this;
148 // Connect open menus
149 connect(mOpenBinaryButton, SIGNAL(clicked()), this, SLOT(OpenBinaryImage()));
150 connect(mTree, SIGNAL(itemSelectionChanged()), this, SLOT(SelectedItemChangedInTree()));
151 connect(mCheckBoxShow, SIGNAL(toggled(bool)), this, SLOT(VisibleROIToggled(bool)));
152 connect(mOpacitySlider, SIGNAL(valueChanged(int)), this, SLOT(OpacityChanged(int)));
153 connect(mChangeColorButton, SIGNAL(clicked()), this, SLOT(ChangeColor()));
154 connect(mContourCheckBoxShow, SIGNAL(toggled(bool)), this, SLOT(VisibleContourROIToggled(bool)));
155 connect(mChangeContourColorButton, SIGNAL(clicked()), this, SLOT(ChangeContourColor()));
156 connect(mContourWidthSpinBox, SIGNAL(valueChanged(int)), this, SLOT(ChangeContourWidth(int)));
157 connect(mReloadButton, SIGNAL(clicked()), this, SLOT(ReloadCurrentROI()));
158 connect(mCheckBoxShowAll, SIGNAL(stateChanged(int)), this, SLOT(AllVisibleROIToggled(int)));
159 connect(mContourCheckBoxShowAll, SIGNAL(toggled(bool)), this, SLOT(AllVisibleContourROIToggled(bool)));
161 // Browse to load image
162 if (MustOpenDialogWhenCreated)
165 //------------------------------------------------------------------------------
168 //------------------------------------------------------------------------------
169 void vvToolStructureSetManager::Open(int type) {
171 case 0: OpenBinaryImage(); return; // Open binary image;
172 case 1: DD("TODO"); return; // Open DICOM RT
173 case 2: DD("TODO"); return; // Open mesh
174 default: std::cerr << "Error ????" << std::endl; exit(0);
177 //------------------------------------------------------------------------------
180 //------------------------------------------------------------------------------
181 void vvToolStructureSetManager::AddRoiInTreeWidget(clitk::DicomRT_ROI * roi, QTreeWidget * ww) {
182 QTreeWidgetItem * w = new QTreeWidgetItem(ww);
183 w->setText(0, QString("%1").arg(roi->GetROINumber()));
184 w->setText(1, QString("%1").arg(roi->GetName().c_str()));
185 QBrush brush(QColor(roi->GetDisplayColor()[0]*255, roi->GetDisplayColor()[1]*255, roi->GetDisplayColor()[2]*255));
186 brush.setStyle(Qt::SolidPattern);
187 w->setBackground(2, brush);
188 mMapROIToTreeWidget[roi] = w;
189 mMapTreeWidgetToROI[w] = roi;
190 mTree->resizeColumnToContents(0);
191 mTree->resizeColumnToContents(1);
193 //------------------------------------------------------------------------------
196 //------------------------------------------------------------------------------
197 void vvToolStructureSetManager::UpdateStructureSetInTreeWidget(int index, clitk::DicomRT_StructureSet * s) {
199 const std::vector<clitk::DicomRT_ROI::Pointer> & rois = s->GetListOfROI();
200 for(unsigned int i=0; i<rois.size(); i++) {
201 if (mMapROIToTreeWidget.find(rois[i]) == mMapROIToTreeWidget.end())
202 AddRoiInTreeWidget(rois[i], mTree); // replace mTree with ss if several SS
205 //------------------------------------------------------------------------------
208 //------------------------------------------------------------------------------
209 int vvToolStructureSetManager::AddStructureSet(clitk::DicomRT_StructureSet * mStructureSet) {
210 // Create actor for this SS
212 vvStructureSetActor * mStructureSetActor = new vvStructureSetActor;
214 mStructureSetActor->SetStructureSet(mStructureSet);
215 mStructureSetActor->SetSlicerManager(mCurrentSlicerManager);
216 // Insert in lists and get index
217 mStructureSetsList.push_back(mStructureSet);
218 mStructureSetActorsList.push_back(mStructureSetActor);
219 int index = mStructureSetsList.size()-1;
223 //------------------------------------------------------------------------------
226 //------------------------------------------------------------------------------
227 void vvToolStructureSetManager::OpenBinaryImage()
230 if (mCurrentStructureSet == NULL) {
231 if (mStructureSetsList.size() == 0) { // Create a default SS
232 clitk::DicomRT_StructureSet::Pointer mStructureSet = clitk::DicomRT_StructureSet::New();
233 index = AddStructureSet(mStructureSet);
235 else { // Get first SS
239 index = mCurrentStructureSetIndex;
241 mCurrentStructureSet = mStructureSetsList[index];
242 mCurrentStructureSetActor = mStructureSetActorsList[index];
243 mCurrentStructureSetIndex = index;
245 QString Extensions = "Images files ( *.mhd *.hdr *.his)";
246 Extensions += ";;All Files (*)";
247 QStringList filename =
248 QFileDialog::getOpenFileNames(this,tr("Open binary image"),
249 mMainWindowBase->GetInputPathName(),Extensions);
250 if (filename.size() == 0) return;
251 mLoadedROIIndex.clear();
252 for(int i=0; i<filename.size(); i++) {
254 QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
255 vvImageReader mReader;
256 std::vector<std::string> filenames;
257 filenames.push_back(filename[i].toStdString());
258 mReader.SetInputFilenames(filenames);
259 mReader.Update(IMAGE);
260 QApplication::restoreOverrideCursor();
262 if (mReader.GetLastError().size() != 0) {
263 std::cerr << "Error while reading " << filename[i].toStdString() << std::endl;
264 QString error = "Cannot open file \n";
265 error += mReader.GetLastError().c_str();
266 QMessageBox::information(this,tr("Reading problem"),error);
269 vvImage::Pointer binaryImage = mReader.GetOutput();
270 AddImage(binaryImage, filename[i].toStdString(), mBackgroundValueSpinBox->value());
271 mOpenedBinaryImage.push_back(binaryImage);
275 //------------------------------------------------------------------------------
278 //------------------------------------------------------------------------------
279 void vvToolStructureSetManager::UpdateImage()
281 // Update the TreeWidget
282 UpdateStructureSetInTreeWidget(mCurrentStructureSetIndex, mCurrentStructureSet);
283 // Render loaded ROIs (the first is sufficient)
284 for(unsigned int i=0; i<mLoadedROIIndex.size(); i++) {
285 mCurrentStructureSetActor->GetROIActor(mLoadedROIIndex[i])->Update();
287 for(int i=0; i<mCurrentSlicerManager->GetNumberOfSlicers(); i++) {
288 mCurrentSlicerManager->GetSlicer(i)->Render();
291 //------------------------------------------------------------------------------
294 //------------------------------------------------------------------------------
295 void vvToolStructureSetManager::AddImage(vvImage * binaryImage, std::string filename,
296 double BG, bool m_modeBG)
298 // Check current structure set
300 if (mCurrentStructureSet == NULL) {
301 if (mStructureSetsList.size() == 0) { // Create a default SS
302 clitk::DicomRT_StructureSet::Pointer mStructureSet = clitk::DicomRT_StructureSet::New();
303 index = AddStructureSet(mStructureSet);
305 else { // Get first SS
309 index = mCurrentStructureSetIndex;
311 mCurrentStructureSet = mStructureSetsList[index];
312 mCurrentStructureSetActor = mStructureSetActorsList[index];
313 mCurrentStructureSetIndex = index;
316 int dim = mCurrentImage->GetNumberOfDimensions();
317 int bin_dim = binaryImage->GetNumberOfDimensions();
318 if (dim < bin_dim) { ////////// TO CHANGE FOR 3D/4D
319 std::ostringstream os;
320 os << "Error. Loaded binary image is " << bin_dim
321 << "D while selected image is " << dim << "D" << std::endl;
322 QMessageBox::information(this,tr("Reading problem"),os.str().c_str());
326 // Add a new roi to the structure
327 int n = mCurrentStructureSet->AddBinaryImageAsNewROI(binaryImage, filename);
328 mLoadedROIIndex.push_back(n);
330 mCurrentStructureSet->GetROI(n)->SetBackgroundValueLabelImage(BG);
332 mCurrentStructureSet->GetROI(n)->SetForegroundValueLabelImage(BG);
335 if (n<mDefaultLUTColor->GetNumberOfTableValues ()) {
336 double * color = mDefaultLUTColor->GetTableValue(n % mDefaultLUTColor->GetNumberOfTableValues ());
337 mCurrentStructureSet->GetROI(n)->SetDisplayColor(color[0], color[1], color[2]);
340 // Add a new roi actor
341 mCurrentStructureSetActor->CreateNewROIActor(n, m_modeBG);
343 // CheckBox for "All"
344 if (mCurrentStructureSetActor->GetROIActor(n)->IsVisible())
345 mNumberOfVisibleROI++;
346 if (mCurrentStructureSetActor->GetROIActor(n)->IsContourVisible())
347 mNumberOfVisibleContourROI++;
348 UpdateAllROIStatus();
350 //------------------------------------------------------------------------------
353 //------------------------------------------------------------------------------
354 void vvToolStructureSetManager::apply()
358 //------------------------------------------------------------------------------
361 //------------------------------------------------------------------------------
362 bool vvToolStructureSetManager::close()
364 return vvToolWidgetBase::close();
366 //------------------------------------------------------------------------------
369 //------------------------------------------------------------------------------
370 void vvToolStructureSetManager::closeEvent(QCloseEvent *event)
372 std::vector<vvSlicerManager*>::iterator iter = std::find(mListOfInputs.begin(), mListOfInputs.end(), mCurrentSlicerManager);
373 if (iter != mListOfInputs.end()) mListOfInputs.erase(iter);
375 // DD("how delete mListOfOpenTool ???");
376 mListOfOpenTool.erase(mCurrentSlicerManager);
378 mCheckBoxShowAll->setCheckState(Qt::Unchecked);
379 mContourCheckBoxShowAll->setCheckState(Qt::Unchecked);
380 if (mCurrentSlicerManager != 0) mCurrentSlicerManager->Render();
381 if (mCurrentStructureSetActor) {
382 for(int i=0; i<mCurrentStructureSetActor->GetNumberOfROIs(); i++) {
383 mCurrentStructureSetActor->GetROIList()[i]->SetVisible(false);
384 mCurrentStructureSetActor->GetROIList()[i]->SetContourVisible(false);
385 delete mCurrentStructureSetActor->GetROIList()[i];
390 if (m_NumberOfTool == 1) {
391 mMainWindow->GetTab()->removeTab(mTabNumber);
397 //------------------------------------------------------------------------------
400 //------------------------------------------------------------------------------
401 // CURRENT ROI INTERACTION
402 //------------------------------------------------------------------------------
405 //------------------------------------------------------------------------------
406 void vvToolStructureSetManager::SelectedItemChangedInTree() {
407 // Search which roi is selected
408 QList<QTreeWidgetItem *> l = mTree->selectedItems();
410 mCurrentROIActor = NULL;
412 mGroupBoxROI->setEnabled(false);
415 QTreeWidgetItem * w = l[0];
416 if (mMapTreeWidgetToROI.find(w) == mMapTreeWidgetToROI.end()) {
417 mCurrentROIActor = NULL;
419 mGroupBoxROI->setEnabled(false);
422 clitk::DicomRT_ROI * roi = mMapTreeWidgetToROI[w];
423 // Get selected roi actor
424 vvROIActor * actor = mStructureSetActorsList[mCurrentStructureSetIndex]->GetROIActor(roi->GetROINumber());
426 mCurrentROIActor = actor;
429 mGroupBoxROI->setEnabled(true);
430 mROInameLabel->setText(roi->GetName().c_str());
431 mCheckBoxShow->setChecked(actor->IsVisible());
432 mContourCheckBoxShow->setChecked(actor->IsContourVisible());
433 mContourWidthSpinBox->setValue(actor->GetContourWidth());
435 // Warning -> avoir unuseful Render here by disconnect slider
436 disconnect(mOpacitySlider, SIGNAL(valueChanged(int)),
437 this, SLOT(OpacityChanged(int)));
438 mOpacitySlider->setValue((int)lrint(actor->GetOpacity()*100));
439 mOpacitySpinBox->setValue((int)lrint(actor->GetOpacity()*100));
440 connect(mOpacitySlider, SIGNAL(valueChanged(int)),
441 this, SLOT(OpacityChanged(int)));
445 mCurrentSlicerManager->Render();
447 //------------------------------------------------------------------------------
450 //------------------------------------------------------------------------------
451 void vvToolStructureSetManager::UpdateAllROIStatus() {
453 int nb = mCurrentStructureSetActor->GetROIList().size();
454 for(int i=0; i<nb; i++) {
455 if (mCurrentStructureSetActor->GetROIList()[i]->IsVisible()) {
460 disconnect(mCheckBoxShowAll, SIGNAL(stateChanged(int)), this, SLOT(AllVisibleROIToggled(int)));
461 disconnect(mContourCheckBoxShowAll, SIGNAL(toggled(bool)), this, SLOT(AllVisibleContourROIToggled(bool)));
462 if (nbVisible == nb) mCheckBoxShowAll->setCheckState(Qt::Checked);
464 if (nbVisible == 0) mCheckBoxShowAll->setCheckState(Qt::Unchecked);
465 else mCheckBoxShowAll->setCheckState(Qt::PartiallyChecked);
467 connect(mContourCheckBoxShowAll, SIGNAL(toggled(bool)), this, SLOT(AllVisibleContourROIToggled(bool)));
468 connect(mCheckBoxShowAll, SIGNAL(stateChanged(int)), this, SLOT(AllVisibleROIToggled(int)));
470 //------------------------------------------------------------------------------
472 //------------------------------------------------------------------------------
473 void vvToolStructureSetManager::VisibleROIToggled(bool b) {
474 if (mCurrentROIActor == NULL) return;
475 if (b == mCurrentROIActor->IsVisible()) return; // nothing to do
476 mCurrentROIActor->SetVisible(b);
477 UpdateAllROIStatus();
478 mCurrentSlicerManager->Render();
480 //------------------------------------------------------------------------------
483 //------------------------------------------------------------------------------
484 void vvToolStructureSetManager::VisibleContourROIToggled(bool b) {
485 if (mCurrentROIActor == NULL) return;
486 if (mCurrentROIActor->IsContourVisible() == b) return; // nothing to do
487 mCurrentROIActor->SetContourVisible(b);
488 mCurrentROIActor->UpdateColor();
489 mCurrentSlicerManager->Render();
491 //------------------------------------------------------------------------------
494 //------------------------------------------------------------------------------
495 void vvToolStructureSetManager::OpacityChanged(int v) {
496 if (mCurrentROIActor == NULL) return;
497 mCurrentROIActor->SetOpacity((double)v/100.0);
498 mCurrentROIActor->UpdateColor();
499 mCurrentSlicerManager->Render();
501 //------------------------------------------------------------------------------
504 //------------------------------------------------------------------------------
505 void vvToolStructureSetManager::AllVisibleROIToggled(int b) {
507 if ((mCheckBoxShowAll->checkState() == Qt::Checked) ||
508 (mCheckBoxShowAll->checkState() == Qt::PartiallyChecked)) status = true;
510 for(int i=0; i<mCurrentStructureSetActor->GetNumberOfROIs(); i++) {
511 mCurrentStructureSetActor->GetROIList()[i]->SetVisible(status);
513 if (status) mCheckBoxShowAll->setCheckState(Qt::Checked);
514 else mCheckBoxShowAll->setCheckState(Qt::Unchecked);
515 mCheckBoxShow->setChecked(status);
516 mCurrentSlicerManager->Render();
518 //------------------------------------------------------------------------------
521 //------------------------------------------------------------------------------
522 void vvToolStructureSetManager::AllVisibleContourROIToggled(bool b) {
524 if ((mContourCheckBoxShowAll->checkState() == Qt::Checked) ||
525 (mContourCheckBoxShowAll->checkState() == Qt::PartiallyChecked)) status = true;
527 for(int i=0; i<mCurrentStructureSetActor->GetNumberOfROIs(); i++) {
528 mCurrentStructureSetActor->GetROIList()[i]->SetContourVisible(status);
530 // Update current selection
531 if (status) mContourCheckBoxShowAll->setCheckState(Qt::Checked);
532 else mContourCheckBoxShowAll->setCheckState(Qt::Unchecked);
533 mContourCheckBoxShow->setChecked(status);
534 mCurrentSlicerManager->Render();
536 //------------------------------------------------------------------------------
539 //------------------------------------------------------------------------------
540 void vvToolStructureSetManager::ChangeColor() {
542 color.setRgbF(mCurrentROIActor->GetROI()->GetDisplayColor()[0],
543 mCurrentROIActor->GetROI()->GetDisplayColor()[1],
544 mCurrentROIActor->GetROI()->GetDisplayColor()[2]);
545 QColor c = QColorDialog::getColor(color, this, "Choose the ROI color");
546 mCurrentROIActor->GetROI()->SetDisplayColor(c.redF(), c.greenF(), c.blueF());
547 mCurrentROIActor->UpdateColor();
549 QTreeWidgetItem * w = mMapROIToTreeWidget[mCurrentROI];
550 QBrush brush(QColor(mCurrentROI->GetDisplayColor()[0]*255,
551 mCurrentROI->GetDisplayColor()[1]*255,
552 mCurrentROI->GetDisplayColor()[2]*255));
553 brush.setStyle(Qt::SolidPattern);
554 w->setBackground(2, brush);
556 mCurrentSlicerManager->Render();
558 //------------------------------------------------------------------------------
561 //------------------------------------------------------------------------------
562 void vvToolStructureSetManager::ChangeContourColor() {
564 color.setRgbF(mCurrentROIActor->GetContourColor()[0],
565 mCurrentROIActor->GetContourColor()[1],
566 mCurrentROIActor->GetContourColor()[2]);
567 QColor c = QColorDialog::getColor(color, this, "Choose the contour color");
568 mCurrentROIActor->SetContourColor(c.redF(), c.greenF(), c.blueF());
569 mCurrentROIActor->UpdateColor();
570 mCurrentSlicerManager->Render();
572 //------------------------------------------------------------------------------
575 //------------------------------------------------------------------------------
576 void vvToolStructureSetManager::ChangeContourWidth(int n) {
577 mCurrentROIActor->SetContourWidth(n);
578 mCurrentROIActor->UpdateColor();
579 mCurrentSlicerManager->Render();
581 //------------------------------------------------------------------------------
584 //------------------------------------------------------------------------------
585 void vvToolStructureSetManager::ReloadCurrentROI() {
587 vvImageReader mReader;
588 mReader.SetInputFilename(mCurrentROI->GetFilename());
589 mReader.Update(IMAGE);
590 if (mReader.GetLastError() != "") {
591 QMessageBox::information(mMainWindowBase, tr("Sorry, error. Could not reload"), mReader.GetLastError().c_str());
594 mCurrentROI->GetImage()->GetFirstVTKImageData()->ReleaseData();
595 mCurrentROI->SetImage(mReader.GetOutput());
598 mCurrentROIActor->UpdateImage();
599 mCurrentSlicerManager->Render();
601 //------------------------------------------------------------------------------
604 //------------------------------------------------------------------------------
605 void vvToolStructureSetManager::CheckInputList(std::vector<vvSlicerManager*> & l, int & index)
607 for(unsigned int i=0; i<l.size(); i++) {
608 std::vector<vvSlicerManager*>::iterator iter = std::find(mListOfInputs.begin(), mListOfInputs.end(), l[i]);
609 if (iter != mListOfInputs.end()) {
610 for(unsigned int j=i;j<l.size(); j++) l[j] = l[j+1];
612 if (index == (int)i) index = 0;
617 //------------------------------------------------------------------------------
620 //------------------------------------------------------------------------------
622 vvToolStructureSetManager * vvToolStructureSetManager::AddImage(vvSlicerManager * m, std::string name, vvImage::Pointer image, double BG, bool m_modeBG)
624 // If the tool is open for this vvSlicerManager, use it and return
625 if (mListOfOpenTool[m]) {
626 vvToolStructureSetManager * tool = mListOfOpenTool[m];
627 tool->AddImage(image, name, BG, m_modeBG);
632 // If the tool is not open, create it
633 vvToolStructureSetManager * tool = new vvToolStructureSetManager
634 (CREATOR(vvToolStructureSetManager)->GetMainWindow(), Qt::Dialog, m);
635 tool->AddImage(image, name, BG, m_modeBG);
640 //------------------------------------------------------------------------------