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 //------------------------------------------------------------------------------
107 //------------------------------------------------------------------------------
109 void vvToolStructureSetManager::Initialize() {
110 SetToolName("ROIManager");
111 SetToolMenuName("Display ROI (binary image)");
112 SetToolIconFilename(":/common/icons/tool-roi.png");
113 SetToolTip("Display ROI from a binary image.");
114 SetToolExperimental(false);
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 mTreeWidgetList.push_back(QSharedPointer<QTreeWidgetItem>(new QTreeWidgetItem(ww)));
176 QTreeWidgetItem * w = mTreeWidgetList.back().data();
177 w->setText(0, QString("%1").arg(roi->GetROINumber()));
178 w->setText(1, QString("%1").arg(roi->GetName().c_str()));
179 QBrush brush(QColor(roi->GetDisplayColor()[0]*255, roi->GetDisplayColor()[1]*255, roi->GetDisplayColor()[2]*255));
180 brush.setStyle(Qt::SolidPattern);
181 w->setBackground(2, brush);
182 mMapROIToTreeWidget[roi] = w;
183 mMapTreeWidgetToROI[w] = roi;
184 mTree->resizeColumnToContents(0);
185 mTree->resizeColumnToContents(1);
187 //------------------------------------------------------------------------------
190 //------------------------------------------------------------------------------
191 void vvToolStructureSetManager::UpdateStructureSetInTreeWidget(int index, clitk::DicomRT_StructureSet * s) {
193 const std::vector<clitk::DicomRT_ROI::Pointer> & rois = s->GetListOfROI();
194 for(unsigned int i=0; i<rois.size(); i++) {
195 if (mMapROIToTreeWidget.find(rois[i]) == mMapROIToTreeWidget.end())
196 AddRoiInTreeWidget(rois[i], mTree); // replace mTree with ss if several SS
199 //------------------------------------------------------------------------------
202 //------------------------------------------------------------------------------
203 int vvToolStructureSetManager::AddStructureSet(clitk::DicomRT_StructureSet * mStructureSet) {
204 // Create actor for this SS
206 QSharedPointer<vvStructureSetActor> mStructureSetActor(new vvStructureSetActor);
208 mStructureSetActor->SetStructureSet(mStructureSet);
209 mStructureSetActor->SetSlicerManager(mCurrentSlicerManager);
210 // Insert in lists and get index
211 mStructureSetsList.push_back(mStructureSet);
212 mStructureSetActorsList.push_back(mStructureSetActor);
213 int index = mStructureSetsList.size()-1;
217 //------------------------------------------------------------------------------
220 //------------------------------------------------------------------------------
221 void vvToolStructureSetManager::OpenBinaryImage()
224 if (mCurrentStructureSet == NULL) {
225 if (mStructureSetsList.size() == 0) { // Create a default SS
226 clitk::DicomRT_StructureSet::Pointer mStructureSet = clitk::DicomRT_StructureSet::New();
227 index = AddStructureSet(mStructureSet);
229 else { // Get first SS
233 index = mCurrentStructureSetIndex;
235 mCurrentStructureSet = mStructureSetsList[index];
236 mCurrentStructureSetActor = mStructureSetActorsList[index].data();
237 mCurrentStructureSetIndex = index;
239 QString Extensions = "Images files ( *.mhd *.hdr *.his)";
240 Extensions += ";;All Files (*)";
241 QStringList filename =
242 QFileDialog::getOpenFileNames(this,tr("Open binary image"),
243 mMainWindowBase->GetInputPathName(),Extensions);
244 if (filename.size() == 0) return;
245 mLoadedROIIndex.clear();
246 for(int i=0; i<filename.size(); i++) {
248 QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
249 vvImageReader::Pointer reader = vvImageReader::New();
250 std::vector<std::string> filenames;
251 filenames.push_back(filename[i].toStdString());
252 reader->SetInputFilenames(filenames);
253 reader->Update(IMAGE);
254 QApplication::restoreOverrideCursor();
256 if (reader->GetLastError().size() != 0) {
257 std::cerr << "Error while reading " << filename[i].toStdString() << std::endl;
258 QString error = "Cannot open file \n";
259 error += reader->GetLastError().c_str();
260 QMessageBox::information(this,tr("Reading problem"),error);
263 vvImage::Pointer binaryImage = reader->GetOutput();
264 //AddImage(binaryImage, filename[i].toStdString(), mBackgroundValueSpinBox->value());
265 mOpenedBinaryImage.push_back(binaryImage);
267 DD(mOpenedBinaryImage.back()->GetOrigin()[0]);
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)
376 mCurrentSlicerManager->Render();
379 if (m_NumberOfTool == 1) {
380 mMainWindow->GetTab()->removeTab(mTabNumber);
386 //------------------------------------------------------------------------------
389 //------------------------------------------------------------------------------
390 // CURRENT ROI INTERACTION
391 //------------------------------------------------------------------------------
394 //------------------------------------------------------------------------------
395 void vvToolStructureSetManager::SelectedItemChangedInTree() {
396 // Search which roi is selected
397 QList<QTreeWidgetItem *> l = mTree->selectedItems();
399 mCurrentROIActor = NULL;
401 mGroupBoxROI->setEnabled(false);
404 QTreeWidgetItem * w = l[0];
405 if (mMapTreeWidgetToROI.find(w) == mMapTreeWidgetToROI.end()) {
406 mCurrentROIActor = NULL;
408 mGroupBoxROI->setEnabled(false);
411 clitk::DicomRT_ROI * roi = mMapTreeWidgetToROI[w];
412 // Get selected roi actor
413 vvROIActor * actor = mStructureSetActorsList[mCurrentStructureSetIndex]->GetROIActor(roi->GetROINumber());
415 mCurrentROIActor = actor;
418 mGroupBoxROI->setEnabled(true);
419 mROInameLabel->setText(roi->GetName().c_str());
420 mCheckBoxShow->setChecked(actor->IsVisible());
421 mContourCheckBoxShow->setChecked(actor->IsContourVisible());
422 mContourWidthSpinBox->setValue(actor->GetContourWidth());
424 // Warning -> avoir unuseful Render here by disconnect slider
425 disconnect(mOpacitySlider, SIGNAL(valueChanged(int)),
426 this, SLOT(OpacityChanged(int)));
427 mOpacitySlider->setValue((int)lrint(actor->GetOpacity()*100));
428 mOpacitySpinBox->setValue((int)lrint(actor->GetOpacity()*100));
429 connect(mOpacitySlider, SIGNAL(valueChanged(int)),
430 this, SLOT(OpacityChanged(int)));
434 mCurrentSlicerManager->Render();
436 //------------------------------------------------------------------------------
439 //------------------------------------------------------------------------------
440 void vvToolStructureSetManager::UpdateAllROIStatus() {
442 int nb = mCurrentStructureSetActor->GetROIList().size();
443 for(int i=0; i<nb; i++) {
444 if (mCurrentStructureSetActor->GetROIList()[i]->IsVisible()) {
449 disconnect(mCheckBoxShowAll, SIGNAL(stateChanged(int)), this, SLOT(AllVisibleROIToggled(int)));
450 disconnect(mContourCheckBoxShowAll, SIGNAL(toggled(bool)), this, SLOT(AllVisibleContourROIToggled(bool)));
451 if (nbVisible == nb) mCheckBoxShowAll->setCheckState(Qt::Checked);
453 if (nbVisible == 0) mCheckBoxShowAll->setCheckState(Qt::Unchecked);
454 else mCheckBoxShowAll->setCheckState(Qt::PartiallyChecked);
456 connect(mContourCheckBoxShowAll, SIGNAL(toggled(bool)), this, SLOT(AllVisibleContourROIToggled(bool)));
457 connect(mCheckBoxShowAll, SIGNAL(stateChanged(int)), this, SLOT(AllVisibleROIToggled(int)));
459 //------------------------------------------------------------------------------
461 //------------------------------------------------------------------------------
462 void vvToolStructureSetManager::VisibleROIToggled(bool b) {
463 if (mCurrentROIActor == NULL) return;
464 if (b == mCurrentROIActor->IsVisible()) return; // nothing to do
465 mCurrentROIActor->SetVisible(b);
466 UpdateAllROIStatus();
467 mCurrentSlicerManager->Render();
469 //------------------------------------------------------------------------------
472 //------------------------------------------------------------------------------
473 void vvToolStructureSetManager::VisibleContourROIToggled(bool b) {
474 if (mCurrentROIActor == NULL) return;
475 if (mCurrentROIActor->IsContourVisible() == b) return; // nothing to do
476 mCurrentROIActor->SetContourVisible(b);
477 mCurrentROIActor->UpdateColor();
478 mCurrentSlicerManager->Render();
480 //------------------------------------------------------------------------------
483 //------------------------------------------------------------------------------
484 void vvToolStructureSetManager::OpacityChanged(int v) {
485 if (mCurrentROIActor == NULL) return;
486 mCurrentROIActor->SetOpacity((double)v/100.0);
487 mCurrentROIActor->UpdateColor();
488 mCurrentSlicerManager->Render();
490 //------------------------------------------------------------------------------
493 //------------------------------------------------------------------------------
494 void vvToolStructureSetManager::AllVisibleROIToggled(int b) {
496 if ((mCheckBoxShowAll->checkState() == Qt::Checked) ||
497 (mCheckBoxShowAll->checkState() == Qt::PartiallyChecked)) status = true;
499 for(int i=0; i<mCurrentStructureSetActor->GetNumberOfROIs(); i++) {
500 mCurrentStructureSetActor->GetROIList()[i]->SetVisible(status);
502 if (status) mCheckBoxShowAll->setCheckState(Qt::Checked);
503 else mCheckBoxShowAll->setCheckState(Qt::Unchecked);
504 mCheckBoxShow->setChecked(status);
505 mCurrentSlicerManager->Render();
507 //------------------------------------------------------------------------------
510 //------------------------------------------------------------------------------
511 void vvToolStructureSetManager::AllVisibleContourROIToggled(bool b) {
513 if ((mContourCheckBoxShowAll->checkState() == Qt::Checked) ||
514 (mContourCheckBoxShowAll->checkState() == Qt::PartiallyChecked)) status = true;
516 for(int i=0; i<mCurrentStructureSetActor->GetNumberOfROIs(); i++) {
517 mCurrentStructureSetActor->GetROIList()[i]->SetContourVisible(status);
519 // Update current selection
520 if (status) mContourCheckBoxShowAll->setCheckState(Qt::Checked);
521 else mContourCheckBoxShowAll->setCheckState(Qt::Unchecked);
522 mContourCheckBoxShow->setChecked(status);
523 mCurrentSlicerManager->Render();
525 //------------------------------------------------------------------------------
528 //------------------------------------------------------------------------------
529 void vvToolStructureSetManager::ChangeColor() {
531 color.setRgbF(mCurrentROIActor->GetROI()->GetDisplayColor()[0],
532 mCurrentROIActor->GetROI()->GetDisplayColor()[1],
533 mCurrentROIActor->GetROI()->GetDisplayColor()[2]);
534 QColor c = QColorDialog::getColor(color, this, "Choose the ROI color");
535 mCurrentROIActor->GetROI()->SetDisplayColor(c.redF(), c.greenF(), c.blueF());
536 mCurrentROIActor->UpdateColor();
538 QTreeWidgetItem * w = mMapROIToTreeWidget[mCurrentROI];
539 QBrush brush(QColor(mCurrentROI->GetDisplayColor()[0]*255,
540 mCurrentROI->GetDisplayColor()[1]*255,
541 mCurrentROI->GetDisplayColor()[2]*255));
542 brush.setStyle(Qt::SolidPattern);
543 w->setBackground(2, brush);
545 mCurrentSlicerManager->Render();
547 //------------------------------------------------------------------------------
550 //------------------------------------------------------------------------------
551 void vvToolStructureSetManager::ChangeContourColor() {
553 color.setRgbF(mCurrentROIActor->GetContourColor()[0],
554 mCurrentROIActor->GetContourColor()[1],
555 mCurrentROIActor->GetContourColor()[2]);
556 QColor c = QColorDialog::getColor(color, this, "Choose the contour color");
557 mCurrentROIActor->SetContourColor(c.redF(), c.greenF(), c.blueF());
558 mCurrentROIActor->UpdateColor();
559 mCurrentSlicerManager->Render();
561 //------------------------------------------------------------------------------
564 //------------------------------------------------------------------------------
565 void vvToolStructureSetManager::ChangeContourWidth(int n) {
566 mCurrentROIActor->SetContourWidth(n);
567 mCurrentROIActor->UpdateColor();
568 mCurrentSlicerManager->Render();
570 //------------------------------------------------------------------------------
573 //------------------------------------------------------------------------------
574 void vvToolStructureSetManager::ReloadCurrentROI() {
576 vvImageReader::Pointer reader = vvImageReader::New();
577 reader->SetInputFilename(mCurrentROI->GetFilename());
578 reader->Update(IMAGE);
579 if (reader->GetLastError() != "") {
580 QMessageBox::information(mMainWindowBase, tr("Sorry, error. Could not reload"), reader->GetLastError().c_str());
583 mCurrentROI->GetImage()->GetFirstVTKImageData()->ReleaseData();
584 mCurrentROI->SetImage(reader->GetOutput());
587 mCurrentROIActor->UpdateImage();
588 mCurrentSlicerManager->Render();
590 //------------------------------------------------------------------------------
593 //------------------------------------------------------------------------------
594 void vvToolStructureSetManager::CheckInputList(std::vector<vvSlicerManager*> & l, int & index)
596 for(unsigned int i=0; i<l.size(); i++) {
597 std::vector<vvSlicerManager*>::iterator iter = std::find(mListOfInputs.begin(), mListOfInputs.end(), l[i]);
598 if (iter != mListOfInputs.end()) {
599 for(unsigned int j=i;j<l.size(); j++) l[j] = l[j+1];
601 if (index == (int)i) index = 0;
606 //------------------------------------------------------------------------------
609 //------------------------------------------------------------------------------
611 vvToolStructureSetManager * vvToolStructureSetManager::AddImage(vvSlicerManager * m, std::string name, vvImage::Pointer image, double BG, bool m_modeBG)
613 // If the tool is open for this vvSlicerManager, use it and return
614 if (mListOfOpenTool[m]) {
615 vvToolStructureSetManager * tool = mListOfOpenTool[m];
616 tool->AddImage(image, name, BG, m_modeBG);
621 // If the tool is not open, create it
622 vvToolStructureSetManager * tool = new vvToolStructureSetManager
623 (CREATOR(vvToolStructureSetManager)->GetMainWindow(), Qt::Dialog, m);
624 tool->AddImage(image, name, BG, m_modeBG);
629 //------------------------------------------------------------------------------