X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=vv%2FvvToolROIManager.cxx;h=ef83846510c33683d403359b41169ec11456dee3;hb=f76d7667542120705849be390807ef223061fad1;hp=c86b4b2018fa89496b042f7780a5b6948e03039c;hpb=3a823a03d4a2217e41e4dd3b05a8ea825bb762a5;p=clitk.git diff --git a/vv/vvToolROIManager.cxx b/vv/vvToolROIManager.cxx index c86b4b2..ef83846 100644 --- a/vv/vvToolROIManager.cxx +++ b/vv/vvToolROIManager.cxx @@ -22,7 +22,6 @@ #include "vvImageWriter.h" #include "vvROIActor.h" #include "vvSlicer.h" -#include "vvROIActor.h" #include "vvMeshReader.h" #include "vvStructSelector.h" #include "vvToolManager.h" @@ -54,7 +53,7 @@ vvToolROIManager::vvToolROIManager(vvMainWindowBase * parent, Qt::WindowFlags f) QWidget(parent->GetTab()), vvToolBase(parent), Ui::vvToolROIManager() -{ +{ //out << __func__ << endl; // Store parent mMainWindow = parent; @@ -94,7 +93,7 @@ vvToolROIManager::vvToolROIManager(vvMainWindowBase * parent, Qt::WindowFlags f) //------------------------------------------------------------------------------ vvToolROIManager::~vvToolROIManager() -{ +{ //out << __func__ << endl; mROIActorsList.clear(); } //------------------------------------------------------------------------------ @@ -102,7 +101,8 @@ vvToolROIManager::~vvToolROIManager() //------------------------------------------------------------------------------ // 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"); @@ -115,7 +115,7 @@ void vvToolROIManager::Initialize() { //------------------------------------------------------------------------------ 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 @@ -221,7 +221,7 @@ void vvToolROIManager::InitializeNewTool(bool ReadStateFlag) //------------------------------------------------------------------------------ void vvToolROIManager::InputIsSelected(vvSlicerManager *m) -{ +{ //out << __func__ << endl; // Initialization mCurrentSlicerManager = m; mCurrentImage = mCurrentSlicerManager->GetImage(); @@ -244,7 +244,7 @@ void vvToolROIManager::InputIsSelected(vvSlicerManager *m) //------------------------------------------------------------------------------ void vvToolROIManager::AnImageIsBeingClosed(vvSlicerManager * m) -{ +{ //out << __func__ << endl; if (m == mCurrentSlicerManager) { close(); return; @@ -255,7 +255,7 @@ void vvToolROIManager::AnImageIsBeingClosed(vvSlicerManager * m) //------------------------------------------------------------------------------ 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))); @@ -280,8 +280,8 @@ void vvToolROIManager::close() //------------------------------------------------------------------------------ -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(); @@ -294,7 +294,7 @@ void vvToolROIManager::SelectedImageHasChanged(vvSlicerManager * m) { //------------------------------------------------------------------------------ void vvToolROIManager::Open() -{ +{ //out << __func__ << endl; // Open images QString Extensions = "Images or Dicom-Struct files ( *.mha *.mhd *.hdr *.his *.dcm RS*)"; Extensions += ";;All Files (*)"; @@ -315,7 +315,7 @@ void vvToolROIManager::Open() //------------------------------------------------------------------------------ void vvToolROIManager::OpenBinaryImage(QStringList & filename) -{ +{ //out << __func__ << endl; if (filename.size() == 0) return; vvProgressDialog p("Reading ROI ...", true); @@ -359,7 +359,7 @@ void vvToolROIManager::OpenBinaryImage(QStringList & filename) //------------------------------------------------------------------------------ void vvToolROIManager::OpenDicomImage(std::string filename) -{ +{ //out << __func__ << endl; // GUI selector of roi vvMeshReader reader; reader.SetFilename(filename); @@ -411,7 +411,7 @@ void vvToolROIManager::AddImage(vvImage * binaryImage, std::string name, std::string filename, double BG, bool modeBG) -{ +{ //out << __func__ << endl; // Check Dimension int dim = mCurrentImage->GetNumberOfDimensions(); int bin_dim = binaryImage->GetNumberOfDimensions(); @@ -467,7 +467,8 @@ void vvToolROIManager::AddImage(vvImage * binaryImage, // CheckBox for "All" if (actor->IsVisible()) mNumberOfVisibleROI++; if (actor->IsContourVisible()) mNumberOfVisibleContourROI++; - + AllVisibleContourROIToggled(true); + // Add ROI in tree mTreeWidgetList.push_back(QSharedPointer(new QTreeWidgetItem(mTree))); QTreeWidgetItem * w = mTreeWidgetList.back().data(); @@ -492,7 +493,7 @@ void vvToolROIManager::AddImage(vvImage * binaryImage, //------------------------------------------------------------------------------ void vvToolROIManager::UpdateAllContours() -{ +{ //out << __func__ << endl; if (mCurrentSlicerManager == NULL) return; // Render loaded ROIs (the first is sufficient) for(unsigned int i=0; i l = mTree->selectedItems(); if (l.size() == 0) { @@ -610,7 +613,8 @@ void vvToolROIManager::SelectedItemChangedInTree() { //------------------------------------------------------------------------------ -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); @@ -621,7 +625,8 @@ void vvToolROIManager::VisibleROIToggled(bool 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); @@ -632,7 +637,8 @@ void vvToolROIManager::VisibleContourROIToggled(bool 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(); @@ -642,7 +648,8 @@ void vvToolROIManager::OpacityChanged(int v) { //------------------------------------------------------------------------------ -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; @@ -659,7 +666,8 @@ void vvToolROIManager::AllVisibleROIToggled(int b) { //------------------------------------------------------------------------------ -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; @@ -677,7 +685,8 @@ void vvToolROIManager::AllVisibleContourROIToggled(bool b) { //------------------------------------------------------------------------------ -void vvToolROIManager::ChangeColor() { +void vvToolROIManager::ChangeColor() +{ //out << __func__ << endl; if (mCurrentROIActor == NULL) return; QColor color; color.setRgbF(mCurrentROIActor->GetROI()->GetDisplayColor()[0], @@ -702,7 +711,8 @@ void vvToolROIManager::ChangeColor() { //------------------------------------------------------------------------------ -void vvToolROIManager::ChangeContourColor() { +void vvToolROIManager::ChangeContourColor() +{ //out << __func__ << endl; if (mCurrentROIActor == NULL) return; QColor color; color.setRgbF(mCurrentROIActor->GetContourColor()[0], @@ -719,7 +729,8 @@ void vvToolROIManager::ChangeContourColor() { //------------------------------------------------------------------------------ -void vvToolROIManager::ChangeContourWidth(int n) { +void vvToolROIManager::ChangeContourWidth(int n) +{ //out << __func__ << endl; if (mCurrentROIActor == NULL) return; mCurrentROIActor->SetContourWidth(n); mCurrentROIActor->UpdateColor(); @@ -729,7 +740,8 @@ void vvToolROIManager::ChangeContourWidth(int n) { //------------------------------------------------------------------------------ -void vvToolROIManager::ChangeDepth(int n) { +void vvToolROIManager::ChangeDepth(int n) +{ //out << __func__ << endl; if (mCurrentROIActor == NULL) return; mCurrentROIActor->SetDepth(n); // mCurrentROIActor->UpdateImage(); // FIXME @@ -742,7 +754,8 @@ void vvToolROIManager::ChangeDepth(int n) { //------------------------------------------------------------------------------ -void vvToolROIManager::ReloadCurrentROI() { +void vvToolROIManager::ReloadCurrentROI() +{ //out << __func__ << endl; if (mCurrentROI->GetFilename() == "") { return; // do nothing (contour from rt struct do not reload) } @@ -783,7 +796,7 @@ void vvToolROIManager::ReloadCurrentROI() { //------------------------------------------------------------------------------ void vvToolROIManager::SaveState(std::auto_ptr & m_XmlWriter) -{ +{ //out << __func__ << endl; // Get index of the image int n = mMainWindow->GetSlicerManagers().size(); int index=-1; @@ -829,7 +842,7 @@ void vvToolROIManager::SaveState(std::auto_ptr & m_XmlWriter) //------------------------------------------------------------------------------ void vvToolROIManager::ReadXMLInformation() -{ +{ //out << __func__ << endl; std::string value=""; mInitialImageIndex = -1; while (!(m_XmlReader->isEndElement() && value == GetToolName().toStdString())) { @@ -851,7 +864,7 @@ void vvToolROIManager::ReadXMLInformation() //------------------------------------------------------------------------------ void vvToolROIManager::ReadXMLInformation_ROI() -{ +{ //out << __func__ << endl; QString s; std::string value=""; QSharedPointer param = QSharedPointer(new vvROIActor);