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://www.centreleonberard.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>
30 #include <QAbstractEventDispatcher>
33 #include <vtkLookupTable.h>
34 #include <vtkRenderWindow.h>
36 //------------------------------------------------------------------------------
37 // Create the tool and automagically (I like this word) insert it in
38 // the main window menu.
39 ADD_TOOL(vvToolStructureSetManager);
40 //------------------------------------------------------------------------------
42 int vvToolStructureSetManager::m_NumberOfTool = 0;
43 std::vector<vvSlicerManager*> vvToolStructureSetManager::mListOfInputs;
44 std::map<vvSlicerManager*, vvToolStructureSetManager*> vvToolStructureSetManager::mListOfOpenTool;
46 //------------------------------------------------------------------------------
47 vvToolStructureSetManager::vvToolStructureSetManager(vvMainWindowBase * parent,
49 vvSlicerManager * current):
50 vvToolWidgetBase(parent, f),
51 // if Qt::Widget -> No dialog in this case (in tab) ; PB = "invisible widget on menu" !
52 // if "f" normal widget
53 vvToolBase<vvToolStructureSetManager>(parent),
54 Ui::vvToolStructureSetManager()
56 Ui_vvToolStructureSetManager::setupUi(mToolWidget);
58 // this->setFixedWidth(120);
60 mCurrentStructureSetActor = 0;
61 connect(mCloseButton, SIGNAL(clicked()), this, SLOT(close()));
62 mCloseButton->setVisible(false);
64 mTree->header()->resizeSection(0, 30);
65 mMainWindowBase->GetTab()->setTabIcon(mTabNumber, GetToolIcon());
66 mCurrentStructureSet = NULL;
67 mCurrentStructureSetIndex = -1;
68 mGroupBoxROI->setEnabled(false);
69 mCurrentROIActor = NULL;
70 mIsAllVisibleEnabled = false;
71 mNumberOfVisibleROI = 0;
72 mNumberOfVisibleContourROI = 0;
73 mDefaultLUTColor = vtkSmartPointer<vtkLookupTable>::New();
74 for(int i=0; i<mDefaultLUTColor->GetNumberOfTableValues(); i++) {
75 double r = (rand()/(RAND_MAX+1.0));
76 double v = (rand()/(RAND_MAX+1.0));
77 double b = (rand()/(RAND_MAX+1.0));
78 mDefaultLUTColor->SetTableValue(i, r, v, b);
79 // std::cout << "mDefaultLUTColor->SetTableValue(" << i << ", " << r << ", " << v << ", " << b << ");" << std::endl;
81 #include "vvDefaultLut.h"
84 if (current == NULL) {
85 MustOpenDialogWhenCreated = true;
86 AddInputSelector("Select image");
89 MustOpenDialogWhenCreated = false;
90 mMainButtonBox->setEnabled(true);
91 mCurrentSlicerManager = current;
92 mCurrentImage = mCurrentSlicerManager->GetImage();
93 mToolWidget->setEnabled(true);
94 InputIsSelected(mCurrentSlicerManager);
97 //------------------------------------------------------------------------------
100 //------------------------------------------------------------------------------
101 vvToolStructureSetManager::~vvToolStructureSetManager()
105 // clearing the list at this point avoids
106 // segfaulting due to events being dispatched
107 // after object destruction
108 mTreeWidgetList.clear();
109 mTree->clearSelection();
111 //std::cout << "vvToolStructureSetManager::~vvToolStructureSetManager()" << std::endl;
113 //------------------------------------------------------------------------------
116 //------------------------------------------------------------------------------
118 void vvToolStructureSetManager::Initialize() {
119 SetToolName("ROIManager");
120 SetToolMenuName("Display ROI (binary image)");
121 SetToolIconFilename(":/common/icons/tool-roi.png");
122 SetToolTip("Display ROI from a binary image.");
123 SetToolExperimental(false);
125 //------------------------------------------------------------------------------
128 //------------------------------------------------------------------------------
129 void vvToolStructureSetManager::InputIsSelected(vvSlicerManager *m)
131 //std::cout << "vvToolStructureSetManager::InputIsSelected()" << std::endl;
133 //int mTabNumber = parent->GetTab()->addTab(this, "");
134 // this->setFixedWidth(120);
135 //this->setPreferedHeight(441);
137 if (mCurrentImage->GetNumberOfDimensions() != 3) {
138 QMessageBox::information(this,tr("Sorry only 3D yet"), tr("Sorry only 3D yet"));
143 HideInputSelector(); // splitter
144 mToolInputSelectionWidget->hide();
145 mLabelInputInfo->setText(QString("%1").arg(m->GetFileName().c_str()));
148 // if (!isWindow()) {
149 mListOfInputs.push_back(mCurrentSlicerManager);
150 mListOfOpenTool[mCurrentSlicerManager] = this;
153 // Connect open menus
154 connect(mOpenBinaryButton, SIGNAL(clicked()), this, SLOT(OpenBinaryImage()));
155 connect(mTree, SIGNAL(itemSelectionChanged()), this, SLOT(SelectedItemChangedInTree()));
156 connect(mCheckBoxShow, SIGNAL(toggled(bool)), this, SLOT(VisibleROIToggled(bool)));
157 connect(mOpacitySlider, SIGNAL(valueChanged(int)), this, SLOT(OpacityChanged(int)));
158 connect(mChangeColorButton, SIGNAL(clicked()), this, SLOT(ChangeColor()));
159 connect(mContourCheckBoxShow, SIGNAL(toggled(bool)), this, SLOT(VisibleContourROIToggled(bool)));
160 connect(mChangeContourColorButton, SIGNAL(clicked()), this, SLOT(ChangeContourColor()));
161 connect(mContourWidthSpinBox, SIGNAL(valueChanged(int)), this, SLOT(ChangeContourWidth(int)));
162 connect(mReloadButton, SIGNAL(clicked()), this, SLOT(ReloadCurrentROI()));
163 connect(mCheckBoxShowAll, SIGNAL(stateChanged(int)), this, SLOT(AllVisibleROIToggled(int)));
164 connect(mContourCheckBoxShowAll, SIGNAL(toggled(bool)), this, SLOT(AllVisibleContourROIToggled(bool)));
166 // Browse to load image
167 if (MustOpenDialogWhenCreated)
170 //------------------------------------------------------------------------------
173 //------------------------------------------------------------------------------
174 void vvToolStructureSetManager::Open(int type) {
176 case 0: OpenBinaryImage(); return; // Open binary image;
177 case 1: DD("TODO"); return; // Open DICOM RT
178 case 2: DD("TODO"); return; // Open mesh
179 default: std::cerr << "Error ????" << std::endl; exit(0);
182 //------------------------------------------------------------------------------
185 //------------------------------------------------------------------------------
186 void vvToolStructureSetManager::AddRoiInTreeWidget(clitk::DicomRT_ROI * roi, QTreeWidget * ww) {
187 mTreeWidgetList.push_back(QSharedPointer<QTreeWidgetItem>(new QTreeWidgetItem(ww)));
188 QTreeWidgetItem * w = mTreeWidgetList.back().data();
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::Pointer> & 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 QSharedPointer<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::Pointer mStructureSet = clitk::DicomRT_StructureSet::New();
239 index = AddStructureSet(mStructureSet);
241 else { // Get first SS
245 index = mCurrentStructureSetIndex;
247 mCurrentStructureSet = mStructureSetsList[index];
248 mCurrentStructureSetActor = mStructureSetActorsList[index].data();
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::Pointer reader = vvImageReader::New();
262 std::vector<std::string> filenames;
263 filenames.push_back(filename[i].toStdString());
264 reader->SetInputFilenames(filenames);
265 reader->Update(vvImageReader::IMAGE);
266 QApplication::restoreOverrideCursor();
268 if (reader->GetLastError().size() != 0) {
269 std::cerr << "Error while reading " << filename[i].toStdString() << std::endl;
270 QString error = "Cannot open file \n";
271 error += reader->GetLastError().c_str();
272 QMessageBox::information(this,tr("Reading problem"),error);
275 vvImage::Pointer binaryImage = reader->GetOutput();
276 AddImage(binaryImage, filename[i].toStdString(), mBackgroundValueSpinBox->value());
277 mOpenedBinaryImage.push_back(binaryImage);
282 //------------------------------------------------------------------------------
285 //------------------------------------------------------------------------------
286 void vvToolStructureSetManager::UpdateImage()
288 // Update the TreeWidget
289 UpdateStructureSetInTreeWidget(mCurrentStructureSetIndex, mCurrentStructureSet);
290 // Render loaded ROIs (the first is sufficient)
291 for(unsigned int i=0; i<mLoadedROIIndex.size(); i++) {
292 mCurrentStructureSetActor->GetROIActor(mLoadedROIIndex[i])->Update();
294 for(int i=0; i<mCurrentSlicerManager->GetNumberOfSlicers(); i++) {
295 mCurrentSlicerManager->GetSlicer(i)->Render();
298 //------------------------------------------------------------------------------
301 //------------------------------------------------------------------------------
302 void vvToolStructureSetManager::AddImage(vvImage * binaryImage, std::string filename,
303 double BG, bool m_modeBG)
305 // Check current structure set
307 if (mCurrentStructureSet == NULL) {
308 if (mStructureSetsList.size() == 0) { // Create a default SS
309 clitk::DicomRT_StructureSet::Pointer mStructureSet = clitk::DicomRT_StructureSet::New();
310 index = AddStructureSet(mStructureSet);
312 else { // Get first SS
316 index = mCurrentStructureSetIndex;
318 mCurrentStructureSet = mStructureSetsList[index];
319 mCurrentStructureSetActor = mStructureSetActorsList[index].data();
320 mCurrentStructureSetIndex = index;
323 int dim = mCurrentImage->GetNumberOfDimensions();
324 int bin_dim = binaryImage->GetNumberOfDimensions();
325 if (dim < bin_dim) { ////////// TO CHANGE FOR 3D/4D
326 std::ostringstream os;
327 os << "Error. Loaded binary image is " << bin_dim
328 << "D while selected image is " << dim << "D" << std::endl;
329 QMessageBox::information(this,tr("Reading problem"),os.str().c_str());
333 // Add a new roi to the structure
334 int n = mCurrentStructureSet->AddBinaryImageAsNewROI(binaryImage, filename);
335 mLoadedROIIndex.push_back(n);
337 mCurrentStructureSet->GetROI(n)->SetBackgroundValueLabelImage(BG);
339 mCurrentStructureSet->GetROI(n)->SetForegroundValueLabelImage(BG);
342 if (n<mDefaultLUTColor->GetNumberOfTableValues ()) {
343 double * color = mDefaultLUTColor->GetTableValue(n % mDefaultLUTColor->GetNumberOfTableValues ());
344 mCurrentStructureSet->GetROI(n)->SetDisplayColor(color[0], color[1], color[2]);
347 // Add a new roi actor
348 mCurrentStructureSetActor->CreateNewROIActor(n, m_modeBG);
350 // CheckBox for "All"
351 if (mCurrentStructureSetActor->GetROIActor(n)->IsVisible())
352 mNumberOfVisibleROI++;
353 if (mCurrentStructureSetActor->GetROIActor(n)->IsContourVisible())
354 mNumberOfVisibleContourROI++;
355 UpdateAllROIStatus();
357 //------------------------------------------------------------------------------
360 //------------------------------------------------------------------------------
361 void vvToolStructureSetManager::apply()
365 //------------------------------------------------------------------------------
368 //------------------------------------------------------------------------------
369 bool vvToolStructureSetManager::close()
371 //std::cout << "vvToolStructureSetManager::close()" << std::endl;
373 return vvToolWidgetBase::close();
375 //------------------------------------------------------------------------------
378 //------------------------------------------------------------------------------
379 void vvToolStructureSetManager::closeEvent(QCloseEvent *event)
381 //std::cout << "vvToolStructureSetManager::closeEvent()" << std::endl;
383 std::vector<vvSlicerManager*>::iterator iter = std::find(mListOfInputs.begin(), mListOfInputs.end(), mCurrentSlicerManager);
384 if (iter != mListOfInputs.end()) mListOfInputs.erase(iter);
386 // DD("how delete mListOfOpenTool ???");
387 mListOfOpenTool.erase(mCurrentSlicerManager);
389 mCheckBoxShowAll->setCheckState(Qt::Unchecked);
390 mContourCheckBoxShowAll->setCheckState(Qt::Unchecked);
391 if (mCurrentSlicerManager != 0)
392 mCurrentSlicerManager->Render();
395 if (m_NumberOfTool == 1) {
396 mMainWindow->GetTab()->removeTab(mTabNumber);
402 //------------------------------------------------------------------------------
405 //------------------------------------------------------------------------------
406 // CURRENT ROI INTERACTION
407 //------------------------------------------------------------------------------
410 //------------------------------------------------------------------------------
411 void vvToolStructureSetManager::SelectedItemChangedInTree() {
413 // Search which roi is selected
414 QList<QTreeWidgetItem *> l = mTree->selectedItems();
416 mCurrentROIActor = NULL;
418 mGroupBoxROI->setEnabled(false);
421 QTreeWidgetItem * w = l[0];
422 //std::cout << "selected item -> " << w->text(1).toStdString() << std::endl;
423 //std::cout << "m_NumberOfTool -> " << m_NumberOfTool << std::endl;
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::Pointer reader = vvImageReader::New();
596 reader->SetInputFilename(mCurrentROI->GetFilename());
597 reader->Update(vvImageReader::IMAGE);
598 if (reader->GetLastError() != "") {
599 QMessageBox::information(mMainWindowBase, tr("Sorry, error. Could not reload"), reader->GetLastError().c_str());
602 mCurrentROI->GetImage()->GetFirstVTKImageData()->ReleaseData();
603 mCurrentROI->SetImage(reader->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 //------------------------------------------------------------------------------