+//------------------------------------------------------------------------------
+void vvToolStructureSetManager::ChangeColor() {
+ QColor color;
+ color.setRgbF(mCurrentROIActor->GetROI()->GetDisplayColor()[0],
+ mCurrentROIActor->GetROI()->GetDisplayColor()[1],
+ mCurrentROIActor->GetROI()->GetDisplayColor()[2]);
+ QColor c = QColorDialog::getColor(color, this, "Choose the ROI color");
+ mCurrentROIActor->GetROI()->SetDisplayColor(c.redF(), c.greenF(), c.blueF());
+ mCurrentROIActor->UpdateColor();
+
+ QTreeWidgetItem * w = mMapROIToTreeWidget[mCurrentROI];
+ QBrush brush(QColor(mCurrentROI->GetDisplayColor()[0]*255,
+ mCurrentROI->GetDisplayColor()[1]*255,
+ mCurrentROI->GetDisplayColor()[2]*255));
+ brush.setStyle(Qt::SolidPattern);
+ w->setBackground(2, brush);
+ // Render
+ mCurrentSlicerManager->Render();
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+void vvToolStructureSetManager::ChangeContourColor() {
+ QColor color;
+ color.setRgbF(mCurrentROIActor->GetContourColor()[0],
+ mCurrentROIActor->GetContourColor()[1],
+ mCurrentROIActor->GetContourColor()[2]);
+ QColor c = QColorDialog::getColor(color, this, "Choose the contour color");
+ mCurrentROIActor->SetContourColor(c.redF(), c.greenF(), c.blueF());
+ mCurrentROIActor->UpdateColor();
+ mCurrentSlicerManager->Render();
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+void vvToolStructureSetManager::ChangeContourWidth(int n) {
+ mCurrentROIActor->SetContourWidth(n);
+ mCurrentROIActor->UpdateColor();
+ mCurrentSlicerManager->Render();
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+void vvToolStructureSetManager::ReloadCurrentROI() {
+ // Reload image
+ vvImageReader * mReader = new vvImageReader;
+ mReader->SetInputFilename(mCurrentROI->GetFilename());
+ mReader->Update(IMAGE);
+ if (mReader->GetLastError() != "") {
+ QMessageBox::information(mMainWindowBase, tr("Sorry, error. Could not reload"), mReader->GetLastError().c_str());
+ return;
+ }
+ // delete mCurrentROI->GetImage();
+ // DD(mCurrentROI->GetImage()->GetFirstVTKImageData()->GetDataReleased());
+ // DD(mCurrentROI->GetImage()->GetFirstVTKImageData()->GetReferenceCount());
+ mCurrentROI->GetImage()->GetFirstVTKImageData()->ReleaseData();
+ // DD(mCurrentROI->GetImage()->GetFirstVTKImageData()->GetDataReleased());
+ mCurrentROI->SetImage(mReader->GetOutput());
+
+ // Update visu"
+ mCurrentROIActor->UpdateImage();
+ mCurrentSlicerManager->Render();
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+void vvToolStructureSetManager::CheckInputList(std::vector<vvSlicerManager*> & l, int & index)
+{
+ for(unsigned int i=0; i<l.size(); i++) {
+ std::vector<vvSlicerManager*>::iterator iter = std::find(mListOfInputs.begin(), mListOfInputs.end(), l[i]);
+ if (iter != mListOfInputs.end()) {
+ for(unsigned int j=i;j<l.size(); j++) l[j] = l[j+1];
+ l.pop_back();
+ if (index == (int)i) index = 0;
+ i--;
+ }
+ }
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+// STATIC
+vvToolStructureSetManager * vvToolStructureSetManager::AddImage(vvSlicerManager * m, std::string name, vvImage::Pointer image, double BG, bool m_modeBG)
+{
+ // If the tool is open for this vvSlicerManager, use it and return
+ if (mListOfOpenTool[m]) {
+ vvToolStructureSetManager * tool = mListOfOpenTool[m];
+ tool->AddImage(image, name, BG, m_modeBG);
+ tool->UpdateImage();
+ return tool;
+ }
+
+ // If the tool is not open, create it
+ vvToolStructureSetManager * tool = new vvToolStructureSetManager
+ (CREATOR(vvToolStructureSetManager)->GetMainWindow(), Qt::Dialog, m);
+ tool->AddImage(image, name, BG, m_modeBG);
+ tool->UpdateImage();
+ tool->show();
+ return tool;
+}
+//------------------------------------------------------------------------------