#include "vvImageWriter.h"
#include "vvROIActor.h"
#include "vvSlicer.h"
-#include "vvROIActor.h"
#include "vvMeshReader.h"
#include "vvStructSelector.h"
#include "vvToolManager.h"
QWidget(parent->GetTab()),
vvToolBase<vvToolROIManager>(parent),
Ui::vvToolROIManager()
-{
+{ //out << __func__ << endl;
// Store parent
mMainWindow = parent;
//------------------------------------------------------------------------------
vvToolROIManager::~vvToolROIManager()
-{
+{ //out << __func__ << endl;
mROIActorsList.clear();
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// STATIC
-void vvToolROIManager::Initialize() {
+void vvToolROIManager::Initialize()
+{ //out << __func__ << endl;
SetToolName("ROIManager");
SetToolMenuName("Open ROI (binary image or RT-STRUCT)");
SetToolIconFilename(":/common/icons/tool-roi.png");
//------------------------------------------------------------------------------
void vvToolROIManager::InitializeNewTool(bool ReadStateFlag)
-{
+{ //out << __func__ << endl;
// Check if we need to start a new tool or read in the state file to load
if (ReadStateFlag == false) {
// Select the current image as the target
//------------------------------------------------------------------------------
void vvToolROIManager::InputIsSelected(vvSlicerManager *m)
-{
+{ //out << __func__ << endl;
// Initialization
mCurrentSlicerManager = m;
mCurrentImage = mCurrentSlicerManager->GetImage();
//------------------------------------------------------------------------------
void vvToolROIManager::AnImageIsBeingClosed(vvSlicerManager * m)
-{
+{ //out << __func__ << endl;
if (m == mCurrentSlicerManager) {
close();
return;
//------------------------------------------------------------------------------
void vvToolROIManager::close()
-{
+{ //out << __func__ << endl;
disconnect(mTree, SIGNAL(itemSelectionChanged()), this, SLOT(SelectedItemChangedInTree()));
disconnect(mCheckBoxShow, SIGNAL(toggled(bool)), this, SLOT(VisibleROIToggled(bool)));
disconnect(mOpacitySlider, SIGNAL(valueChanged(int)), this, SLOT(OpacityChanged(int)));
//------------------------------------------------------------------------------
-void vvToolROIManager::SelectedImageHasChanged(vvSlicerManager * m) {
-
+void vvToolROIManager::SelectedImageHasChanged(vvSlicerManager * m)
+{ //out << __func__ << endl;
if (mCurrentSlicerManager == NULL) return;
if (m == NULL) return;
if (m != mCurrentSlicerManager) hide();
//------------------------------------------------------------------------------
void vvToolROIManager::Open()
-{
+{ //out << __func__ << endl;
// Open images
QString Extensions = "Images or Dicom-Struct files ( *.mha *.mhd *.hdr *.his *.dcm RS*)";
Extensions += ";;All Files (*)";
//------------------------------------------------------------------------------
void vvToolROIManager::OpenBinaryImage(QStringList & filename)
-{
+{ //out << __func__ << endl;
if (filename.size() == 0) return;
vvProgressDialog p("Reading ROI ...", true);
//------------------------------------------------------------------------------
void vvToolROIManager::OpenDicomImage(std::string filename)
-{
+{ //out << __func__ << endl;
// GUI selector of roi
vvMeshReader reader;
reader.SetFilename(filename);
std::string name,
std::string filename,
double BG, bool modeBG)
-{
+{ //out << __func__ << endl;
// Check Dimension
int dim = mCurrentImage->GetNumberOfDimensions();
int bin_dim = binaryImage->GetNumberOfDimensions();
// CheckBox for "All"
if (actor->IsVisible()) mNumberOfVisibleROI++;
if (actor->IsContourVisible()) mNumberOfVisibleContourROI++;
-
+ AllVisibleContourROIToggled(true);
+
// Add ROI in tree
mTreeWidgetList.push_back(QSharedPointer<QTreeWidgetItem>(new QTreeWidgetItem(mTree)));
QTreeWidgetItem * w = mTreeWidgetList.back().data();
//------------------------------------------------------------------------------
void vvToolROIManager::UpdateAllContours()
-{
+{ //out << __func__ << endl;
if (mCurrentSlicerManager == NULL) return;
// Render loaded ROIs (the first is sufficient)
for(unsigned int i=0; i<mROIList.size(); i++) {
//------------------------------------------------------------------------------
-void vvToolROIManager::UpdateAllROIStatus() {
+void vvToolROIManager::UpdateAllROIStatus()
+{ //out << __func__ << endl;
int nbVisible = 0;
int nb = mROIList.size();
for(int i=0; i<nb; i++) {
//------------------------------------------------------------------------------
-void vvToolROIManager::SelectedItemChangedInTree() {
+void vvToolROIManager::SelectedItemChangedInTree()
+{ //out << __func__ << endl;
// Search which roi is selected
QList<QTreeWidgetItem *> l = mTree->selectedItems();
if (l.size() == 0) {
//------------------------------------------------------------------------------
-void vvToolROIManager::VisibleROIToggled(bool b) {
+void vvToolROIManager::VisibleROIToggled(bool b)
+{ //out << __func__ << endl;
if (mCurrentROIActor == NULL) return;
if (b == mCurrentROIActor->IsVisible()) return; // nothing to do
mCurrentROIActor->SetVisible(b);
//------------------------------------------------------------------------------
-void vvToolROIManager::VisibleContourROIToggled(bool b) {
+void vvToolROIManager::VisibleContourROIToggled(bool b)
+{ //out << __func__ << endl;
if (mCurrentROIActor == NULL) return;
if (mCurrentROIActor->IsContourVisible() == b) return; // nothing to do
mCurrentROIActor->SetContourVisible(b);
//------------------------------------------------------------------------------
-void vvToolROIManager::OpacityChanged(int v) {
+void vvToolROIManager::OpacityChanged(int v)
+{ //out << __func__ << endl;
if (mCurrentROIActor == NULL) return;
mCurrentROIActor->SetOpacity((double)v/100.0);
mCurrentROIActor->UpdateColor();
//------------------------------------------------------------------------------
-void vvToolROIManager::AllVisibleROIToggled(int b) {
+void vvToolROIManager::AllVisibleROIToggled(int b)
+{ //out << __func__ << endl;
bool status = false;
if ((mCheckBoxShowAll->checkState() == Qt::Checked) ||
(mCheckBoxShowAll->checkState() == Qt::PartiallyChecked)) status = true;
//------------------------------------------------------------------------------
-void vvToolROIManager::AllVisibleContourROIToggled(bool b) {
+void vvToolROIManager::AllVisibleContourROIToggled(bool b)
+{ //out << __func__ << endl;
bool status = false;
if ((mContourCheckBoxShowAll->checkState() == Qt::Checked) ||
(mContourCheckBoxShowAll->checkState() == Qt::PartiallyChecked)) status = true;
//------------------------------------------------------------------------------
-void vvToolROIManager::ChangeColor() {
+void vvToolROIManager::ChangeColor()
+{ //out << __func__ << endl;
if (mCurrentROIActor == NULL) return;
QColor color;
color.setRgbF(mCurrentROIActor->GetROI()->GetDisplayColor()[0],
//------------------------------------------------------------------------------
-void vvToolROIManager::ChangeContourColor() {
+void vvToolROIManager::ChangeContourColor()
+{ //out << __func__ << endl;
if (mCurrentROIActor == NULL) return;
QColor color;
color.setRgbF(mCurrentROIActor->GetContourColor()[0],
//------------------------------------------------------------------------------
-void vvToolROIManager::ChangeContourWidth(int n) {
+void vvToolROIManager::ChangeContourWidth(int n)
+{ //out << __func__ << endl;
if (mCurrentROIActor == NULL) return;
mCurrentROIActor->SetContourWidth(n);
mCurrentROIActor->UpdateColor();
//------------------------------------------------------------------------------
-void vvToolROIManager::ChangeDepth(int n) {
+void vvToolROIManager::ChangeDepth(int n)
+{ //out << __func__ << endl;
if (mCurrentROIActor == NULL) return;
mCurrentROIActor->SetDepth(n);
// mCurrentROIActor->UpdateImage(); // FIXME
//------------------------------------------------------------------------------
-void vvToolROIManager::ReloadCurrentROI() {
+void vvToolROIManager::ReloadCurrentROI()
+{ //out << __func__ << endl;
if (mCurrentROI->GetFilename() == "") {
return; // do nothing (contour from rt struct do not reload)
}
//------------------------------------------------------------------------------
void vvToolROIManager::SaveState(std::auto_ptr<QXmlStreamWriter> & m_XmlWriter)
-{
+{ //out << __func__ << endl;
// Get index of the image
int n = mMainWindow->GetSlicerManagers().size();
int index=-1;
//------------------------------------------------------------------------------
void vvToolROIManager::ReadXMLInformation()
-{
+{ //out << __func__ << endl;
std::string value="";
mInitialImageIndex = -1;
while (!(m_XmlReader->isEndElement() && value == GetToolName().toStdString())) {
//------------------------------------------------------------------------------
void vvToolROIManager::ReadXMLInformation_ROI()
-{
+{ //out << __func__ << endl;
QString s;
std::string value="";
QSharedPointer<vvROIActor> param = QSharedPointer<vvROIActor>(new vvROIActor);