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()
102 disconnect(mTree, SIGNAL(itemSelectionChanged()), this, SLOT(SelectedItemChangedInTree()));
105 //------------------------------------------------------------------------------
108 //------------------------------------------------------------------------------
110 void vvToolStructureSetManager::Initialize() {
111 SetToolName("ROIManager");
112 SetToolMenuName("Display ROI (binary image)");
113 SetToolIconFilename(":/common/icons/tool-roi.png");
114 SetToolTip("Display ROI from a binary image.");
115 SetToolExperimental(false);
117 //------------------------------------------------------------------------------
120 //------------------------------------------------------------------------------
121 void vvToolStructureSetManager::InputIsSelected(vvSlicerManager *m)
123 //int mTabNumber = parent->GetTab()->addTab(this, "");
124 // this->setFixedWidth(120);
125 //this->setPreferedHeight(441);
127 if (mCurrentImage->GetNumberOfDimensions() != 3) {
128 QMessageBox::information(this,tr("Sorry only 3D yet"), tr("Sorry only 3D yet"));
132 HideInputSelector(); // splitter
133 mToolInputSelectionWidget->hide();
134 mLabelInputInfo->setText(QString("%1").arg(m->GetFileName().c_str()));
137 // if (!isWindow()) {
138 mListOfInputs.push_back(mCurrentSlicerManager);
139 mListOfOpenTool[mCurrentSlicerManager] = this;
142 // Connect open menus
143 connect(mOpenBinaryButton, SIGNAL(clicked()), this, SLOT(OpenBinaryImage()));
144 connect(mTree, SIGNAL(itemSelectionChanged()), this, SLOT(SelectedItemChangedInTree()));
145 connect(mCheckBoxShow, SIGNAL(toggled(bool)), this, SLOT(VisibleROIToggled(bool)));
146 connect(mOpacitySlider, SIGNAL(valueChanged(int)), this, SLOT(OpacityChanged(int)));
147 connect(mChangeColorButton, SIGNAL(clicked()), this, SLOT(ChangeColor()));
148 connect(mContourCheckBoxShow, SIGNAL(toggled(bool)), this, SLOT(VisibleContourROIToggled(bool)));
149 connect(mChangeContourColorButton, SIGNAL(clicked()), this, SLOT(ChangeContourColor()));
150 connect(mContourWidthSpinBox, SIGNAL(valueChanged(int)), this, SLOT(ChangeContourWidth(int)));
151 connect(mReloadButton, SIGNAL(clicked()), this, SLOT(ReloadCurrentROI()));
152 connect(mCheckBoxShowAll, SIGNAL(stateChanged(int)), this, SLOT(AllVisibleROIToggled(int)));
153 connect(mContourCheckBoxShowAll, SIGNAL(toggled(bool)), this, SLOT(AllVisibleContourROIToggled(bool)));
155 // Browse to load image
156 if (MustOpenDialogWhenCreated)
159 //------------------------------------------------------------------------------
162 //------------------------------------------------------------------------------
163 void vvToolStructureSetManager::Open(int type) {
165 case 0: OpenBinaryImage(); return; // Open binary image;
166 case 1: DD("TODO"); return; // Open DICOM RT
167 case 2: DD("TODO"); return; // Open mesh
168 default: std::cerr << "Error ????" << std::endl; exit(0);
171 //------------------------------------------------------------------------------
174 //------------------------------------------------------------------------------
175 void vvToolStructureSetManager::AddRoiInTreeWidget(clitk::DicomRT_ROI * roi, QTreeWidget * ww) {
176 mTreeWidgetList.push_back(QSharedPointer<QTreeWidgetItem>(new QTreeWidgetItem(ww)));
177 QTreeWidgetItem * w = mTreeWidgetList.back().data();
178 w->setText(0, QString("%1").arg(roi->GetROINumber()));
179 w->setText(1, QString("%1").arg(roi->GetName().c_str()));
180 QBrush brush(QColor(roi->GetDisplayColor()[0]*255, roi->GetDisplayColor()[1]*255, roi->GetDisplayColor()[2]*255));
181 brush.setStyle(Qt::SolidPattern);
182 w->setBackground(2, brush);
183 mMapROIToTreeWidget[roi] = w;
184 mMapTreeWidgetToROI[w] = roi;
185 mTree->resizeColumnToContents(0);
186 mTree->resizeColumnToContents(1);
188 //------------------------------------------------------------------------------
191 //------------------------------------------------------------------------------
192 void vvToolStructureSetManager::UpdateStructureSetInTreeWidget(int index, clitk::DicomRT_StructureSet * s) {
194 const std::vector<clitk::DicomRT_ROI::Pointer> & rois = s->GetListOfROI();
195 for(unsigned int i=0; i<rois.size(); i++) {
196 if (mMapROIToTreeWidget.find(rois[i]) == mMapROIToTreeWidget.end())
197 AddRoiInTreeWidget(rois[i], mTree); // replace mTree with ss if several SS
200 //------------------------------------------------------------------------------
203 //------------------------------------------------------------------------------
204 int vvToolStructureSetManager::AddStructureSet(clitk::DicomRT_StructureSet * mStructureSet) {
205 // Create actor for this SS
207 QSharedPointer<vvStructureSetActor> mStructureSetActor(new vvStructureSetActor);
209 mStructureSetActor->SetStructureSet(mStructureSet);
210 mStructureSetActor->SetSlicerManager(mCurrentSlicerManager);
211 // Insert in lists and get index
212 mStructureSetsList.push_back(mStructureSet);
213 mStructureSetActorsList.push_back(mStructureSetActor);
214 int index = mStructureSetsList.size()-1;
218 //------------------------------------------------------------------------------
221 //------------------------------------------------------------------------------
222 void vvToolStructureSetManager::OpenBinaryImage()
225 if (mCurrentStructureSet == NULL) {
226 if (mStructureSetsList.size() == 0) { // Create a default SS
227 clitk::DicomRT_StructureSet::Pointer mStructureSet = clitk::DicomRT_StructureSet::New();
228 index = AddStructureSet(mStructureSet);
230 else { // Get first SS
234 index = mCurrentStructureSetIndex;
236 mCurrentStructureSet = mStructureSetsList[index];
237 mCurrentStructureSetActor = mStructureSetActorsList[index].data();
238 mCurrentStructureSetIndex = index;
240 QString Extensions = "Images files ( *.mhd *.hdr *.his)";
241 Extensions += ";;All Files (*)";
242 QStringList filename =
243 QFileDialog::getOpenFileNames(this,tr("Open binary image"),
244 mMainWindowBase->GetInputPathName(),Extensions);
245 if (filename.size() == 0) return;
246 mLoadedROIIndex.clear();
247 for(int i=0; i<filename.size(); i++) {
249 QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
250 vvImageReader::Pointer reader = vvImageReader::New();
251 std::vector<std::string> filenames;
252 filenames.push_back(filename[i].toStdString());
253 reader->SetInputFilenames(filenames);
254 reader->Update(IMAGE);
255 QApplication::restoreOverrideCursor();
257 if (reader->GetLastError().size() != 0) {
258 std::cerr << "Error while reading " << filename[i].toStdString() << std::endl;
259 QString error = "Cannot open file \n";
260 error += reader->GetLastError().c_str();
261 QMessageBox::information(this,tr("Reading problem"),error);
264 vvImage::Pointer binaryImage = reader->GetOutput();
265 AddImage(binaryImage, filename[i].toStdString(), mBackgroundValueSpinBox->value());
266 mOpenedBinaryImage.push_back(binaryImage);
270 //------------------------------------------------------------------------------
273 //------------------------------------------------------------------------------
274 void vvToolStructureSetManager::UpdateImage()
276 // Update the TreeWidget
277 UpdateStructureSetInTreeWidget(mCurrentStructureSetIndex, mCurrentStructureSet);
278 // Render loaded ROIs (the first is sufficient)
279 for(unsigned int i=0; i<mLoadedROIIndex.size(); i++) {
280 mCurrentStructureSetActor->GetROIActor(mLoadedROIIndex[i])->Update();
282 for(int i=0; i<mCurrentSlicerManager->GetNumberOfSlicers(); i++) {
283 mCurrentSlicerManager->GetSlicer(i)->Render();
286 //------------------------------------------------------------------------------
289 //------------------------------------------------------------------------------
290 void vvToolStructureSetManager::AddImage(vvImage * binaryImage, std::string filename,
291 double BG, bool m_modeBG)
293 // Check current structure set
295 if (mCurrentStructureSet == NULL) {
296 if (mStructureSetsList.size() == 0) { // Create a default SS
297 clitk::DicomRT_StructureSet::Pointer mStructureSet = clitk::DicomRT_StructureSet::New();
298 index = AddStructureSet(mStructureSet);
300 else { // Get first SS
304 index = mCurrentStructureSetIndex;
306 mCurrentStructureSet = mStructureSetsList[index];
307 mCurrentStructureSetActor = mStructureSetActorsList[index].data();
308 mCurrentStructureSetIndex = index;
311 int dim = mCurrentImage->GetNumberOfDimensions();
312 int bin_dim = binaryImage->GetNumberOfDimensions();
313 if (dim < bin_dim) { ////////// TO CHANGE FOR 3D/4D
314 std::ostringstream os;
315 os << "Error. Loaded binary image is " << bin_dim
316 << "D while selected image is " << dim << "D" << std::endl;
317 QMessageBox::information(this,tr("Reading problem"),os.str().c_str());
321 // Add a new roi to the structure
322 int n = mCurrentStructureSet->AddBinaryImageAsNewROI(binaryImage, filename);
323 mLoadedROIIndex.push_back(n);
325 mCurrentStructureSet->GetROI(n)->SetBackgroundValueLabelImage(BG);
327 mCurrentStructureSet->GetROI(n)->SetForegroundValueLabelImage(BG);
330 if (n<mDefaultLUTColor->GetNumberOfTableValues ()) {
331 double * color = mDefaultLUTColor->GetTableValue(n % mDefaultLUTColor->GetNumberOfTableValues ());
332 mCurrentStructureSet->GetROI(n)->SetDisplayColor(color[0], color[1], color[2]);
335 // Add a new roi actor
336 mCurrentStructureSetActor->CreateNewROIActor(n, m_modeBG);
338 // CheckBox for "All"
339 if (mCurrentStructureSetActor->GetROIActor(n)->IsVisible())
340 mNumberOfVisibleROI++;
341 if (mCurrentStructureSetActor->GetROIActor(n)->IsContourVisible())
342 mNumberOfVisibleContourROI++;
343 UpdateAllROIStatus();
345 //------------------------------------------------------------------------------
348 //------------------------------------------------------------------------------
349 void vvToolStructureSetManager::apply()
353 //------------------------------------------------------------------------------
356 //------------------------------------------------------------------------------
357 bool vvToolStructureSetManager::close()
359 return vvToolWidgetBase::close();
361 //------------------------------------------------------------------------------
364 //------------------------------------------------------------------------------
365 void vvToolStructureSetManager::closeEvent(QCloseEvent *event)
367 std::vector<vvSlicerManager*>::iterator iter = std::find(mListOfInputs.begin(), mListOfInputs.end(), mCurrentSlicerManager);
368 if (iter != mListOfInputs.end()) mListOfInputs.erase(iter);
370 // DD("how delete mListOfOpenTool ???");
371 mListOfOpenTool.erase(mCurrentSlicerManager);
373 mCheckBoxShowAll->setCheckState(Qt::Unchecked);
374 mContourCheckBoxShowAll->setCheckState(Qt::Unchecked);
375 if (mCurrentSlicerManager != 0) mCurrentSlicerManager->Render();
376 if (mCurrentStructureSetActor) {
377 for(int i=0; i<mCurrentStructureSetActor->GetNumberOfROIs(); i++) {
378 mCurrentStructureSetActor->GetROIList()[i]->SetVisible(false);
379 mCurrentStructureSetActor->GetROIList()[i]->SetContourVisible(false);
380 delete mCurrentStructureSetActor->GetROIList()[i];
385 if (m_NumberOfTool == 1) {
386 mMainWindow->GetTab()->removeTab(mTabNumber);
392 //------------------------------------------------------------------------------
395 //------------------------------------------------------------------------------
396 // CURRENT ROI INTERACTION
397 //------------------------------------------------------------------------------
400 //------------------------------------------------------------------------------
401 void vvToolStructureSetManager::SelectedItemChangedInTree() {
402 // Search which roi is selected
403 QList<QTreeWidgetItem *> l = mTree->selectedItems();
405 mCurrentROIActor = NULL;
407 mGroupBoxROI->setEnabled(false);
410 QTreeWidgetItem * w = l[0];
411 if (mMapTreeWidgetToROI.find(w) == mMapTreeWidgetToROI.end()) {
412 mCurrentROIActor = NULL;
414 mGroupBoxROI->setEnabled(false);
417 clitk::DicomRT_ROI * roi = mMapTreeWidgetToROI[w];
418 // Get selected roi actor
419 vvROIActor * actor = mStructureSetActorsList[mCurrentStructureSetIndex]->GetROIActor(roi->GetROINumber());
421 mCurrentROIActor = actor;
424 mGroupBoxROI->setEnabled(true);
425 mROInameLabel->setText(roi->GetName().c_str());
426 mCheckBoxShow->setChecked(actor->IsVisible());
427 mContourCheckBoxShow->setChecked(actor->IsContourVisible());
428 mContourWidthSpinBox->setValue(actor->GetContourWidth());
430 // Warning -> avoir unuseful Render here by disconnect slider
431 disconnect(mOpacitySlider, SIGNAL(valueChanged(int)),
432 this, SLOT(OpacityChanged(int)));
433 mOpacitySlider->setValue((int)lrint(actor->GetOpacity()*100));
434 mOpacitySpinBox->setValue((int)lrint(actor->GetOpacity()*100));
435 connect(mOpacitySlider, SIGNAL(valueChanged(int)),
436 this, SLOT(OpacityChanged(int)));
440 mCurrentSlicerManager->Render();
442 //------------------------------------------------------------------------------
445 //------------------------------------------------------------------------------
446 void vvToolStructureSetManager::UpdateAllROIStatus() {
448 int nb = mCurrentStructureSetActor->GetROIList().size();
449 for(int i=0; i<nb; i++) {
450 if (mCurrentStructureSetActor->GetROIList()[i]->IsVisible()) {
455 disconnect(mCheckBoxShowAll, SIGNAL(stateChanged(int)), this, SLOT(AllVisibleROIToggled(int)));
456 disconnect(mContourCheckBoxShowAll, SIGNAL(toggled(bool)), this, SLOT(AllVisibleContourROIToggled(bool)));
457 if (nbVisible == nb) mCheckBoxShowAll->setCheckState(Qt::Checked);
459 if (nbVisible == 0) mCheckBoxShowAll->setCheckState(Qt::Unchecked);
460 else mCheckBoxShowAll->setCheckState(Qt::PartiallyChecked);
462 connect(mContourCheckBoxShowAll, SIGNAL(toggled(bool)), this, SLOT(AllVisibleContourROIToggled(bool)));
463 connect(mCheckBoxShowAll, SIGNAL(stateChanged(int)), this, SLOT(AllVisibleROIToggled(int)));
465 //------------------------------------------------------------------------------
467 //------------------------------------------------------------------------------
468 void vvToolStructureSetManager::VisibleROIToggled(bool b) {
469 if (mCurrentROIActor == NULL) return;
470 if (b == mCurrentROIActor->IsVisible()) return; // nothing to do
471 mCurrentROIActor->SetVisible(b);
472 UpdateAllROIStatus();
473 mCurrentSlicerManager->Render();
475 //------------------------------------------------------------------------------
478 //------------------------------------------------------------------------------
479 void vvToolStructureSetManager::VisibleContourROIToggled(bool b) {
480 if (mCurrentROIActor == NULL) return;
481 if (mCurrentROIActor->IsContourVisible() == b) return; // nothing to do
482 mCurrentROIActor->SetContourVisible(b);
483 mCurrentROIActor->UpdateColor();
484 mCurrentSlicerManager->Render();
486 //------------------------------------------------------------------------------
489 //------------------------------------------------------------------------------
490 void vvToolStructureSetManager::OpacityChanged(int v) {
491 if (mCurrentROIActor == NULL) return;
492 mCurrentROIActor->SetOpacity((double)v/100.0);
493 mCurrentROIActor->UpdateColor();
494 mCurrentSlicerManager->Render();
496 //------------------------------------------------------------------------------
499 //------------------------------------------------------------------------------
500 void vvToolStructureSetManager::AllVisibleROIToggled(int b) {
502 if ((mCheckBoxShowAll->checkState() == Qt::Checked) ||
503 (mCheckBoxShowAll->checkState() == Qt::PartiallyChecked)) status = true;
505 for(int i=0; i<mCurrentStructureSetActor->GetNumberOfROIs(); i++) {
506 mCurrentStructureSetActor->GetROIList()[i]->SetVisible(status);
508 if (status) mCheckBoxShowAll->setCheckState(Qt::Checked);
509 else mCheckBoxShowAll->setCheckState(Qt::Unchecked);
510 mCheckBoxShow->setChecked(status);
511 mCurrentSlicerManager->Render();
513 //------------------------------------------------------------------------------
516 //------------------------------------------------------------------------------
517 void vvToolStructureSetManager::AllVisibleContourROIToggled(bool b) {
519 if ((mContourCheckBoxShowAll->checkState() == Qt::Checked) ||
520 (mContourCheckBoxShowAll->checkState() == Qt::PartiallyChecked)) status = true;
522 for(int i=0; i<mCurrentStructureSetActor->GetNumberOfROIs(); i++) {
523 mCurrentStructureSetActor->GetROIList()[i]->SetContourVisible(status);
525 // Update current selection
526 if (status) mContourCheckBoxShowAll->setCheckState(Qt::Checked);
527 else mContourCheckBoxShowAll->setCheckState(Qt::Unchecked);
528 mContourCheckBoxShow->setChecked(status);
529 mCurrentSlicerManager->Render();
531 //------------------------------------------------------------------------------
534 //------------------------------------------------------------------------------
535 void vvToolStructureSetManager::ChangeColor() {
537 color.setRgbF(mCurrentROIActor->GetROI()->GetDisplayColor()[0],
538 mCurrentROIActor->GetROI()->GetDisplayColor()[1],
539 mCurrentROIActor->GetROI()->GetDisplayColor()[2]);
540 QColor c = QColorDialog::getColor(color, this, "Choose the ROI color");
541 mCurrentROIActor->GetROI()->SetDisplayColor(c.redF(), c.greenF(), c.blueF());
542 mCurrentROIActor->UpdateColor();
544 QTreeWidgetItem * w = mMapROIToTreeWidget[mCurrentROI];
545 QBrush brush(QColor(mCurrentROI->GetDisplayColor()[0]*255,
546 mCurrentROI->GetDisplayColor()[1]*255,
547 mCurrentROI->GetDisplayColor()[2]*255));
548 brush.setStyle(Qt::SolidPattern);
549 w->setBackground(2, brush);
551 mCurrentSlicerManager->Render();
553 //------------------------------------------------------------------------------
556 //------------------------------------------------------------------------------
557 void vvToolStructureSetManager::ChangeContourColor() {
559 color.setRgbF(mCurrentROIActor->GetContourColor()[0],
560 mCurrentROIActor->GetContourColor()[1],
561 mCurrentROIActor->GetContourColor()[2]);
562 QColor c = QColorDialog::getColor(color, this, "Choose the contour color");
563 mCurrentROIActor->SetContourColor(c.redF(), c.greenF(), c.blueF());
564 mCurrentROIActor->UpdateColor();
565 mCurrentSlicerManager->Render();
567 //------------------------------------------------------------------------------
570 //------------------------------------------------------------------------------
571 void vvToolStructureSetManager::ChangeContourWidth(int n) {
572 mCurrentROIActor->SetContourWidth(n);
573 mCurrentROIActor->UpdateColor();
574 mCurrentSlicerManager->Render();
576 //------------------------------------------------------------------------------
579 //------------------------------------------------------------------------------
580 void vvToolStructureSetManager::ReloadCurrentROI() {
582 vvImageReader::Pointer reader = vvImageReader::New();
583 reader->SetInputFilename(mCurrentROI->GetFilename());
584 reader->Update(IMAGE);
585 if (reader->GetLastError() != "") {
586 QMessageBox::information(mMainWindowBase, tr("Sorry, error. Could not reload"), reader->GetLastError().c_str());
589 mCurrentROI->GetImage()->GetFirstVTKImageData()->ReleaseData();
590 mCurrentROI->SetImage(reader->GetOutput());
593 mCurrentROIActor->UpdateImage();
594 mCurrentSlicerManager->Render();
596 //------------------------------------------------------------------------------
599 //------------------------------------------------------------------------------
600 void vvToolStructureSetManager::CheckInputList(std::vector<vvSlicerManager*> & l, int & index)
602 for(unsigned int i=0; i<l.size(); i++) {
603 std::vector<vvSlicerManager*>::iterator iter = std::find(mListOfInputs.begin(), mListOfInputs.end(), l[i]);
604 if (iter != mListOfInputs.end()) {
605 for(unsigned int j=i;j<l.size(); j++) l[j] = l[j+1];
607 if (index == (int)i) index = 0;
612 //------------------------------------------------------------------------------
615 //------------------------------------------------------------------------------
617 vvToolStructureSetManager * vvToolStructureSetManager::AddImage(vvSlicerManager * m, std::string name, vvImage::Pointer image, double BG, bool m_modeBG)
619 // If the tool is open for this vvSlicerManager, use it and return
620 if (mListOfOpenTool[m]) {
621 vvToolStructureSetManager * tool = mListOfOpenTool[m];
622 tool->AddImage(image, name, BG, m_modeBG);
627 // If the tool is not open, create it
628 vvToolStructureSetManager * tool = new vvToolStructureSetManager
629 (CREATOR(vvToolStructureSetManager)->GetMainWindow(), Qt::Dialog, m);
630 tool->AddImage(image, name, BG, m_modeBG);
635 //------------------------------------------------------------------------------