// STATIC
void vvToolROIManager::Initialize() {
SetToolName("ROIManager");
- SetToolMenuName("Display ROI (binary image)");
+ SetToolMenuName("Open ROI (binary image or RT-STRUCT)");
SetToolIconFilename(":/common/icons/tool-roi.png");
- SetToolTip("Display ROI from a binary image.");
+ SetToolTip("Display ROI from a binary image or a RT-struct file.");
SetToolExperimental(false);
}
//------------------------------------------------------------------------------
void vvToolROIManager::OpenBinaryImage(QStringList & filename)
{
if (filename.size() == 0) return;
-
+
vvProgressDialog p("Reading ROI ...", true);
p.SetCancelButtonEnabled(false);
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
return;
}
vvImage::Pointer binaryImage = reader->GetOutput();
- AddImage(binaryImage, filename[i].toStdString(), mBackgroundValueSpinBox->value(),
+ std::ostringstream oss;
+ oss << vtksys::SystemTools::
+ GetFilenameName(vtksys::SystemTools::GetFilenameWithoutLastExtension(filename[i].toStdString()));
+ std::string name = oss.str();
+ AddImage(binaryImage, name, filename[i].toStdString(), mBackgroundValueSpinBox->value(),
(!mBGModeCheckBox->isChecked()));
mOpenedBinaryImageFilenames.push_back(filename[i]);
}
// GUI selector of roi
vvMeshReader reader;
reader.SetFilename(filename);
+
vvStructSelector selector;
selector.SetStructures(reader.GetROINames());
selector.SetPropagationCheckBoxFlag(false);
// Loop on selected struct
std::vector<int> list = selector.getSelectedItems();
for (uint i=0; i<list.size(); i++) {
- p.SetProgress(i, list.size());
-
+ p.SetProgress(i, list.size());
+
clitk::DicomRTStruct2ImageFilter filter;
filter.SetCropMaskEnabled(true);
filter.SetImage(mCurrentImage);
binaryImage->AddVtkImage(filter.GetOutput());
// Add to gui
- AddImage(binaryImage, s->GetROIFromROINumber(list[i])->GetName(), 0, true);
+ AddImage(binaryImage, s->GetROIFromROINumber(list[i])->GetName(), "", 0, true); // "" = no filename
mOpenedBinaryImageFilenames.push_back(filename.c_str());
}
//------------------------------------------------------------------------------
-void vvToolROIManager::AddImage(vvImage * binaryImage, std::string filename,
+void vvToolROIManager::AddImage(vvImage * binaryImage,
+ std::string name,
+ std::string filename,
double BG, bool modeBG)
{
// Check Dimension
int n = mROIList.size();
// Compute the name of the new ROI
- std::ostringstream oss;
- oss << vtksys::SystemTools::GetFilenameName(vtksys::SystemTools::GetFilenameWithoutLastExtension(filename));
- std::string name = oss.str();
+ // std::ostringstream oss;
+ // oss << vtksys::SystemTools::GetFilenameName(vtksys::SystemTools::GetFilenameWithoutLastExtension(filename));
+ // std::string name = oss.str();
// Set color
std::vector<double> color;
//------------------------------------------------------------------------------
void vvToolROIManager::ReloadCurrentROI() {
+ if (mCurrentROI->GetFilename() == "") {
+ return; // do nothing (contour from rt struct do not reload)
+ }
// Remove all contours/overlay first
bool visible = mCurrentROIActor->IsVisible();