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 = vtkLookupTable::New();
73 for(unsigned 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 //------------------------------------------------------------------------------
107 //------------------------------------------------------------------------------
109 void vvToolStructureSetManager::Initialize() {
110 SetToolName("ROIManager");
111 SetToolMenuName("Display ROI");
112 SetToolIconFilename(":/common/icons/tool-roi.png");
113 SetToolTip("Display ROI from label image.");
114 SetToolExperimental(true);
116 //------------------------------------------------------------------------------
119 //------------------------------------------------------------------------------
120 void vvToolStructureSetManager::InputIsSelected(vvSlicerManager *m)
122 //int mTabNumber = parent->GetTab()->addTab(this, "");
123 // this->setFixedWidth(120);
124 //this->setPreferedHeight(441);
126 if (mCurrentImage->GetNumberOfDimensions() != 3) {
127 QMessageBox::information(this,tr("Sorry only 3D yet"), tr("Sorry only 3D yet"));
131 HideInputSelector(); // splitter
132 mToolInputSelectionWidget->hide();
133 mLabelInputInfo->setText(QString("%1").arg(m->GetFileName().c_str()));
136 // if (!isWindow()) {
137 mListOfInputs.push_back(mCurrentSlicerManager);
138 mListOfOpenTool[mCurrentSlicerManager] = this;
141 // Connect open menus
142 connect(mOpenBinaryButton, SIGNAL(clicked()), this, SLOT(OpenBinaryImage()));
143 connect(mTree, SIGNAL(itemSelectionChanged()), this, SLOT(SelectedItemChangedInTree()));
144 connect(mCheckBoxShow, SIGNAL(toggled(bool)), this, SLOT(VisibleROIToggled(bool)));
145 connect(mOpacitySlider, SIGNAL(valueChanged(int)), this, SLOT(OpacityChanged(int)));
146 connect(mChangeColorButton, SIGNAL(clicked()), this, SLOT(ChangeColor()));
147 connect(mContourCheckBoxShow, SIGNAL(toggled(bool)), this, SLOT(VisibleContourROIToggled(bool)));
148 connect(mChangeContourColorButton, SIGNAL(clicked()), this, SLOT(ChangeContourColor()));
149 connect(mContourWidthSpinBox, SIGNAL(valueChanged(int)), this, SLOT(ChangeContourWidth(int)));
150 connect(mReloadButton, SIGNAL(clicked()), this, SLOT(ReloadCurrentROI()));
151 connect(mCheckBoxShowAll, SIGNAL(stateChanged(int)), this, SLOT(AllVisibleROIToggled(int)));
152 connect(mContourCheckBoxShowAll, SIGNAL(toggled(bool)), this, SLOT(AllVisibleContourROIToggled(bool)));
154 // Browse to load image
155 if (MustOpenDialogWhenCreated)
158 //------------------------------------------------------------------------------
161 //------------------------------------------------------------------------------
162 void vvToolStructureSetManager::Open(int type) {
164 case 0: OpenBinaryImage(); return; // Open binary image;
165 case 1: DD("TODO"); return; // Open DICOM RT
166 case 2: DD("TODO"); return; // Open mesh
167 default: std::cerr << "Error ????" << std::endl; exit(0);
170 //------------------------------------------------------------------------------
173 //------------------------------------------------------------------------------
174 void vvToolStructureSetManager::AddRoiInTreeWidget(clitk::DicomRT_ROI * roi, QTreeWidget * ww) {
175 QTreeWidgetItem * w = new QTreeWidgetItem(ww);
176 w->setText(0, QString("%1").arg(roi->GetROINumber()));
177 w->setText(1, QString("%1").arg(roi->GetName().c_str()));
178 QBrush brush(QColor(roi->GetDisplayColor()[0]*255, roi->GetDisplayColor()[1]*255, roi->GetDisplayColor()[2]*255));
179 brush.setStyle(Qt::SolidPattern);
180 w->setBackground(2, brush);
181 mMapROIToTreeWidget[roi] = w;
182 mMapTreeWidgetToROI[w] = roi;
183 mTree->resizeColumnToContents(0);
184 mTree->resizeColumnToContents(1);
186 //------------------------------------------------------------------------------
189 //------------------------------------------------------------------------------
190 void vvToolStructureSetManager::UpdateStructureSetInTreeWidget(int index, clitk::DicomRT_StructureSet * s) {
192 const std::vector<clitk::DicomRT_ROI*> & rois = s->GetListOfROI();
193 for(unsigned int i=0; i<rois.size(); i++) {
194 if (mMapROIToTreeWidget.find(rois[i]) == mMapROIToTreeWidget.end())
195 AddRoiInTreeWidget(rois[i], mTree); // replace mTree with ss if several SS
198 //------------------------------------------------------------------------------
201 //------------------------------------------------------------------------------
202 int vvToolStructureSetManager::AddStructureSet(clitk::DicomRT_StructureSet * mStructureSet) {
203 // Create actor for this SS
204 vvStructureSetActor * mStructureSetActor = new vvStructureSetActor;
205 mStructureSetActor->SetStructureSet(mStructureSet);
206 mStructureSetActor->SetSlicerManager(mCurrentSlicerManager);
207 // Insert in lists and get index
208 mStructureSetsList.push_back(mStructureSet);
209 mStructureSetActorsList.push_back(mStructureSetActor);
210 int index = mStructureSetsList.size()-1;
214 //------------------------------------------------------------------------------
217 //------------------------------------------------------------------------------
218 void vvToolStructureSetManager::OpenBinaryImage()
221 if (mCurrentStructureSet == NULL) {
222 if (mStructureSetsList.size() == 0) { // Create a default SS
223 clitk::DicomRT_StructureSet * mStructureSet = new clitk::DicomRT_StructureSet;
224 index = AddStructureSet(mStructureSet);
226 else { // Get first SS
230 index = mCurrentStructureSetIndex;
232 mCurrentStructureSet = mStructureSetsList[index];
233 mCurrentStructureSetActor = mStructureSetActorsList[index];
234 mCurrentStructureSetIndex = index;
236 QString Extensions = "Images files ( *.mhd *.hdr *.his)";
237 Extensions += ";;All Files (*)";
238 QStringList filename =
239 QFileDialog::getOpenFileNames(this,tr("Open binary image"),
240 mMainWindowBase->GetInputPathName(),Extensions);
241 if (filename.size() == 0) return;
242 mLoadedROIIndex.clear();
243 for(int i=0; i<filename.size(); i++) {
245 QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
246 vvImageReader * mReader = new vvImageReader;
247 std::vector<std::string> filenames;
248 filenames.push_back(filename[i].toStdString());
249 mReader->SetInputFilenames(filenames);
250 mReader->Update(IMAGE);
251 QApplication::restoreOverrideCursor();
253 if (mReader->GetLastError().size() != 0) {
254 std::cerr << "Error while reading " << filename[i].toStdString() << std::endl;
255 QString error = "Cannot open file \n";
256 error += mReader->GetLastError().c_str();
257 QMessageBox::information(this,tr("Reading problem"),error);
261 vvImage::Pointer binaryImage = mReader->GetOutput();
262 AddImage(binaryImage, filename[i].toStdString(), mBackgroundValueSpinBox->value());
266 //------------------------------------------------------------------------------
269 //------------------------------------------------------------------------------
270 void vvToolStructureSetManager::UpdateImage()
272 // Update the TreeWidget
273 UpdateStructureSetInTreeWidget(mCurrentStructureSetIndex, mCurrentStructureSet);
274 // Render loaded ROIs (the first is sufficient)
275 for(unsigned int i=0; i<mLoadedROIIndex.size(); i++) {
276 mCurrentStructureSetActor->GetROIActor(mLoadedROIIndex[i])->Update();
278 for(int i=0; i<mCurrentSlicerManager->NumberOfSlicers(); i++) {
279 mCurrentSlicerManager->GetSlicer(i)->Render();
282 //------------------------------------------------------------------------------
285 //------------------------------------------------------------------------------
286 void vvToolStructureSetManager::AddImage(vvImage::Pointer binaryImage, std::string filename, double BG, bool m_modeBG)
288 // Check current structure set
290 if (mCurrentStructureSet == NULL) {
291 if (mStructureSetsList.size() == 0) { // Create a default SS
292 clitk::DicomRT_StructureSet * mStructureSet = new clitk::DicomRT_StructureSet;
293 index = AddStructureSet(mStructureSet);
295 else { // Get first SS
299 index = mCurrentStructureSetIndex;
301 mCurrentStructureSet = mStructureSetsList[index];
302 mCurrentStructureSetActor = mStructureSetActorsList[index];
303 mCurrentStructureSetIndex = index;
306 int dim = mCurrentImage->GetNumberOfDimensions();
307 int bin_dim = binaryImage->GetNumberOfDimensions();
308 if (dim < bin_dim) { ////////// TO CHANGE FOR 3D/4D
309 std::ostringstream os;
310 os << "Error. Loaded binary image is " << bin_dim
311 << "D while selected image is " << dim << "D" << std::endl;
312 QMessageBox::information(this,tr("Reading problem"),os.str().c_str());
316 // Add a new roi to the structure
317 int n = mCurrentStructureSet->AddBinaryImageAsNewROI(binaryImage, filename);
318 mLoadedROIIndex.push_back(n);
320 mCurrentStructureSet->GetROI(n)->SetBackgroundValueLabelImage(BG);
322 mCurrentStructureSet->GetROI(n)->SetForegroundValueLabelImage(BG);
325 if (n<mDefaultLUTColor->GetNumberOfTableValues ()) {
326 double * color = mDefaultLUTColor->GetTableValue(n % mDefaultLUTColor->GetNumberOfTableValues ());
327 mCurrentStructureSet->GetROI(n)->SetDisplayColor(color[0], color[1], color[2]);
330 // Add a new roi actor
331 mCurrentStructureSetActor->CreateNewROIActor(n, m_modeBG);
333 // CheckBox for "All"
334 if (mCurrentStructureSetActor->GetROIActor(n)->IsVisible())
335 mNumberOfVisibleROI++;
336 if (mCurrentStructureSetActor->GetROIActor(n)->IsContourVisible())
337 mNumberOfVisibleContourROI++;
338 UpdateAllROIStatus();
340 //------------------------------------------------------------------------------
343 //------------------------------------------------------------------------------
344 void vvToolStructureSetManager::apply()
348 //------------------------------------------------------------------------------
351 //------------------------------------------------------------------------------
352 bool vvToolStructureSetManager::close()
354 return vvToolWidgetBase::close();
356 //------------------------------------------------------------------------------
359 //------------------------------------------------------------------------------
360 void vvToolStructureSetManager::closeEvent(QCloseEvent *event)
362 // DD("vvToolStructureSetManager::closeEvent()");
363 std::vector<vvSlicerManager*>::iterator iter = std::find(mListOfInputs.begin(), mListOfInputs.end(), mCurrentSlicerManager);
364 if (iter != mListOfInputs.end()) mListOfInputs.erase(iter);
366 // DD("how delete mListOfOpenTool ???");
367 mListOfOpenTool.erase(mCurrentSlicerManager);
369 mCheckBoxShowAll->setCheckState(Qt::Unchecked);
370 mContourCheckBoxShowAll->setCheckState(Qt::Unchecked);
371 if (mCurrentSlicerManager != 0) mCurrentSlicerManager->Render();
372 if (mCurrentStructureSetActor) {
373 for(int i=0; i<mCurrentStructureSetActor->GetNumberOfROIs(); i++) {
375 mCurrentStructureSetActor->GetROIList()[i]->SetVisible(false);
376 mCurrentStructureSetActor->GetROIList()[i]->SetContourVisible(false);
377 delete mCurrentStructureSetActor->GetROIList()[i];
382 if (m_NumberOfTool == 1) {
383 mMainWindow->GetTab()->removeTab(mTabNumber);
389 //------------------------------------------------------------------------------
392 //------------------------------------------------------------------------------
393 // CURRENT ROI INTERACTION
394 //------------------------------------------------------------------------------
397 //------------------------------------------------------------------------------
398 void vvToolStructureSetManager::SelectedItemChangedInTree() {
399 // Search which roi is selected
400 QList<QTreeWidgetItem *> l = mTree->selectedItems();
402 mCurrentROIActor = NULL;
404 mGroupBoxROI->setEnabled(false);
407 QTreeWidgetItem * w = l[0];
408 if (mMapTreeWidgetToROI.find(w) == mMapTreeWidgetToROI.end()) {
409 mCurrentROIActor = NULL;
411 mGroupBoxROI->setEnabled(false);
414 clitk::DicomRT_ROI * roi = mMapTreeWidgetToROI[w];
415 // Get selected roi actor
416 vvROIActor * actor = mStructureSetActorsList[mCurrentStructureSetIndex]->GetROIActor(roi->GetROINumber());
418 mCurrentROIActor = actor;
421 mGroupBoxROI->setEnabled(true);
422 mROInameLabel->setText(roi->GetName().c_str());
423 mCheckBoxShow->setChecked(actor->IsVisible());
424 mContourCheckBoxShow->setChecked(actor->IsContourVisible());
425 mContourWidthSpinBox->setValue(actor->GetContourWidth());
427 // Warning -> avoir unuseful Render here by disconnect slider
428 disconnect(mOpacitySlider, SIGNAL(valueChanged(int)),
429 this, SLOT(OpacityChanged(int)));
430 mOpacitySlider->setValue((int)lrint(actor->GetOpacity()*100));
431 mOpacitySpinBox->setValue((int)lrint(actor->GetOpacity()*100));
432 connect(mOpacitySlider, SIGNAL(valueChanged(int)),
433 this, SLOT(OpacityChanged(int)));
437 mCurrentSlicerManager->Render();
439 //------------------------------------------------------------------------------
442 //------------------------------------------------------------------------------
443 void vvToolStructureSetManager::UpdateAllROIStatus() {
445 int nb = mCurrentStructureSetActor->GetROIList().size();
446 for(int i=0; i<nb; i++) {
447 if (mCurrentStructureSetActor->GetROIList()[i]->IsVisible()) {
452 disconnect(mCheckBoxShowAll, SIGNAL(stateChanged(int)), this, SLOT(AllVisibleROIToggled(int)));
453 disconnect(mContourCheckBoxShowAll, SIGNAL(toggled(bool)), this, SLOT(AllVisibleContourROIToggled(bool)));
454 if (nbVisible == nb) mCheckBoxShowAll->setCheckState(Qt::Checked);
456 if (nbVisible == 0) mCheckBoxShowAll->setCheckState(Qt::Unchecked);
457 else mCheckBoxShowAll->setCheckState(Qt::PartiallyChecked);
459 connect(mContourCheckBoxShowAll, SIGNAL(toggled(bool)), this, SLOT(AllVisibleContourROIToggled(bool)));
460 connect(mCheckBoxShowAll, SIGNAL(stateChanged(int)), this, SLOT(AllVisibleROIToggled(int)));
462 //------------------------------------------------------------------------------
464 //------------------------------------------------------------------------------
465 void vvToolStructureSetManager::VisibleROIToggled(bool b) {
466 if (mCurrentROIActor == NULL) return;
467 if (b == mCurrentROIActor->IsVisible()) return; // nothing to do
468 mCurrentROIActor->SetVisible(b);
469 UpdateAllROIStatus();
470 mCurrentSlicerManager->Render();
472 //------------------------------------------------------------------------------
475 //------------------------------------------------------------------------------
476 void vvToolStructureSetManager::VisibleContourROIToggled(bool b) {
477 if (mCurrentROIActor == NULL) return;
478 if (mCurrentROIActor->IsContourVisible() == b) return; // nothing to do
479 mCurrentROIActor->SetContourVisible(b);
480 mCurrentROIActor->UpdateColor();
481 mCurrentSlicerManager->Render();
483 //------------------------------------------------------------------------------
486 //------------------------------------------------------------------------------
487 void vvToolStructureSetManager::OpacityChanged(int v) {
488 if (mCurrentROIActor == NULL) return;
489 mCurrentROIActor->SetOpacity((double)v/100.0);
490 mCurrentROIActor->UpdateColor();
491 mCurrentSlicerManager->Render();
493 //------------------------------------------------------------------------------
496 //------------------------------------------------------------------------------
497 void vvToolStructureSetManager::AllVisibleROIToggled(int b) {
499 if ((mCheckBoxShowAll->checkState() == Qt::Checked) ||
500 (mCheckBoxShowAll->checkState() == Qt::PartiallyChecked)) status = true;
502 for(int i=0; i<mCurrentStructureSetActor->GetNumberOfROIs(); i++) {
503 mCurrentStructureSetActor->GetROIList()[i]->SetVisible(status);
505 if (status) mCheckBoxShowAll->setCheckState(Qt::Checked);
506 else mCheckBoxShowAll->setCheckState(Qt::Unchecked);
507 mCheckBoxShow->setChecked(status);
508 mCurrentSlicerManager->Render();
510 //------------------------------------------------------------------------------
513 //------------------------------------------------------------------------------
514 void vvToolStructureSetManager::AllVisibleContourROIToggled(bool b) {
516 if ((mContourCheckBoxShowAll->checkState() == Qt::Checked) ||
517 (mContourCheckBoxShowAll->checkState() == Qt::PartiallyChecked)) status = true;
519 for(int i=0; i<mCurrentStructureSetActor->GetNumberOfROIs(); i++) {
520 mCurrentStructureSetActor->GetROIList()[i]->SetContourVisible(status);
522 // Update current selection
523 if (status) mContourCheckBoxShowAll->setCheckState(Qt::Checked);
524 else mContourCheckBoxShowAll->setCheckState(Qt::Unchecked);
525 mContourCheckBoxShow->setChecked(status);
526 mCurrentSlicerManager->Render();
528 //------------------------------------------------------------------------------
531 //------------------------------------------------------------------------------
532 void vvToolStructureSetManager::ChangeColor() {
534 color.setRgbF(mCurrentROIActor->GetROI()->GetDisplayColor()[0],
535 mCurrentROIActor->GetROI()->GetDisplayColor()[1],
536 mCurrentROIActor->GetROI()->GetDisplayColor()[2]);
537 QColor c = QColorDialog::getColor(color, this, "Choose the ROI color");
538 mCurrentROIActor->GetROI()->SetDisplayColor(c.redF(), c.greenF(), c.blueF());
539 mCurrentROIActor->UpdateColor();
541 QTreeWidgetItem * w = mMapROIToTreeWidget[mCurrentROI];
542 QBrush brush(QColor(mCurrentROI->GetDisplayColor()[0]*255,
543 mCurrentROI->GetDisplayColor()[1]*255,
544 mCurrentROI->GetDisplayColor()[2]*255));
545 brush.setStyle(Qt::SolidPattern);
546 w->setBackground(2, brush);
548 mCurrentSlicerManager->Render();
550 //------------------------------------------------------------------------------
553 //------------------------------------------------------------------------------
554 void vvToolStructureSetManager::ChangeContourColor() {
556 color.setRgbF(mCurrentROIActor->GetContourColor()[0],
557 mCurrentROIActor->GetContourColor()[1],
558 mCurrentROIActor->GetContourColor()[2]);
559 QColor c = QColorDialog::getColor(color, this, "Choose the contour color");
560 mCurrentROIActor->SetContourColor(c.redF(), c.greenF(), c.blueF());
561 mCurrentROIActor->UpdateColor();
562 mCurrentSlicerManager->Render();
564 //------------------------------------------------------------------------------
567 //------------------------------------------------------------------------------
568 void vvToolStructureSetManager::ChangeContourWidth(int n) {
569 mCurrentROIActor->SetContourWidth(n);
570 mCurrentROIActor->UpdateColor();
571 mCurrentSlicerManager->Render();
573 //------------------------------------------------------------------------------
576 //------------------------------------------------------------------------------
577 void vvToolStructureSetManager::ReloadCurrentROI() {
579 vvImageReader * mReader = new vvImageReader;
580 mReader->SetInputFilename(mCurrentROI->GetFilename());
581 mReader->Update(IMAGE);
582 if (mReader->GetLastError() != "") {
583 QMessageBox::information(mMainWindowBase, tr("Sorry, error. Could not reload"), mReader->GetLastError().c_str());
586 // delete mCurrentROI->GetImage();
587 // DD(mCurrentROI->GetImage()->GetFirstVTKImageData()->GetDataReleased());
588 // DD(mCurrentROI->GetImage()->GetFirstVTKImageData()->GetReferenceCount());
589 mCurrentROI->GetImage()->GetFirstVTKImageData()->ReleaseData();
590 // DD(mCurrentROI->GetImage()->GetFirstVTKImageData()->GetDataReleased());
591 mCurrentROI->SetImage(mReader->GetOutput());
594 mCurrentROIActor->UpdateImage();
595 mCurrentSlicerManager->Render();
597 //------------------------------------------------------------------------------
600 //------------------------------------------------------------------------------
601 void vvToolStructureSetManager::CheckInputList(std::vector<vvSlicerManager*> & l, int & index)
603 for(unsigned int i=0; i<l.size(); i++) {
604 std::vector<vvSlicerManager*>::iterator iter = std::find(mListOfInputs.begin(), mListOfInputs.end(), l[i]);
605 if (iter != mListOfInputs.end()) {
606 for(unsigned int j=i;j<l.size(); j++) l[j] = l[j+1];
608 if (index == (int)i) index = 0;
613 //------------------------------------------------------------------------------
616 //------------------------------------------------------------------------------
618 vvToolStructureSetManager * vvToolStructureSetManager::AddImage(vvSlicerManager * m, std::string name, vvImage::Pointer image, double BG, bool m_modeBG)
620 // If the tool is open for this vvSlicerManager, use it and return
621 if (mListOfOpenTool[m]) {
622 vvToolStructureSetManager * tool = mListOfOpenTool[m];
623 tool->AddImage(image, name, BG, m_modeBG);
628 // If the tool is not open, create it
629 vvToolStructureSetManager * tool = new vvToolStructureSetManager
630 (CREATOR(vvToolStructureSetManager)->GetMainWindow(), Qt::Dialog, m);
631 tool->AddImage(image, name, BG, m_modeBG);
636 //------------------------------------------------------------------------------