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"));
142 HideInputSelector(); // splitter
143 mToolInputSelectionWidget->hide();
144 mLabelInputInfo->setText(QString("%1").arg(m->GetFileName().c_str()));
147 // if (!isWindow()) {
148 mListOfInputs.push_back(mCurrentSlicerManager);
149 mListOfOpenTool[mCurrentSlicerManager] = this;
152 // Connect open menus
153 connect(mOpenBinaryButton, SIGNAL(clicked()), this, SLOT(OpenBinaryImage()));
154 connect(mTree, SIGNAL(itemSelectionChanged()), this, SLOT(SelectedItemChangedInTree()));
155 connect(mCheckBoxShow, SIGNAL(toggled(bool)), this, SLOT(VisibleROIToggled(bool)));
156 connect(mOpacitySlider, SIGNAL(valueChanged(int)), this, SLOT(OpacityChanged(int)));
157 connect(mChangeColorButton, SIGNAL(clicked()), this, SLOT(ChangeColor()));
158 connect(mContourCheckBoxShow, SIGNAL(toggled(bool)), this, SLOT(VisibleContourROIToggled(bool)));
159 connect(mChangeContourColorButton, SIGNAL(clicked()), this, SLOT(ChangeContourColor()));
160 connect(mContourWidthSpinBox, SIGNAL(valueChanged(int)), this, SLOT(ChangeContourWidth(int)));
161 connect(mReloadButton, SIGNAL(clicked()), this, SLOT(ReloadCurrentROI()));
162 connect(mCheckBoxShowAll, SIGNAL(stateChanged(int)), this, SLOT(AllVisibleROIToggled(int)));
163 connect(mContourCheckBoxShowAll, SIGNAL(toggled(bool)), this, SLOT(AllVisibleContourROIToggled(bool)));
165 // Browse to load image
166 if (MustOpenDialogWhenCreated)
169 //------------------------------------------------------------------------------
172 //------------------------------------------------------------------------------
173 void vvToolStructureSetManager::Open(int type) {
175 case 0: OpenBinaryImage(); return; // Open binary image;
176 case 1: DD("TODO"); return; // Open DICOM RT
177 case 2: DD("TODO"); return; // Open mesh
178 default: std::cerr << "Error ????" << std::endl; exit(0);
181 //------------------------------------------------------------------------------
184 //------------------------------------------------------------------------------
185 void vvToolStructureSetManager::AddRoiInTreeWidget(clitk::DicomRT_ROI * roi, QTreeWidget * ww) {
186 mTreeWidgetList.push_back(QSharedPointer<QTreeWidgetItem>(new QTreeWidgetItem(ww)));
187 QTreeWidgetItem * w = mTreeWidgetList.back().data();
188 w->setText(0, QString("%1").arg(roi->GetROINumber()));
189 w->setText(1, QString("%1").arg(roi->GetName().c_str()));
190 QBrush brush(QColor(roi->GetDisplayColor()[0]*255, roi->GetDisplayColor()[1]*255, roi->GetDisplayColor()[2]*255));
191 brush.setStyle(Qt::SolidPattern);
192 w->setBackground(2, brush);
193 mMapROIToTreeWidget[roi] = w;
194 mMapTreeWidgetToROI[w] = roi;
195 mTree->resizeColumnToContents(0);
196 mTree->resizeColumnToContents(1);
198 //------------------------------------------------------------------------------
201 //------------------------------------------------------------------------------
202 void vvToolStructureSetManager::UpdateStructureSetInTreeWidget(int index, clitk::DicomRT_StructureSet * s) {
204 const std::vector<clitk::DicomRT_ROI::Pointer> & rois = s->GetListOfROI();
205 for(unsigned int i=0; i<rois.size(); i++) {
206 if (mMapROIToTreeWidget.find(rois[i]) == mMapROIToTreeWidget.end())
207 AddRoiInTreeWidget(rois[i], mTree); // replace mTree with ss if several SS
210 //------------------------------------------------------------------------------
213 //------------------------------------------------------------------------------
214 int vvToolStructureSetManager::AddStructureSet(clitk::DicomRT_StructureSet * mStructureSet) {
215 // Create actor for this SS
217 QSharedPointer<vvStructureSetActor> mStructureSetActor(new vvStructureSetActor);
219 mStructureSetActor->SetStructureSet(mStructureSet);
220 mStructureSetActor->SetSlicerManager(mCurrentSlicerManager);
221 // Insert in lists and get index
222 mStructureSetsList.push_back(mStructureSet);
223 mStructureSetActorsList.push_back(mStructureSetActor);
224 int index = mStructureSetsList.size()-1;
228 //------------------------------------------------------------------------------
231 //------------------------------------------------------------------------------
232 void vvToolStructureSetManager::OpenBinaryImage()
235 if (mCurrentStructureSet == NULL) {
236 if (mStructureSetsList.size() == 0) { // Create a default SS
237 clitk::DicomRT_StructureSet::Pointer mStructureSet = clitk::DicomRT_StructureSet::New();
238 index = AddStructureSet(mStructureSet);
240 else { // Get first SS
244 index = mCurrentStructureSetIndex;
246 mCurrentStructureSet = mStructureSetsList[index];
247 mCurrentStructureSetActor = mStructureSetActorsList[index].data();
248 mCurrentStructureSetIndex = index;
250 QString Extensions = "Images files ( *.mhd *.hdr *.his)";
251 Extensions += ";;All Files (*)";
252 QStringList filename =
253 QFileDialog::getOpenFileNames(this,tr("Open binary image"),
254 mMainWindowBase->GetInputPathName(),Extensions);
255 if (filename.size() == 0) return;
256 mLoadedROIIndex.clear();
257 for(int i=0; i<filename.size(); i++) {
259 QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
260 vvImageReader::Pointer reader = vvImageReader::New();
261 std::vector<std::string> filenames;
262 filenames.push_back(filename[i].toStdString());
263 reader->SetInputFilenames(filenames);
264 reader->Update(vvImageReader::IMAGE);
265 QApplication::restoreOverrideCursor();
267 if (reader->GetLastError().size() != 0) {
268 std::cerr << "Error while reading " << filename[i].toStdString() << std::endl;
269 QString error = "Cannot open file \n";
270 error += reader->GetLastError().c_str();
271 QMessageBox::information(this,tr("Reading problem"),error);
274 vvImage::Pointer binaryImage = reader->GetOutput();
275 AddImage(binaryImage, filename[i].toStdString(), mBackgroundValueSpinBox->value());
276 mOpenedBinaryImage.push_back(binaryImage);
281 //------------------------------------------------------------------------------
284 //------------------------------------------------------------------------------
285 void vvToolStructureSetManager::UpdateImage()
287 // Update the TreeWidget
288 UpdateStructureSetInTreeWidget(mCurrentStructureSetIndex, mCurrentStructureSet);
289 // Render loaded ROIs (the first is sufficient)
290 for(unsigned int i=0; i<mLoadedROIIndex.size(); i++) {
291 mCurrentStructureSetActor->GetROIActor(mLoadedROIIndex[i])->Update();
293 for(int i=0; i<mCurrentSlicerManager->GetNumberOfSlicers(); i++) {
294 mCurrentSlicerManager->GetSlicer(i)->Render();
297 //------------------------------------------------------------------------------
300 //------------------------------------------------------------------------------
301 void vvToolStructureSetManager::AddImage(vvImage * binaryImage, std::string filename,
302 double BG, bool m_modeBG)
304 // Check current structure set
306 if (mCurrentStructureSet == NULL) {
307 if (mStructureSetsList.size() == 0) { // Create a default SS
308 clitk::DicomRT_StructureSet::Pointer mStructureSet = clitk::DicomRT_StructureSet::New();
309 index = AddStructureSet(mStructureSet);
311 else { // Get first SS
315 index = mCurrentStructureSetIndex;
317 mCurrentStructureSet = mStructureSetsList[index];
318 mCurrentStructureSetActor = mStructureSetActorsList[index].data();
319 mCurrentStructureSetIndex = index;
322 int dim = mCurrentImage->GetNumberOfDimensions();
323 int bin_dim = binaryImage->GetNumberOfDimensions();
324 if (dim < bin_dim) { ////////// TO CHANGE FOR 3D/4D
325 std::ostringstream os;
326 os << "Error. Loaded binary image is " << bin_dim
327 << "D while selected image is " << dim << "D" << std::endl;
328 QMessageBox::information(this,tr("Reading problem"),os.str().c_str());
332 // Add a new roi to the structure
333 int n = mCurrentStructureSet->AddBinaryImageAsNewROI(binaryImage, filename);
334 mLoadedROIIndex.push_back(n);
336 mCurrentStructureSet->GetROI(n)->SetBackgroundValueLabelImage(BG);
338 mCurrentStructureSet->GetROI(n)->SetForegroundValueLabelImage(BG);
341 if (n<mDefaultLUTColor->GetNumberOfTableValues ()) {
342 double * color = mDefaultLUTColor->GetTableValue(n % mDefaultLUTColor->GetNumberOfTableValues ());
343 mCurrentStructureSet->GetROI(n)->SetDisplayColor(color[0], color[1], color[2]);
346 // Add a new roi actor
347 mCurrentStructureSetActor->CreateNewROIActor(n, m_modeBG);
349 // CheckBox for "All"
350 if (mCurrentStructureSetActor->GetROIActor(n)->IsVisible())
351 mNumberOfVisibleROI++;
352 if (mCurrentStructureSetActor->GetROIActor(n)->IsContourVisible())
353 mNumberOfVisibleContourROI++;
354 UpdateAllROIStatus();
356 //------------------------------------------------------------------------------
359 //------------------------------------------------------------------------------
360 void vvToolStructureSetManager::apply()
364 //------------------------------------------------------------------------------
367 //------------------------------------------------------------------------------
368 bool vvToolStructureSetManager::close()
370 //std::cout << "vvToolStructureSetManager::close()" << std::endl;
372 return vvToolWidgetBase::close();
374 //------------------------------------------------------------------------------
377 //------------------------------------------------------------------------------
378 void vvToolStructureSetManager::closeEvent(QCloseEvent *event)
380 //std::cout << "vvToolStructureSetManager::closeEvent()" << std::endl;
382 std::vector<vvSlicerManager*>::iterator iter = std::find(mListOfInputs.begin(), mListOfInputs.end(), mCurrentSlicerManager);
383 if (iter != mListOfInputs.end()) mListOfInputs.erase(iter);
385 // DD("how delete mListOfOpenTool ???");
386 mListOfOpenTool.erase(mCurrentSlicerManager);
388 mCheckBoxShowAll->setCheckState(Qt::Unchecked);
389 mContourCheckBoxShowAll->setCheckState(Qt::Unchecked);
390 if (mCurrentSlicerManager != 0)
391 mCurrentSlicerManager->Render();
394 if (m_NumberOfTool == 1) {
395 mMainWindow->GetTab()->removeTab(mTabNumber);
401 //------------------------------------------------------------------------------
404 //------------------------------------------------------------------------------
405 // CURRENT ROI INTERACTION
406 //------------------------------------------------------------------------------
409 //------------------------------------------------------------------------------
410 void vvToolStructureSetManager::SelectedItemChangedInTree() {
412 // Search which roi is selected
413 QList<QTreeWidgetItem *> l = mTree->selectedItems();
415 mCurrentROIActor = NULL;
417 mGroupBoxROI->setEnabled(false);
420 QTreeWidgetItem * w = l[0];
421 //std::cout << "selected item -> " << w->text(1).toStdString() << std::endl;
422 //std::cout << "m_NumberOfTool -> " << m_NumberOfTool << std::endl;
423 if (mMapTreeWidgetToROI.find(w) == mMapTreeWidgetToROI.end()) {
424 mCurrentROIActor = NULL;
426 mGroupBoxROI->setEnabled(false);
429 clitk::DicomRT_ROI * roi = mMapTreeWidgetToROI[w];
430 // Get selected roi actor
431 vvROIActor * actor = mStructureSetActorsList[mCurrentStructureSetIndex]->GetROIActor(roi->GetROINumber());
433 mCurrentROIActor = actor;
436 mGroupBoxROI->setEnabled(true);
437 mROInameLabel->setText(roi->GetName().c_str());
438 mCheckBoxShow->setChecked(actor->IsVisible());
439 mContourCheckBoxShow->setChecked(actor->IsContourVisible());
440 mContourWidthSpinBox->setValue(actor->GetContourWidth());
442 // Warning -> avoir unuseful Render here by disconnect slider
443 disconnect(mOpacitySlider, SIGNAL(valueChanged(int)),
444 this, SLOT(OpacityChanged(int)));
445 mOpacitySlider->setValue((int)lrint(actor->GetOpacity()*100));
446 mOpacitySpinBox->setValue((int)lrint(actor->GetOpacity()*100));
447 connect(mOpacitySlider, SIGNAL(valueChanged(int)),
448 this, SLOT(OpacityChanged(int)));
452 mCurrentSlicerManager->Render();
454 //------------------------------------------------------------------------------
457 //------------------------------------------------------------------------------
458 void vvToolStructureSetManager::UpdateAllROIStatus() {
460 int nb = mCurrentStructureSetActor->GetROIList().size();
461 for(int i=0; i<nb; i++) {
462 if (mCurrentStructureSetActor->GetROIList()[i]->IsVisible()) {
467 disconnect(mCheckBoxShowAll, SIGNAL(stateChanged(int)), this, SLOT(AllVisibleROIToggled(int)));
468 disconnect(mContourCheckBoxShowAll, SIGNAL(toggled(bool)), this, SLOT(AllVisibleContourROIToggled(bool)));
469 if (nbVisible == nb) mCheckBoxShowAll->setCheckState(Qt::Checked);
471 if (nbVisible == 0) mCheckBoxShowAll->setCheckState(Qt::Unchecked);
472 else mCheckBoxShowAll->setCheckState(Qt::PartiallyChecked);
474 connect(mContourCheckBoxShowAll, SIGNAL(toggled(bool)), this, SLOT(AllVisibleContourROIToggled(bool)));
475 connect(mCheckBoxShowAll, SIGNAL(stateChanged(int)), this, SLOT(AllVisibleROIToggled(int)));
477 //------------------------------------------------------------------------------
479 //------------------------------------------------------------------------------
480 void vvToolStructureSetManager::VisibleROIToggled(bool b) {
481 if (mCurrentROIActor == NULL) return;
482 if (b == mCurrentROIActor->IsVisible()) return; // nothing to do
483 mCurrentROIActor->SetVisible(b);
484 UpdateAllROIStatus();
485 mCurrentSlicerManager->Render();
487 //------------------------------------------------------------------------------
490 //------------------------------------------------------------------------------
491 void vvToolStructureSetManager::VisibleContourROIToggled(bool b) {
492 if (mCurrentROIActor == NULL) return;
493 if (mCurrentROIActor->IsContourVisible() == b) return; // nothing to do
494 mCurrentROIActor->SetContourVisible(b);
495 mCurrentROIActor->UpdateColor();
496 mCurrentSlicerManager->Render();
498 //------------------------------------------------------------------------------
501 //------------------------------------------------------------------------------
502 void vvToolStructureSetManager::OpacityChanged(int v) {
503 if (mCurrentROIActor == NULL) return;
504 mCurrentROIActor->SetOpacity((double)v/100.0);
505 mCurrentROIActor->UpdateColor();
506 mCurrentSlicerManager->Render();
508 //------------------------------------------------------------------------------
511 //------------------------------------------------------------------------------
512 void vvToolStructureSetManager::AllVisibleROIToggled(int b) {
514 if ((mCheckBoxShowAll->checkState() == Qt::Checked) ||
515 (mCheckBoxShowAll->checkState() == Qt::PartiallyChecked)) status = true;
517 for(int i=0; i<mCurrentStructureSetActor->GetNumberOfROIs(); i++) {
518 mCurrentStructureSetActor->GetROIList()[i]->SetVisible(status);
520 if (status) mCheckBoxShowAll->setCheckState(Qt::Checked);
521 else mCheckBoxShowAll->setCheckState(Qt::Unchecked);
522 mCheckBoxShow->setChecked(status);
523 mCurrentSlicerManager->Render();
525 //------------------------------------------------------------------------------
528 //------------------------------------------------------------------------------
529 void vvToolStructureSetManager::AllVisibleContourROIToggled(bool b) {
531 if ((mContourCheckBoxShowAll->checkState() == Qt::Checked) ||
532 (mContourCheckBoxShowAll->checkState() == Qt::PartiallyChecked)) status = true;
534 for(int i=0; i<mCurrentStructureSetActor->GetNumberOfROIs(); i++) {
535 mCurrentStructureSetActor->GetROIList()[i]->SetContourVisible(status);
537 // Update current selection
538 if (status) mContourCheckBoxShowAll->setCheckState(Qt::Checked);
539 else mContourCheckBoxShowAll->setCheckState(Qt::Unchecked);
540 mContourCheckBoxShow->setChecked(status);
541 mCurrentSlicerManager->Render();
543 //------------------------------------------------------------------------------
546 //------------------------------------------------------------------------------
547 void vvToolStructureSetManager::ChangeColor() {
549 color.setRgbF(mCurrentROIActor->GetROI()->GetDisplayColor()[0],
550 mCurrentROIActor->GetROI()->GetDisplayColor()[1],
551 mCurrentROIActor->GetROI()->GetDisplayColor()[2]);
552 QColor c = QColorDialog::getColor(color, this, "Choose the ROI color");
553 mCurrentROIActor->GetROI()->SetDisplayColor(c.redF(), c.greenF(), c.blueF());
554 mCurrentROIActor->UpdateColor();
556 QTreeWidgetItem * w = mMapROIToTreeWidget[mCurrentROI];
557 QBrush brush(QColor(mCurrentROI->GetDisplayColor()[0]*255,
558 mCurrentROI->GetDisplayColor()[1]*255,
559 mCurrentROI->GetDisplayColor()[2]*255));
560 brush.setStyle(Qt::SolidPattern);
561 w->setBackground(2, brush);
563 mCurrentSlicerManager->Render();
565 //------------------------------------------------------------------------------
568 //------------------------------------------------------------------------------
569 void vvToolStructureSetManager::ChangeContourColor() {
571 color.setRgbF(mCurrentROIActor->GetContourColor()[0],
572 mCurrentROIActor->GetContourColor()[1],
573 mCurrentROIActor->GetContourColor()[2]);
574 QColor c = QColorDialog::getColor(color, this, "Choose the contour color");
575 mCurrentROIActor->SetContourColor(c.redF(), c.greenF(), c.blueF());
576 mCurrentROIActor->UpdateColor();
577 mCurrentSlicerManager->Render();
579 //------------------------------------------------------------------------------
582 //------------------------------------------------------------------------------
583 void vvToolStructureSetManager::ChangeContourWidth(int n) {
584 mCurrentROIActor->SetContourWidth(n);
585 mCurrentROIActor->UpdateColor();
586 mCurrentSlicerManager->Render();
588 //------------------------------------------------------------------------------
591 //------------------------------------------------------------------------------
592 void vvToolStructureSetManager::ReloadCurrentROI() {
594 vvImageReader::Pointer reader = vvImageReader::New();
595 reader->SetInputFilename(mCurrentROI->GetFilename());
596 reader->Update(vvImageReader::IMAGE);
597 if (reader->GetLastError() != "") {
598 QMessageBox::information(mMainWindowBase, tr("Sorry, error. Could not reload"), reader->GetLastError().c_str());
601 mCurrentROI->GetImage()->GetFirstVTKImageData()->ReleaseData();
602 mCurrentROI->SetImage(reader->GetOutput());
605 mCurrentROIActor->UpdateImage();
606 mCurrentSlicerManager->Render();
608 //------------------------------------------------------------------------------
611 //------------------------------------------------------------------------------
612 void vvToolStructureSetManager::CheckInputList(std::vector<vvSlicerManager*> & l, int & index)
614 for(unsigned int i=0; i<l.size(); i++) {
615 std::vector<vvSlicerManager*>::iterator iter = std::find(mListOfInputs.begin(), mListOfInputs.end(), l[i]);
616 if (iter != mListOfInputs.end()) {
617 for(unsigned int j=i;j<l.size(); j++) l[j] = l[j+1];
619 if (index == (int)i) index = 0;
624 //------------------------------------------------------------------------------
627 //------------------------------------------------------------------------------
629 vvToolStructureSetManager * vvToolStructureSetManager::AddImage(vvSlicerManager * m, std::string name, vvImage::Pointer image, double BG, bool m_modeBG)
631 // If the tool is open for this vvSlicerManager, use it and return
632 if (mListOfOpenTool[m]) {
633 vvToolStructureSetManager * tool = mListOfOpenTool[m];
634 tool->AddImage(image, name, BG, m_modeBG);
639 // If the tool is not open, create it
640 vvToolStructureSetManager * tool = new vvToolStructureSetManager
641 (CREATOR(vvToolStructureSetManager)->GetMainWindow(), Qt::Dialog, m);
642 tool->AddImage(image, name, BG, m_modeBG);
647 //------------------------------------------------------------------------------