<property name="text">
<string>About</string>
</property>
+ <property name="iconVisibleInMenu">
+ <bool>true</bool>
+ </property>
</action>
<action name="actionReload_images">
<property name="text">
<property name="text">
<string>Save image in TL</string>
</property>
+ <property name="iconVisibleInMenu">
+ <bool>true</bool>
+ </property>
</action>
<action name="actionNorth_East_Window">
<property name="icon">
<property name="text">
<string>Save image in TR</string>
</property>
+ <property name="iconVisibleInMenu">
+ <bool>true</bool>
+ </property>
</action>
<action name="actionSouth_West_Window">
<property name="icon">
<property name="text">
<string>Save image in BL</string>
</property>
+ <property name="iconVisibleInMenu">
+ <bool>true</bool>
+ </property>
</action>
<action name="actionSouth_East_Window">
<property name="icon">
<property name="text">
<string>Save image in BR</string>
</property>
+ <property name="iconVisibleInMenu">
+ <bool>true</bool>
+ </property>
</action>
<action name="actionOpen_Image_With_Time">
<property name="icon">
<property name="text">
<string>Add fusion image to current image</string>
</property>
+ <property name="iconVisibleInMenu">
+ <bool>true</bool>
+ </property>
</action>
<action name="actionSegmentation">
<property name="text">
<string>Segmentation</string>
</property>
+ <property name="iconVisibleInMenu">
+ <bool>true</bool>
+ </property>
</action>
<action name="actionResampler">
<property name="text">
<property name="text">
<string>Surface Viewer</string>
</property>
+ <property name="iconVisibleInMenu">
+ <bool>true</bool>
+ </property>
</action>
<action name="actionDebug">
<property name="text">
<property name="text">
<string>Deformable Registration</string>
</property>
+ <property name="iconVisibleInMenu">
+ <bool>true</bool>
+ </property>
</action>
<action name="actionWarp_image_with_vector_field">
<property name="text">
<string>Verify Registration</string>
</property>
+ <property name="iconVisibleInMenu">
+ <bool>true</bool>
+ </property>
</action>
<action name="actionMaximum_Intensity_Projection">
<property name="text">
<property name="shortcut">
<string>F1</string>
</property>
+ <property name="iconVisibleInMenu">
+ <bool>true</bool>
+ </property>
</action>
<action name="actionOpen_Dicom_Struct">
<property name="icon">
<property name="text">
<string>Compute mid-position image</string>
</property>
+ <property name="iconVisibleInMenu">
+ <bool>true</bool>
+ </property>
</action>
<action name="actionExperimental">
<property name="text">
<property name="text">
<string>Register vv</string>
</property>
+ <property name="iconVisibleInMenu">
+ <bool>true</bool>
+ </property>
</action>
<action name="actionSave_all_slices">
<property name="text">
<rect>
<x>0</x>
<y>0</y>
- <width>349</width>
- <height>627</height>
+ <width>350</width>
+ <height>554</height>
</rect>
</property>
<property name="sizePolicy">
<property name="windowTitle">
<string>Form</string>
</property>
- <layout class="QGridLayout" name="gridLayout_4">
- <item row="0" column="0">
+ <layout class="QVBoxLayout" name="verticalLayout_5">
+ <item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<spacer name="horizontalSpacer">
</item>
</layout>
</item>
- <item row="1" column="0">
+ <item>
<widget class="QFrame" name="frame_3">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
- <layout class="QGridLayout" name="gridLayout_3">
- <item row="0" column="0">
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <widget class="QLabel" name="vectorFieldNameLabel_4">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Load ROI from image</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="mOpenBinaryButton">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="maximumSize">
- <size>
- <width>24</width>
- <height>24</height>
- </size>
- </property>
- <property name="toolTip">
- <string>Open label image</string>
- </property>
- <property name="text">
- <string/>
- </property>
- <property name="icon">
- <iconset resource="../vvIcons.qrc">
- <normaloff>:/common/icons/fileopen.png</normaloff>:/common/icons/fileopen.png</iconset>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="horizontalSpacer_4">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QLabel" name="dimensionStaticLabel">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>BG</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QSpinBox" name="mBackgroundValueSpinBox"/>
- </item>
- <item>
- <widget class="QCheckBox" name="mBGModeCheckBox">
- <property name="toolTip">
- <string>Tick if you want to consider FG mode instead of BG mode.</string>
- </property>
- <property name="text">
- <string>FG ?</string>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="horizontalSpacer_2">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <property name="spacing">
+ <number>2</number>
+ </property>
+ <property name="margin">
+ <number>2</number>
+ </property>
+ <item>
+ <widget class="QLabel" name="vectorFieldNameLabel_4">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Load ROI from image</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="mOpenBinaryButton">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>24</width>
+ <height>24</height>
+ </size>
+ </property>
+ <property name="toolTip">
+ <string>Open label image</string>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ <property name="icon">
+ <iconset resource="../vvIcons.qrc">
+ <normaloff>:/common/icons/fileopen.png</normaloff>:/common/icons/fileopen.png</iconset>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer_4">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QLabel" name="dimensionStaticLabel">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>BG</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="mBackgroundValueSpinBox"/>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="mBGModeCheckBox">
+ <property name="toolTip">
+ <string>Tick if you want to consider FG mode instead of BG mode.</string>
+ </property>
+ <property name="text">
+ <string>FG ?</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QFrame" name="frame_4">
+ <property name="frameShape">
+ <enum>QFrame::StyledPanel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Raised</enum>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout_10">
+ <property name="spacing">
+ <number>2</number>
+ </property>
+ <property name="margin">
+ <number>2</number>
+ </property>
+ <item>
+ <widget class="QLabel" name="vectorFieldNameLabel_5">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Load DICOM-RT-Struct</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="mOpenDicomButton">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>24</width>
+ <height>24</height>
+ </size>
+ </property>
+ <property name="toolTip">
+ <string>Open label image</string>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ <property name="icon">
+ <iconset resource="../vvIcons.qrc">
+ <normaloff>:/common/icons/fileopen.png</normaloff>:/common/icons/fileopen.png</iconset>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer_6">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
</item>
</layout>
</widget>
</item>
- <item row="2" column="0">
+ <item>
<widget class="QTreeWidget" name="mTree">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
</item>
</widget>
</item>
- <item row="3" column="0">
+ <item>
<widget class="QFrame" name="frame">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
</widget>
</item>
+ <item>
+ <spacer name="horizontalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
</sizepolicy>
</property>
<property name="text">
- <string>Name : Lung</string>
+ <string> </string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
- <item row="4" column="0">
+ <item>
<layout class="QHBoxLayout" name="horizontalLayout_7">
<property name="spacing">
<number>2</number>
</item>
</layout>
</widget>
+ <tabstops>
+ <tabstop>mOpenBinaryButton</tabstop>
+ <tabstop>mBackgroundValueSpinBox</tabstop>
+ <tabstop>mBGModeCheckBox</tabstop>
+ <tabstop>mOpenDicomButton</tabstop>
+ <tabstop>mTree</tabstop>
+ <tabstop>mCheckBoxShow</tabstop>
+ <tabstop>mChangeColorButton</tabstop>
+ <tabstop>mReloadButton</tabstop>
+ <tabstop>mOpacitySlider</tabstop>
+ <tabstop>mOpacitySpinBox</tabstop>
+ <tabstop>mContourCheckBoxShow</tabstop>
+ <tabstop>mChangeContourColorButton</tabstop>
+ <tabstop>mContourWidthSpinBox</tabstop>
+ <tabstop>mDepthSpinBox</tabstop>
+ <tabstop>mCheckBoxShowAll</tabstop>
+ <tabstop>mContourCheckBoxShowAll</tabstop>
+ <tabstop>mCloseButton</tabstop>
+ </tabstops>
<resources>
<include location="../vvIcons.qrc"/>
</resources>
<slot>setValue(int)</slot>
<hints>
<hint type="sourcelabel">
- <x>219</x>
- <y>385</y>
+ <x>289</x>
+ <y>371</y>
</hint>
<hint type="destinationlabel">
- <x>376</x>
- <y>376</y>
+ <x>413</x>
+ <y>374</y>
</hint>
</hints>
</connection>
<y>367</y>
</hint>
<hint type="destinationlabel">
- <x>222</x>
- <y>373</y>
+ <x>292</x>
+ <y>371</y>
</hint>
</hints>
</connection>
// Create main action
if (mToolIconFilename == "noicon")
mAction = new QAction(QString("&").append(mToolMenuName), this);
- else
+ else {
mAction = new QAction(QIcon(mToolIconFilename),
QString("&").append(mToolMenuName), this);
+ mAction->setIconVisibleInMenu(true);
+ }
+
mAction->setStatusTip(mToolTip);
// Connect the action
connect(mAction, SIGNAL(triggered()), this, SLOT(MenuToolSlot()));
//------------------------------------------------------------------------------
vvToolROIManager::vvToolROIManager(vvMainWindowBase * parent, Qt::WindowFlags f):
- // vvToolWidgetBase(parent, f),
- // if Qt::Widget -> No dialog in this case (in tab) ; PB = "invisible widget on menu" !
- // if "f" normal widget
- QWidget(parent->GetTab()->widget(4)),
+ QWidget(parent->GetTab()),
vvToolBase<vvToolROIManager>(parent),
Ui::vvToolROIManager()
{
- // Insert the current QWidget into the tab layout (required)
- QWidget * mother = qFindChild<QWidget*>(parent->GetTab(), "ROItab");
- mother->layout()->addWidget(this);
+ // Store parent
mMainWindow = parent;
+ // Assume the initial tab ROI index is 2
+ mIndexFirstTab = 2;
+
+ // Get the ROI Tab
+ QWidget * tab = qFindChild<QWidget*>(parent->GetTab(), "ROItab");
+
+ // Set it as current
+ parent->GetTab()->setCurrentIndex(mIndexFirstTab);
+
+ // Check if widget already used
+ if (tab->layout()->isEmpty()) {
+ tab->layout()->addWidget(this);
+ }
+ else {
+ close();
+ return;
+ }
+
// Build the UI
Ui_vvToolROIManager::setupUi(this);
setAttribute(Qt::WA_DeleteOnClose);
mTree->clear();
mTree->header()->resizeSection(0, 30);
- parent->GetTab()->setCurrentIndex(2);
// Set default LUT
mDefaultLUTColor = vtkSmartPointer<vtkLookupTable>::New();
- DD(mDefaultLUTColor->GetNumberOfTableValues());
for(int i=0; i<mDefaultLUTColor->GetNumberOfTableValues(); i++) {
double r = (rand()/(RAND_MAX+1.0));
double v = (rand()/(RAND_MAX+1.0));
double b = (rand()/(RAND_MAX+1.0));
mDefaultLUTColor->SetTableValue(i, r, v, b);
- // std::cout << "mDefaultLUTColor->SetTableValue(" << i << ", " << r << ", " << v << ", " << b << ");" << std::endl;
}
#include "vvDefaultLut.h"
connect(mReloadButton, SIGNAL(clicked()), this, SLOT(ReloadCurrentROI()));
connect(mCheckBoxShowAll, SIGNAL(stateChanged(int)), this, SLOT(AllVisibleROIToggled(int)));
connect(mContourCheckBoxShowAll, SIGNAL(toggled(bool)), this, SLOT(AllVisibleContourROIToggled(bool)));
-
- // mMainWindowBase->GetTab()->setTabIcon(mTabNumber, GetToolIcon());
+ connect(mCloseButton, SIGNAL(clicked()), this, SLOT(close()));
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void vvToolROIManager::InputIsSelected(vvSlicerManager *m)
{
- std::cout << "vvToolROIManager::InputIsSelected()" << std::endl;
mSlicerManager = m;
- // Signal/slot
- connect(mCloseButton, SIGNAL(clicked()), this, SLOT(close()));
-
// Initialization
mSlicerManager = m;
mCurrentImage = mSlicerManager->GetImage();
//------------------------------------------------------------------------------
void vvToolROIManager::AnImageIsBeingClosed(vvSlicerManager * m)
{
- if (m == mSlicerManager) close();
+ DD("AnImageIsBeingClosed");
+ if (m == mSlicerManager) {
+ close();
+ return;
+ }
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+void vvToolROIManager::close()
+{
+ DD("close");
+ QWidget::close();
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void vvToolROIManager::SelectedImageHasChanged(vvSlicerManager * m) {
- if (m != mSlicerManager) hide();
- else show();
+ DD("SelectedImageHasChanged");
+ if (m != mSlicerManager) hide();
+ else {
+ show();
+ }
}
//------------------------------------------------------------------------------
void vvToolROIManager::AddImage(vvImage * binaryImage, std::string filename,
double BG, bool modeBG)
{
- DD(modeBG);
-
// Check Dimension
int dim = mCurrentImage->GetNumberOfDimensions();
int bin_dim = binaryImage->GetNumberOfDimensions();
// Compute roi index
int n = mROIList.size();
- DD(n);
// Compute the name of the new ROI
std::ostringstream oss;
oss << vtksys::SystemTools::GetFilenameName(vtksys::SystemTools::GetFilenameWithoutLastExtension(filename));
std::string name = oss.str();
- DD(name);
// Set color
std::vector<double> color;
roi->SetForegroundValueLabelImage(BG);
// Change color
- DD("color");
if (n<mDefaultLUTColor->GetNumberOfTableValues ()) {
double * color = mDefaultLUTColor->GetTableValue(n % mDefaultLUTColor->GetNumberOfTableValues ());
roi->SetDisplayColor(color[0], color[1], color[2]);
nbVisible++;
}
}
- DD(nbVisible);
// change the states
disconnect(mCheckBoxShowAll, SIGNAL(stateChanged(int)), this, SLOT(AllVisibleROIToggled(int)));
return;
}
QTreeWidgetItem * w = l[0];
- //std::cout << "selected item -> " << w->text(1).toStdString() << std::endl;
- //std::cout << "m_NumberOfTool -> " << m_NumberOfTool << std::endl;
if (mMapTreeWidgetToROI.find(w) == mMapTreeWidgetToROI.end()) {
// mCurrentROIActor = 0;
mCurrentROI = NULL;
connect(mContourWidthSpinBox, SIGNAL(valueChanged(int)), this, SLOT(ChangeContourWidth(int)));
connect(mDepthSpinBox, SIGNAL(valueChanged(int)), this, SLOT(ChangeDepth(int)));
+
+ // Set the current color to the selected ROI name
+ mROInameLabel->setAutoFillBackground(true);// # This is important!!
+ mROInameLabel->setStyleSheet("QLabel { background-color : red; color : blue; }");
+ QColor color = QColor(mCurrentROI->GetDisplayColor()[0]*255,
+ mCurrentROI->GetDisplayColor()[1]*255,
+ mCurrentROI->GetDisplayColor()[2]*255);
+ QString values = QString("%1, %2, %3").arg(color.red()).arg(color.green()).arg(color.blue());
+ mROInameLabel->setStyleSheet("QLabel { background-color: rgb("+values+"); }");
+
// is this needed ?
// actor->Update();
// Final rendering
mSlicerManager->Render();
}
//------------------------------------------------------------------------------
-
-
void AllVisibleROIToggled(int b);
void AllVisibleContourROIToggled(bool b);
void ReloadCurrentROI();
+ void close();
protected:
Ui::vvToolROIManager ui;
vvSlicerManager * mSlicerManager;
vvImage * mCurrentImage;
vvMainWindowBase * mMainWindow;
+ int mIndexFirstTab;
int mNumberOfVisibleROI;
int mNumberOfVisibleContourROI;
// Data for current selected roi
clitk::DicomRT_ROI::Pointer mCurrentROI;
- QSharedPointer<vvROIActor> mCurrentROIActor;
+ QSharedPointer<vvROIActor> mCurrentROIActor;
}; // end class vvToolROIManager
//------------------------------------------------------------------------------