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(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()
103 mStructureSetActorsList.clear();
104 mMapROIToTreeWidget.clear();
107 for(uint i=0; i<mStructureSetsList[0]->GetListOfROI().size();i++) {
109 DD(mStructureSetsList[0]->GetROI(i)->GetImage()->GetReferenceCount());
110 // mStructureSetsList[0]->GetROI(i)->GetImage()->Delete();
114 mStructureSetsList.clear();
115 mOpenedBinaryImage.clear();
117 //------------------------------------------------------------------------------
120 //------------------------------------------------------------------------------
122 void vvToolStructureSetManager::Initialize() {
123 SetToolName("ROIManager");
124 SetToolMenuName("Display ROI (binary image)");
125 SetToolIconFilename(":/common/icons/tool-roi.png");
126 SetToolTip("Display ROI from a binary image.");
127 SetToolExperimental(false);
129 //------------------------------------------------------------------------------
132 //------------------------------------------------------------------------------
133 void vvToolStructureSetManager::InputIsSelected(vvSlicerManager *m)
135 //int mTabNumber = parent->GetTab()->addTab(this, "");
136 // this->setFixedWidth(120);
137 //this->setPreferedHeight(441);
139 if (mCurrentImage->GetNumberOfDimensions() != 3) {
140 QMessageBox::information(this,tr("Sorry only 3D yet"), tr("Sorry only 3D yet"));
144 HideInputSelector(); // splitter
145 mToolInputSelectionWidget->hide();
146 mLabelInputInfo->setText(QString("%1").arg(m->GetFileName().c_str()));
149 // if (!isWindow()) {
150 mListOfInputs.push_back(mCurrentSlicerManager);
151 mListOfOpenTool[mCurrentSlicerManager] = this;
154 // Connect open menus
155 connect(mOpenBinaryButton, SIGNAL(clicked()), this, SLOT(OpenBinaryImage()));
156 connect(mTree, SIGNAL(itemSelectionChanged()), this, SLOT(SelectedItemChangedInTree()));
157 connect(mCheckBoxShow, SIGNAL(toggled(bool)), this, SLOT(VisibleROIToggled(bool)));
158 connect(mOpacitySlider, SIGNAL(valueChanged(int)), this, SLOT(OpacityChanged(int)));
159 connect(mChangeColorButton, SIGNAL(clicked()), this, SLOT(ChangeColor()));
160 connect(mContourCheckBoxShow, SIGNAL(toggled(bool)), this, SLOT(VisibleContourROIToggled(bool)));
161 connect(mChangeContourColorButton, SIGNAL(clicked()), this, SLOT(ChangeContourColor()));
162 connect(mContourWidthSpinBox, SIGNAL(valueChanged(int)), this, SLOT(ChangeContourWidth(int)));
163 connect(mReloadButton, SIGNAL(clicked()), this, SLOT(ReloadCurrentROI()));
164 connect(mCheckBoxShowAll, SIGNAL(stateChanged(int)), this, SLOT(AllVisibleROIToggled(int)));
165 connect(mContourCheckBoxShowAll, SIGNAL(toggled(bool)), this, SLOT(AllVisibleContourROIToggled(bool)));
167 // Browse to load image
168 if (MustOpenDialogWhenCreated)
171 //------------------------------------------------------------------------------
174 //------------------------------------------------------------------------------
175 void vvToolStructureSetManager::Open(int type) {
177 case 0: OpenBinaryImage(); return; // Open binary image;
178 case 1: DD("TODO"); return; // Open DICOM RT
179 case 2: DD("TODO"); return; // Open mesh
180 default: std::cerr << "Error ????" << std::endl; exit(0);
183 //------------------------------------------------------------------------------
186 //------------------------------------------------------------------------------
187 void vvToolStructureSetManager::AddRoiInTreeWidget(clitk::DicomRT_ROI * roi, QTreeWidget * ww) {
188 QTreeWidgetItem * w = new QTreeWidgetItem(ww);
189 w->setText(0, QString("%1").arg(roi->GetROINumber()));
190 w->setText(1, QString("%1").arg(roi->GetName().c_str()));
191 QBrush brush(QColor(roi->GetDisplayColor()[0]*255, roi->GetDisplayColor()[1]*255, roi->GetDisplayColor()[2]*255));
192 brush.setStyle(Qt::SolidPattern);
193 w->setBackground(2, brush);
194 mMapROIToTreeWidget[roi] = w;
195 mMapTreeWidgetToROI[w] = roi;
196 mTree->resizeColumnToContents(0);
197 mTree->resizeColumnToContents(1);
199 //------------------------------------------------------------------------------
202 //------------------------------------------------------------------------------
203 void vvToolStructureSetManager::UpdateStructureSetInTreeWidget(int index, clitk::DicomRT_StructureSet * s) {
205 const std::vector<clitk::DicomRT_ROI*> & rois = s->GetListOfROI();
206 for(unsigned int i=0; i<rois.size(); i++) {
207 if (mMapROIToTreeWidget.find(rois[i]) == mMapROIToTreeWidget.end())
208 AddRoiInTreeWidget(rois[i], mTree); // replace mTree with ss if several SS
211 //------------------------------------------------------------------------------
214 //------------------------------------------------------------------------------
215 int vvToolStructureSetManager::AddStructureSet(clitk::DicomRT_StructureSet * mStructureSet) {
216 // Create actor for this SS
218 vvStructureSetActor * mStructureSetActor = new vvStructureSetActor;
220 mStructureSetActor->SetStructureSet(mStructureSet);
221 mStructureSetActor->SetSlicerManager(mCurrentSlicerManager);
222 // Insert in lists and get index
223 mStructureSetsList.push_back(mStructureSet);
224 mStructureSetActorsList.push_back(mStructureSetActor);
225 int index = mStructureSetsList.size()-1;
229 //------------------------------------------------------------------------------
232 //------------------------------------------------------------------------------
233 void vvToolStructureSetManager::OpenBinaryImage()
236 if (mCurrentStructureSet == NULL) {
237 if (mStructureSetsList.size() == 0) { // Create a default SS
238 clitk::DicomRT_StructureSet * mStructureSet = new clitk::DicomRT_StructureSet;
239 index = AddStructureSet(mStructureSet);
241 else { // Get first SS
245 index = mCurrentStructureSetIndex;
247 mCurrentStructureSet = mStructureSetsList[index];
248 mCurrentStructureSetActor = mStructureSetActorsList[index];
249 mCurrentStructureSetIndex = index;
251 QString Extensions = "Images files ( *.mhd *.hdr *.his)";
252 Extensions += ";;All Files (*)";
253 QStringList filename =
254 QFileDialog::getOpenFileNames(this,tr("Open binary image"),
255 mMainWindowBase->GetInputPathName(),Extensions);
256 if (filename.size() == 0) return;
257 mLoadedROIIndex.clear();
258 for(int i=0; i<filename.size(); i++) {
260 QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
261 vvImageReader * mReader = new vvImageReader;
262 std::vector<std::string> filenames;
263 filenames.push_back(filename[i].toStdString());
264 mReader->SetInputFilenames(filenames);
265 mReader->Update(IMAGE);
266 QApplication::restoreOverrideCursor();
268 if (mReader->GetLastError().size() != 0) {
269 std::cerr << "Error while reading " << filename[i].toStdString() << std::endl;
270 QString error = "Cannot open file \n";
271 error += mReader->GetLastError().c_str();
272 QMessageBox::information(this,tr("Reading problem"),error);
276 vvImage::Pointer binaryImage = mReader->GetOutput();
277 AddImage(binaryImage, filename[i].toStdString(), mBackgroundValueSpinBox->value());
278 mOpenedBinaryImage.push_back(binaryImage);
283 //------------------------------------------------------------------------------
286 //------------------------------------------------------------------------------
287 void vvToolStructureSetManager::UpdateImage()
289 // Update the TreeWidget
290 UpdateStructureSetInTreeWidget(mCurrentStructureSetIndex, mCurrentStructureSet);
291 // Render loaded ROIs (the first is sufficient)
292 for(unsigned int i=0; i<mLoadedROIIndex.size(); i++) {
293 mCurrentStructureSetActor->GetROIActor(mLoadedROIIndex[i])->Update();
295 for(int i=0; i<mCurrentSlicerManager->GetNumberOfSlicers(); i++) {
296 mCurrentSlicerManager->GetSlicer(i)->Render();
299 //------------------------------------------------------------------------------
302 //------------------------------------------------------------------------------
303 void vvToolStructureSetManager::AddImage(vvImage * binaryImage, std::string filename,
304 double BG, bool m_modeBG)
306 // Check current structure set
308 if (mCurrentStructureSet == NULL) {
309 if (mStructureSetsList.size() == 0) { // Create a default SS
310 clitk::DicomRT_StructureSet * mStructureSet = new clitk::DicomRT_StructureSet;
311 index = AddStructureSet(mStructureSet);
313 else { // Get first SS
317 index = mCurrentStructureSetIndex;
319 mCurrentStructureSet = mStructureSetsList[index];
320 mCurrentStructureSetActor = mStructureSetActorsList[index];
321 mCurrentStructureSetIndex = index;
324 int dim = mCurrentImage->GetNumberOfDimensions();
325 int bin_dim = binaryImage->GetNumberOfDimensions();
326 if (dim < bin_dim) { ////////// TO CHANGE FOR 3D/4D
327 std::ostringstream os;
328 os << "Error. Loaded binary image is " << bin_dim
329 << "D while selected image is " << dim << "D" << std::endl;
330 QMessageBox::information(this,tr("Reading problem"),os.str().c_str());
334 // Add a new roi to the structure
335 int n = mCurrentStructureSet->AddBinaryImageAsNewROI(binaryImage, filename);
336 mLoadedROIIndex.push_back(n);
338 mCurrentStructureSet->GetROI(n)->SetBackgroundValueLabelImage(BG);
340 mCurrentStructureSet->GetROI(n)->SetForegroundValueLabelImage(BG);
343 if (n<mDefaultLUTColor->GetNumberOfTableValues ()) {
344 double * color = mDefaultLUTColor->GetTableValue(n % mDefaultLUTColor->GetNumberOfTableValues ());
345 mCurrentStructureSet->GetROI(n)->SetDisplayColor(color[0], color[1], color[2]);
348 // Add a new roi actor
349 mCurrentStructureSetActor->CreateNewROIActor(n, m_modeBG);
351 // CheckBox for "All"
352 if (mCurrentStructureSetActor->GetROIActor(n)->IsVisible())
353 mNumberOfVisibleROI++;
354 if (mCurrentStructureSetActor->GetROIActor(n)->IsContourVisible())
355 mNumberOfVisibleContourROI++;
356 UpdateAllROIStatus();
358 //------------------------------------------------------------------------------
361 //------------------------------------------------------------------------------
362 void vvToolStructureSetManager::apply()
366 //------------------------------------------------------------------------------
369 //------------------------------------------------------------------------------
370 bool vvToolStructureSetManager::close()
372 return vvToolWidgetBase::close();
374 //------------------------------------------------------------------------------
377 //------------------------------------------------------------------------------
378 void vvToolStructureSetManager::closeEvent(QCloseEvent *event)
380 std::vector<vvSlicerManager*>::iterator iter = std::find(mListOfInputs.begin(), mListOfInputs.end(), mCurrentSlicerManager);
381 if (iter != mListOfInputs.end()) mListOfInputs.erase(iter);
383 // DD("how delete mListOfOpenTool ???");
384 mListOfOpenTool.erase(mCurrentSlicerManager);
386 mCheckBoxShowAll->setCheckState(Qt::Unchecked);
387 mContourCheckBoxShowAll->setCheckState(Qt::Unchecked);
388 if (mCurrentSlicerManager != 0) mCurrentSlicerManager->Render();
389 if (mCurrentStructureSetActor) {
390 for(int i=0; i<mCurrentStructureSetActor->GetNumberOfROIs(); i++) {
391 mCurrentStructureSetActor->GetROIList()[i]->SetVisible(false);
392 mCurrentStructureSetActor->GetROIList()[i]->SetContourVisible(false);
393 delete mCurrentStructureSetActor->GetROIList()[i];
398 if (m_NumberOfTool == 1) {
399 mMainWindow->GetTab()->removeTab(mTabNumber);
405 //------------------------------------------------------------------------------
408 //------------------------------------------------------------------------------
409 // CURRENT ROI INTERACTION
410 //------------------------------------------------------------------------------
413 //------------------------------------------------------------------------------
414 void vvToolStructureSetManager::SelectedItemChangedInTree() {
415 // Search which roi is selected
416 QList<QTreeWidgetItem *> l = mTree->selectedItems();
418 mCurrentROIActor = NULL;
420 mGroupBoxROI->setEnabled(false);
423 QTreeWidgetItem * w = l[0];
424 if (mMapTreeWidgetToROI.find(w) == mMapTreeWidgetToROI.end()) {
425 mCurrentROIActor = NULL;
427 mGroupBoxROI->setEnabled(false);
430 clitk::DicomRT_ROI * roi = mMapTreeWidgetToROI[w];
431 // Get selected roi actor
432 vvROIActor * actor = mStructureSetActorsList[mCurrentStructureSetIndex]->GetROIActor(roi->GetROINumber());
434 mCurrentROIActor = actor;
437 mGroupBoxROI->setEnabled(true);
438 mROInameLabel->setText(roi->GetName().c_str());
439 mCheckBoxShow->setChecked(actor->IsVisible());
440 mContourCheckBoxShow->setChecked(actor->IsContourVisible());
441 mContourWidthSpinBox->setValue(actor->GetContourWidth());
443 // Warning -> avoir unuseful Render here by disconnect slider
444 disconnect(mOpacitySlider, SIGNAL(valueChanged(int)),
445 this, SLOT(OpacityChanged(int)));
446 mOpacitySlider->setValue((int)lrint(actor->GetOpacity()*100));
447 mOpacitySpinBox->setValue((int)lrint(actor->GetOpacity()*100));
448 connect(mOpacitySlider, SIGNAL(valueChanged(int)),
449 this, SLOT(OpacityChanged(int)));
453 mCurrentSlicerManager->Render();
455 //------------------------------------------------------------------------------
458 //------------------------------------------------------------------------------
459 void vvToolStructureSetManager::UpdateAllROIStatus() {
461 int nb = mCurrentStructureSetActor->GetROIList().size();
462 for(int i=0; i<nb; i++) {
463 if (mCurrentStructureSetActor->GetROIList()[i]->IsVisible()) {
468 disconnect(mCheckBoxShowAll, SIGNAL(stateChanged(int)), this, SLOT(AllVisibleROIToggled(int)));
469 disconnect(mContourCheckBoxShowAll, SIGNAL(toggled(bool)), this, SLOT(AllVisibleContourROIToggled(bool)));
470 if (nbVisible == nb) mCheckBoxShowAll->setCheckState(Qt::Checked);
472 if (nbVisible == 0) mCheckBoxShowAll->setCheckState(Qt::Unchecked);
473 else mCheckBoxShowAll->setCheckState(Qt::PartiallyChecked);
475 connect(mContourCheckBoxShowAll, SIGNAL(toggled(bool)), this, SLOT(AllVisibleContourROIToggled(bool)));
476 connect(mCheckBoxShowAll, SIGNAL(stateChanged(int)), this, SLOT(AllVisibleROIToggled(int)));
478 //------------------------------------------------------------------------------
480 //------------------------------------------------------------------------------
481 void vvToolStructureSetManager::VisibleROIToggled(bool b) {
482 if (mCurrentROIActor == NULL) return;
483 if (b == mCurrentROIActor->IsVisible()) return; // nothing to do
484 mCurrentROIActor->SetVisible(b);
485 UpdateAllROIStatus();
486 mCurrentSlicerManager->Render();
488 //------------------------------------------------------------------------------
491 //------------------------------------------------------------------------------
492 void vvToolStructureSetManager::VisibleContourROIToggled(bool b) {
493 if (mCurrentROIActor == NULL) return;
494 if (mCurrentROIActor->IsContourVisible() == b) return; // nothing to do
495 mCurrentROIActor->SetContourVisible(b);
496 mCurrentROIActor->UpdateColor();
497 mCurrentSlicerManager->Render();
499 //------------------------------------------------------------------------------
502 //------------------------------------------------------------------------------
503 void vvToolStructureSetManager::OpacityChanged(int v) {
504 if (mCurrentROIActor == NULL) return;
505 mCurrentROIActor->SetOpacity((double)v/100.0);
506 mCurrentROIActor->UpdateColor();
507 mCurrentSlicerManager->Render();
509 //------------------------------------------------------------------------------
512 //------------------------------------------------------------------------------
513 void vvToolStructureSetManager::AllVisibleROIToggled(int b) {
515 if ((mCheckBoxShowAll->checkState() == Qt::Checked) ||
516 (mCheckBoxShowAll->checkState() == Qt::PartiallyChecked)) status = true;
518 for(int i=0; i<mCurrentStructureSetActor->GetNumberOfROIs(); i++) {
519 mCurrentStructureSetActor->GetROIList()[i]->SetVisible(status);
521 if (status) mCheckBoxShowAll->setCheckState(Qt::Checked);
522 else mCheckBoxShowAll->setCheckState(Qt::Unchecked);
523 mCheckBoxShow->setChecked(status);
524 mCurrentSlicerManager->Render();
526 //------------------------------------------------------------------------------
529 //------------------------------------------------------------------------------
530 void vvToolStructureSetManager::AllVisibleContourROIToggled(bool b) {
532 if ((mContourCheckBoxShowAll->checkState() == Qt::Checked) ||
533 (mContourCheckBoxShowAll->checkState() == Qt::PartiallyChecked)) status = true;
535 for(int i=0; i<mCurrentStructureSetActor->GetNumberOfROIs(); i++) {
536 mCurrentStructureSetActor->GetROIList()[i]->SetContourVisible(status);
538 // Update current selection
539 if (status) mContourCheckBoxShowAll->setCheckState(Qt::Checked);
540 else mContourCheckBoxShowAll->setCheckState(Qt::Unchecked);
541 mContourCheckBoxShow->setChecked(status);
542 mCurrentSlicerManager->Render();
544 //------------------------------------------------------------------------------
547 //------------------------------------------------------------------------------
548 void vvToolStructureSetManager::ChangeColor() {
550 color.setRgbF(mCurrentROIActor->GetROI()->GetDisplayColor()[0],
551 mCurrentROIActor->GetROI()->GetDisplayColor()[1],
552 mCurrentROIActor->GetROI()->GetDisplayColor()[2]);
553 QColor c = QColorDialog::getColor(color, this, "Choose the ROI color");
554 mCurrentROIActor->GetROI()->SetDisplayColor(c.redF(), c.greenF(), c.blueF());
555 mCurrentROIActor->UpdateColor();
557 QTreeWidgetItem * w = mMapROIToTreeWidget[mCurrentROI];
558 QBrush brush(QColor(mCurrentROI->GetDisplayColor()[0]*255,
559 mCurrentROI->GetDisplayColor()[1]*255,
560 mCurrentROI->GetDisplayColor()[2]*255));
561 brush.setStyle(Qt::SolidPattern);
562 w->setBackground(2, brush);
564 mCurrentSlicerManager->Render();
566 //------------------------------------------------------------------------------
569 //------------------------------------------------------------------------------
570 void vvToolStructureSetManager::ChangeContourColor() {
572 color.setRgbF(mCurrentROIActor->GetContourColor()[0],
573 mCurrentROIActor->GetContourColor()[1],
574 mCurrentROIActor->GetContourColor()[2]);
575 QColor c = QColorDialog::getColor(color, this, "Choose the contour color");
576 mCurrentROIActor->SetContourColor(c.redF(), c.greenF(), c.blueF());
577 mCurrentROIActor->UpdateColor();
578 mCurrentSlicerManager->Render();
580 //------------------------------------------------------------------------------
583 //------------------------------------------------------------------------------
584 void vvToolStructureSetManager::ChangeContourWidth(int n) {
585 mCurrentROIActor->SetContourWidth(n);
586 mCurrentROIActor->UpdateColor();
587 mCurrentSlicerManager->Render();
589 //------------------------------------------------------------------------------
592 //------------------------------------------------------------------------------
593 void vvToolStructureSetManager::ReloadCurrentROI() {
595 vvImageReader * mReader = new vvImageReader;
596 mReader->SetInputFilename(mCurrentROI->GetFilename());
597 mReader->Update(IMAGE);
598 if (mReader->GetLastError() != "") {
599 QMessageBox::information(mMainWindowBase, tr("Sorry, error. Could not reload"), mReader->GetLastError().c_str());
602 mCurrentROI->GetImage()->GetFirstVTKImageData()->ReleaseData();
603 mCurrentROI->SetImage(mReader->GetOutput());
606 mCurrentROIActor->UpdateImage();
607 mCurrentSlicerManager->Render();
609 //------------------------------------------------------------------------------
612 //------------------------------------------------------------------------------
613 void vvToolStructureSetManager::CheckInputList(std::vector<vvSlicerManager*> & l, int & index)
615 for(unsigned int i=0; i<l.size(); i++) {
616 std::vector<vvSlicerManager*>::iterator iter = std::find(mListOfInputs.begin(), mListOfInputs.end(), l[i]);
617 if (iter != mListOfInputs.end()) {
618 for(unsigned int j=i;j<l.size(); j++) l[j] = l[j+1];
620 if (index == (int)i) index = 0;
625 //------------------------------------------------------------------------------
628 //------------------------------------------------------------------------------
630 vvToolStructureSetManager * vvToolStructureSetManager::AddImage(vvSlicerManager * m, std::string name, vvImage::Pointer image, double BG, bool m_modeBG)
632 // If the tool is open for this vvSlicerManager, use it and return
633 if (mListOfOpenTool[m]) {
634 vvToolStructureSetManager * tool = mListOfOpenTool[m];
635 tool->AddImage(image, name, BG, m_modeBG);
640 // If the tool is not open, create it
641 vvToolStructureSetManager * tool = new vvToolStructureSetManager
642 (CREATOR(vvToolStructureSetManager)->GetMainWindow(), Qt::Dialog, m);
643 tool->AddImage(image, name, BG, m_modeBG);
648 //------------------------------------------------------------------------------