From 796954f9fff960cee1599e5a8960e0f424931900 Mon Sep 17 00:00:00 2001 From: tbaudier Date: Fri, 24 Nov 2017 16:27:25 +0100 Subject: [PATCH] Update README --- README.md | 53 -------------------- common/clitkDicomRTStruct2ImageFilter.cxx | 6 ++- common/clitkDicomRTStruct2ImageFilter.h | 2 + common/clitkDicomRT_Contour.cxx | 19 +++++++ common/clitkDicomRT_Contour.h | 3 ++ common/clitkDicomRT_ROI.cxx | 12 ++++- common/clitkDicomRT_ROI.h | 4 ++ common/clitkDicomRT_StructureSet.cxx | 9 ++++ common/clitkDicomRT_StructureSet.h | 5 ++ vv/vvBinaryImageOverlayActor.cxx | 43 ++++++++++++---- vv/vvBinaryImageOverlayActor.h | 4 ++ vv/vvROIActor.cxx | 13 +++-- vv/vvROIActor.h | 2 +- vv/vvToolROIManager.cxx | 61 ++++++++++++----------- 14 files changed, 133 insertions(+), 103 deletions(-) diff --git a/README.md b/README.md index 0e1ef10..a657222 100644 --- a/README.md +++ b/README.md @@ -10,56 +10,3 @@ You can download the binaries here: - [Linux 64bits](https://www.creatis.insa-lyon.fr/rio/vv?action=AttachFile&do=get&target=vv-1.4Qt4-linux64) - [Windows 32bits](https://www.creatis.insa-lyon.fr/rio/vv?action=AttachFile&do=get&target=vv-1.4Qt4-win32.zip) - [Windows 64bits](https://www.creatis.insa-lyon.fr/rio/vv?action=AttachFile&do=get&target=vv-1.4Qt4-win64.zip) - -### Installation -To install vv with Linux (e.g.: OpenSuse 42.2), follow the instructions: - -#### Qt -Install Qt5-devel and widget development library (Designer, Xml, Tools, Gui, Network, OpenGL, ...) with your package manager (e.g.: Yast) - -#### VTK -mkdir vtk -cd vtk -mkdir src -git clone https://github.com/Kitware/VTK.git src -cd src -git checkout tags/v7.0.0 -cd .. -mkdir bin -cd bin -ccmake ../src (use t to toggle, c to configure and g to generate) -Be sure to set (in toogle mode): - - Module_vtkGUISuppotQt to ON - - Module_vtkGUISuppotQtOpenGL to ON - - Module_vtkRenderingQt to ON - - Module_vtkViewQt to ON - - VTK_QT_VERSION to 5 - - VTK_RENDERING_BACKEND to OpenGL - - All Qt5... DIR to /usr/local/Qt-5.../lib/cmake/QT5... -make -cd ../.. - -#### ITK -mkdir itk -cd itk -mkdir src -git clone https://github.com/InsightSoftwareConsortium/ITK.git src -mkdir bin -ccmake ../src -Be sure to set (in toogle mode): - - Module_ITKReview to ON - - Module_ITKVtkGlue to ON - - BUILD_SHARED_LIBS to ON -make -cd ../.. - -#### vv -mkdir vv -cd vv -mkdir src -git clone https://github.com/open-vv/vv.git src -mkdir bin -ccmake ../src -Be sure to set (the correct paths to Qt5 and ITK) -make -cd ../.. diff --git a/common/clitkDicomRTStruct2ImageFilter.cxx b/common/clitkDicomRTStruct2ImageFilter.cxx index bf515a4..bf4d4c4 100644 --- a/common/clitkDicomRTStruct2ImageFilter.cxx +++ b/common/clitkDicomRTStruct2ImageFilter.cxx @@ -103,6 +103,7 @@ void clitk::DicomRTStruct2ImageFilter::SetImage(vvImage::Pointer image) mOrigin.resize(3); mSize.resize(3); mDirection.resize(3); + mTransformMatrix = image->GetTransform()[0]->GetMatrix(); for(unsigned int i=0; i<3; i++) { mSpacing[i] = image->GetSpacing()[i]; mOrigin[i] = image->GetOrigin()[i]; @@ -179,7 +180,7 @@ void clitk::DicomRTStruct2ImageFilter::Update() } // Get Mesh - vtkPolyData * mesh = mROI->GetMesh(); + vtkPolyData * mesh = mROI->GetMesh(); // Get bounds double *bounds=mesh->GetBounds(); @@ -229,7 +230,6 @@ void clitk::DicomRTStruct2ImageFilter::Update() extend[0] = ceil((bounds[1]-origin[0])/mSpacing[0]+4); extend[1] = ceil((bounds[3]-origin[1])/mSpacing[1]+4); extend[2] = ceil((bounds[5]-origin[2])/mSpacing[2]+4); - // If no crop, set initial image size/origin if (!mCropMask) { for(int i=0; i<3; i++) { @@ -238,6 +238,8 @@ void clitk::DicomRTStruct2ImageFilter::Update() } } +std::cout << "origin " << origin[0] << " " << origin[1] << " " << origin[2] << std::endl; +std::cout << "extend " << extend[0] << " " << extend[1] << " " << extend[2] << std::endl; // Create new output image mBinaryImage = vtkSmartPointer::New(); #if VTK_MAJOR_VERSION <= 5 diff --git a/common/clitkDicomRTStruct2ImageFilter.h b/common/clitkDicomRTStruct2ImageFilter.h index 4943818..96de26d 100644 --- a/common/clitkDicomRTStruct2ImageFilter.h +++ b/common/clitkDicomRTStruct2ImageFilter.h @@ -23,6 +23,7 @@ #include "clitkDicomRT_ROI.h" #include "clitkImageCommon.h" #include +#include #include #include @@ -58,6 +59,7 @@ namespace clitk { std::vector mOrigin; std::vector mSize; std::vector< std::vector< double> > mDirection; + vtkSmartPointer mTransformMatrix; clitk::DicomRT_ROI * mROI; vtkSmartPointer mBinaryImage; }; diff --git a/common/clitkDicomRT_Contour.cxx b/common/clitkDicomRT_Contour.cxx index 7fc7111..4bd4598 100644 --- a/common/clitkDicomRT_Contour.cxx +++ b/common/clitkDicomRT_Contour.cxx @@ -253,6 +253,14 @@ void clitk::DicomRT_Contour::SetMesh(vtkPolyData * mesh) //-------------------------------------------------------------------- +//-------------------------------------------------------------------- +void clitk::DicomRT_Contour::SetTransformMatrix(vtkMatrix4x4* matrix) +{ + mTransformMatrix = matrix; +} +//-------------------------------------------------------------------- + + //-------------------------------------------------------------------- void clitk::DicomRT_Contour::ComputeMeshFromDataPoints() { @@ -263,13 +271,24 @@ void clitk::DicomRT_Contour::ComputeMeshFromDataPoints() mMesh->SetPoints(mPoints); vtkIdType ids[2]; for (unsigned int idx=0 ; idxGetPoint(idx)[j]; + pointIn[4] = 1.0; + /*mTransformMatrix->MultiplyPoint(pointIn, pointOut); + std::cout << pointOut[0] << " " << pointOut[1] << " " << pointOut[2] << " " << pointOut[3] << std::endl; + mMesh->GetPoints()->InsertNextPoint(pointOut[0], + pointOut[1], + pointOut[2]);*/ mMesh->GetPoints()->InsertNextPoint(mData->GetPoint(idx)[0], mData->GetPoint(idx)[1], mData->GetPoint(idx)[2]); + //std::cout << mData->GetPoint(idx)[0] << " " << mData->GetPoint(idx)[1] << " " << mData->GetPoint(idx)[2] << std::endl; ids[0]=idx; ids[1]=(ids[0]+1) % mNbOfPoints; //0-1,1-2,...,n-1-0 mMesh->GetLines()->InsertNextCell(2,ids); } + //std::cout << std::endl; mMeshIsUpToDate = true; } //-------------------------------------------------------------------- diff --git a/common/clitkDicomRT_Contour.h b/common/clitkDicomRT_Contour.h index 78a5bfd..077599f 100644 --- a/common/clitkDicomRT_Contour.h +++ b/common/clitkDicomRT_Contour.h @@ -30,6 +30,7 @@ #include #include #include +#include namespace clitk { @@ -54,6 +55,7 @@ public: void SetMesh(vtkPolyData * mesh); vtkPoints * GetPoints() {return mData;} double GetZ() const {return mZ;} + void SetTransformMatrix(vtkMatrix4x4* matrix); protected: @@ -64,6 +66,7 @@ protected: vtkSmartPointer mData; vtkSmartPointer mMesh; vtkSmartPointer mPoints; + vtkSmartPointer mTransformMatrix; bool mMeshIsUpToDate; ///Z location of the contour double mZ; diff --git a/common/clitkDicomRT_ROI.cxx b/common/clitkDicomRT_ROI.cxx index b6af9c3..4135b31 100644 --- a/common/clitkDicomRT_ROI.cxx +++ b/common/clitkDicomRT_ROI.cxx @@ -211,6 +211,7 @@ bool clitk::DicomRT_ROI::Read(gdcm::Item * itemInfo, gdcm::Item * itemContour) { gdcm::Item & j = sqi2->GetItem(i+1); // Item start at #1 DicomRT_Contour::Pointer c = DicomRT_Contour::New(); + c->SetTransformMatrix(mTransformMatrix); bool b = c->Read(&j); if (b) { mListOfContours.push_back(c); @@ -237,6 +238,7 @@ void clitk::DicomRT_ROI::Read(std::map & rois, gdcm::SQItem * int i=0; for(gdcm::SQItem* j=contours->GetFirstSQItem(); j!=0; j=contours->GetNextSQItem()) { DicomRT_Contour::Pointer c = DicomRT_Contour::New(); + c->SetTransformMatrix(mTransformMatrix); bool b = c->Read(j); if (b) { mListOfContours.push_back(c); @@ -360,7 +362,6 @@ void clitk::DicomRT_ROI::SetFromBinaryImage(vvImage::Pointer image, int n, std::vector color, std::string filename) { - // ROI number [Referenced ROI Number] mNumber = n; @@ -388,6 +389,14 @@ vvImage * clitk::DicomRT_ROI::GetImage() const //-------------------------------------------------------------------- +//-------------------------------------------------------------------- +void clitk::DicomRT_ROI::SetTransformMatrix(vtkMatrix4x4* matrix) +{ + mTransformMatrix = matrix; +} +//-------------------------------------------------------------------- + + //-------------------------------------------------------------------- void clitk::DicomRT_ROI::ComputeContoursFromImage() { @@ -519,6 +528,7 @@ void clitk::DicomRT_ROI::Read(vtkSmartPointer & reader, i // Get the contour mMesh = reader->GetOutput(roiindex); DicomRT_Contour::Pointer c = DicomRT_Contour::New(); + c->SetTransformMatrix(mTransformMatrix); c->SetMesh(mMesh); // FIXME no GetZ, not GetPoints mMeshIsUpToDate = true; mListOfContours.push_back(c); diff --git a/common/clitkDicomRT_ROI.h b/common/clitkDicomRT_ROI.h index 80cbacc..ec43538 100644 --- a/common/clitkDicomRT_ROI.h +++ b/common/clitkDicomRT_ROI.h @@ -23,6 +23,7 @@ #include "clitkDicomRT_Contour.h" #include "vvImage.h" +#include #include "clitkConfiguration.h" #if CLITK_USE_SYSTEM_GDCM == 1 #include @@ -66,6 +67,8 @@ public: void SetImage(vvImage::Pointer im); DicomRT_Contour* GetContour(int n); + void SetTransformMatrix(vtkMatrix4x4* matrix); + // Compute a vtk mesh from the dicom contours void ComputeMeshFromContour(); void ComputeContoursFromImage(); @@ -94,6 +97,7 @@ protected: std::vector mColor; std::vector mListOfContours; vtkSmartPointer mMesh; + vtkSmartPointer mTransformMatrix; bool mMeshIsUpToDate; vvImage::Pointer mImage; double mBackgroundValue; diff --git a/common/clitkDicomRT_StructureSet.cxx b/common/clitkDicomRT_StructureSet.cxx index 9fa96b3..49d90bd 100644 --- a/common/clitkDicomRT_StructureSet.cxx +++ b/common/clitkDicomRT_StructureSet.cxx @@ -91,6 +91,14 @@ const std::string & clitk::DicomRT_StructureSet::GetDate() const //-------------------------------------------------------------------- +//-------------------------------------------------------------------- +void clitk::DicomRT_StructureSet::SetTransformMatrix(vtkMatrix4x4* matrix) +{ + mTransformMatrix = matrix; +} +//-------------------------------------------------------------------- + + //-------------------------------------------------------------------- const std::string & clitk::DicomRT_StructureSet::GetTime() const { @@ -439,6 +447,7 @@ void clitk::DicomRT_StructureSet::Read(const std::string & filename) int nb = i->first;//ReadROINumber(i);//mROIIndex[i]; // Create the roi mROIs[nb] = DicomRT_ROI::New(); + mROIs[nb]->SetTransformMatrix(mTransformMatrix); mROIs[nb]->Read(mMapOfROIInfo[nb], mMapOfROIContours[nb]); } diff --git a/common/clitkDicomRT_StructureSet.h b/common/clitkDicomRT_StructureSet.h index c26122e..7932051 100644 --- a/common/clitkDicomRT_StructureSet.h +++ b/common/clitkDicomRT_StructureSet.h @@ -24,6 +24,9 @@ #include "clitkCommon.h" #include "clitkDicomRT_ROI.h" +//vtk +#include "vtkMatrix4x4.h" + // vv #include "vvImage.h" @@ -58,6 +61,7 @@ public: void Print(std::ostream & os = std::cout) const; void Read(const std::string & filename); + void SetTransformMatrix(vtkMatrix4x4* matrix); bool IsDicomRTStruct(const std::string & filename); void Write(const std::string & filename); @@ -90,6 +94,7 @@ protected: std::string mName; std::string mDate; std::string mTime; + vtkSmartPointer mTransformMatrix; std::map mROIs; std::map mMapOfROIName; diff --git a/vv/vvBinaryImageOverlayActor.cxx b/vv/vvBinaryImageOverlayActor.cxx index b5935c3..5068887 100644 --- a/vv/vvBinaryImageOverlayActor.cxx +++ b/vv/vvBinaryImageOverlayActor.cxx @@ -110,22 +110,45 @@ void vvBinaryImageOverlayActor::Initialize(bool IsVisible) // Create an actor for each time slice for (unsigned int numImage = 0; numImage < mSlicer->GetImage()->GetVTKImages().size(); numImage++) { // how many intensity ? - vtkSmartPointer mOverlayMapper = vtkSmartPointer::New(); - if (mImage->IsTimeSequence()) - { - #if VTK_MAJOR_VERSION <= 5 - mOverlayMapper->SetInput(mImage->GetVTKImages()[numImage]); + + + + if (!mFusionReslice) { + mFusionReslice = vtkSmartPointer::New(); + mFusionReslice->SetInterpolationModeToLinear(); + mFusionReslice->AutoCropOutputOn(); + mFusionReslice->SetBackgroundColor(-1000,-1000,-1000,1); + } + + mConcatenatedFusionTransform->Identity(); + mConcatenatedFusionTransform->Concatenate(mImage->GetTransform()[0]); + mConcatenatedFusionTransform->Concatenate(mSlicer->GetSlicingTransform()); + mFusionReslice->SetResliceAxes(mConcatenatedFusionTransform->GetMatrix()); + if (mImage->IsTimeSequence()) { +#if VTK_MAJOR_VERSION <= 5 + mFusionReslice->SetInput(0, mImage->GetVTKImages()[numImage]); + mFusionReslice->UpdateInformation(); #else - mOverlayMapper->SetInputData(mImage->GetVTKImages()[numImage]); + mFusionReslice->SetInputData(0, mImage->GetVTKImages()[numImage]); #endif - } - else { + } else { #if VTK_MAJOR_VERSION <= 5 - mOverlayMapper->SetInput(mImage->GetVTKImages()[0]); + mFusionReslice->SetInput(0, mImage->GetVTKImages()[0]); + mFusionReslice->UpdateInformation(); #else - mOverlayMapper->SetInputData(mImage->GetVTKImages()[0]); + mFusionReslice->SetInputData(0, mImage->GetVTKImages()[0]); #endif } + mFusionReslice->Update(); + + + + vtkSmartPointer mOverlayMapper = vtkSmartPointer::New(); +#if VTK_MAJOR_VERSION <= 5 + mOverlayMapper->SetInput(mFusionReslice->GetOutput()); +#else + mOverlayMapper->SetInputConnection(mFusionReslice->GetOutputPort(0)); +#endif double range[2]; if (mImage->IsTimeSequence()) diff --git a/vv/vvBinaryImageOverlayActor.h b/vv/vvBinaryImageOverlayActor.h index 9559bc7..2e575c3 100644 --- a/vv/vvBinaryImageOverlayActor.h +++ b/vv/vvBinaryImageOverlayActor.h @@ -27,6 +27,8 @@ class vtkActor; class vvImage; class vtkImageMapToRGBA; class vtkImageActor; +class vtkImageReslice; +class vtkTransform; //------------------------------------------------------------------------------ class vvBinaryImageOverlayActor : public itk::LightObject @@ -66,6 +68,8 @@ class vvBinaryImageOverlayActor : public itk::LightObject std::vector > mMapperList; std::vector > mImageActorList; + vtkSmartPointer mFusionReslice; + vtkSmartPointer mConcatenatedFusionTransform; void ComputeExtent(int orientation, int slice, diff --git a/vv/vvROIActor.cxx b/vv/vvROIActor.cxx index 4e1a9dc..d6f5089 100644 --- a/vv/vvROIActor.cxx +++ b/vv/vvROIActor.cxx @@ -185,12 +185,11 @@ void vvROIActor::Initialize(double depth, bool IsVisible) mOverlayActors.push_back(vvBinaryImageOverlayActor::New()); // BG or FG - if (m_modeBG) { - mOverlayActors[i]->SetImage(mROI->GetImage(), mROI->GetBackgroundValueLabelImage()); - } - else { - mOverlayActors[i]->SetImage(mROI->GetImage(), mROI->GetForegroundValueLabelImage(), false); - } + if (m_modeBG) + mOverlayActors[i]->SetImage(mROI->GetImage(), mROI->GetBackgroundValueLabelImage()); + else + mOverlayActors[i]->SetImage(mROI->GetImage(), mROI->GetForegroundValueLabelImage(), false); + mOverlayActors[i]->SetColor(mROI->GetDisplayColor()[0], @@ -236,7 +235,7 @@ void vvROIActor::Update(bool force) //------------------------------------------------------------------------------ void vvROIActor::UpdateSlice(int slicer, int slices, int force) -{ +{ if (!mROI->GetImage()) return; if ((!mIsVisible) && (!mIsContourVisible)) return; if (!mSlicerManager) { diff --git a/vv/vvROIActor.h b/vv/vvROIActor.h index 04c9029..799d339 100644 --- a/vv/vvROIActor.h +++ b/vv/vvROIActor.h @@ -70,7 +70,7 @@ public slots: vvSlicerManager * mSlicerManager; std::vector mImageContour; std::vector< vvBinaryImageOverlayActor::Pointer > mOverlayActors; - + bool mIsVisible; bool mIsContourVisible; double mOpacity; diff --git a/vv/vvToolROIManager.cxx b/vv/vvToolROIManager.cxx index 4c2832e..00eff1d 100644 --- a/vv/vvToolROIManager.cxx +++ b/vv/vvToolROIManager.cxx @@ -55,7 +55,7 @@ vvToolROIManager::vvToolROIManager(vvMainWindowBase * parent, Qt::WindowFlags f) QWidget(parent->GetTab()), vvToolBase(parent), Ui::vvToolROIManager() -{ +{ // Store parent mMainWindow = parent; @@ -95,7 +95,7 @@ vvToolROIManager::vvToolROIManager(vvMainWindowBase * parent, Qt::WindowFlags f) //------------------------------------------------------------------------------ vvToolROIManager::~vvToolROIManager() -{ +{ mROIActorsList.clear(); } //------------------------------------------------------------------------------ @@ -104,7 +104,7 @@ vvToolROIManager::~vvToolROIManager() //------------------------------------------------------------------------------ // STATIC void vvToolROIManager::Initialize() -{ +{ SetToolName("ROIManager"); SetToolMenuName("Open ROI (binary image or RT-STRUCT)"); SetToolIconFilename(":/common/icons/tool-roi.png"); @@ -117,7 +117,7 @@ void vvToolROIManager::Initialize() //------------------------------------------------------------------------------ void vvToolROIManager::InitializeNewTool(bool ReadStateFlag) -{ +{ // 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 @@ -224,7 +224,7 @@ void vvToolROIManager::InitializeNewTool(bool ReadStateFlag) //------------------------------------------------------------------------------ void vvToolROIManager::InputIsSelected(vvSlicerManager *m) -{ +{ // Initialization mCurrentSlicerManager = m; mCurrentImage = mCurrentSlicerManager->GetImage(); @@ -240,7 +240,7 @@ void vvToolROIManager::InputIsSelected(vvSlicerManager *m) //------------------------------------------------------------------------------ void vvToolROIManager::AnImageIsBeingClosed(vvSlicerManager * m) -{ +{ if (m == mCurrentSlicerManager) { close(); return; @@ -249,7 +249,7 @@ void vvToolROIManager::AnImageIsBeingClosed(vvSlicerManager * m) //------------------------------------------------------------------------------ void vvToolROIManager::RemoveROI() -{ +{ // Search the indice of the selected ROI QList l = mTree->selectedItems(); @@ -288,7 +288,7 @@ void vvToolROIManager::RemoveROI() //------------------------------------------------------------------------------ void vvToolROIManager::close() -{ +{ 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))); @@ -315,7 +315,7 @@ void vvToolROIManager::close() //------------------------------------------------------------------------------ void vvToolROIManager::SelectedImageHasChanged(vvSlicerManager * m) -{ +{ if (mCurrentSlicerManager == NULL) return; if (m == NULL) return; if (m != mCurrentSlicerManager) hide(); @@ -328,7 +328,7 @@ void vvToolROIManager::SelectedImageHasChanged(vvSlicerManager * m) //------------------------------------------------------------------------------ void vvToolROIManager::Open() -{ +{ // Open images QString Extensions = "Images or Dicom-Struct files ( *.mha *.mhd *.hdr *.his *.dcm RS*)"; Extensions += ";;All Files (*)"; @@ -349,7 +349,7 @@ void vvToolROIManager::Open() //------------------------------------------------------------------------------ void vvToolROIManager::OpenBinaryImage(QStringList & filename) -{ +{ if (filename.size() == 0) return; vvProgressDialog p("Reading ROI ...", true); @@ -393,7 +393,7 @@ void vvToolROIManager::OpenBinaryImage(QStringList & filename) //------------------------------------------------------------------------------ void vvToolROIManager::OpenDicomImage(std::string filename) -{ +{ // GUI selector of roi vvMeshReader reader; reader.SetFilename(filename); @@ -409,6 +409,9 @@ void vvToolROIManager::OpenDicomImage(std::string filename) // Read information clitk::DicomRT_StructureSet::Pointer s = clitk::DicomRT_StructureSet::New(); + vtkSmartPointer transformMatrix = vtkSmartPointer::New(); + transformMatrix = mCurrentImage->GetTransform()[0]->GetMatrix(); + s->SetTransformMatrix(transformMatrix); s->Read(filename); // Loop on selected struct @@ -445,7 +448,7 @@ void vvToolROIManager::AddImage(vvImage * binaryImage, std::string name, std::string filename, double BG, bool modeBG) -{ +{ // Check Dimension int dim = mCurrentImage->GetNumberOfDimensions(); int bin_dim = binaryImage->GetNumberOfDimensions(); @@ -547,7 +550,7 @@ void vvToolROIManager::AddImage(vvImage * binaryImage, //------------------------------------------------------------------------------ void vvToolROIManager::UpdateAllContours() -{ +{ if (mCurrentSlicerManager == NULL) return; // Render loaded ROIs (the first is sufficient) for(unsigned int i=0; i l = mTree->selectedItems(); if (l.size() == 0) { @@ -679,7 +682,7 @@ void vvToolROIManager::SelectedItemChangedInTree() //------------------------------------------------------------------------------ void vvToolROIManager::VisibleROIToggled(bool b) -{ +{ if (mCurrentROIActor == NULL) return; if (b == mCurrentROIActor->IsVisible()) return; // nothing to do mCurrentROIActor->SetVisible(b); @@ -691,7 +694,7 @@ void vvToolROIManager::VisibleROIToggled(bool b) //------------------------------------------------------------------------------ void vvToolROIManager::VisibleContourROIToggled(bool b) -{ +{ if (mCurrentROIActor == NULL) return; if (mCurrentROIActor->IsContourVisible() == b) return; // nothing to do mCurrentROIActor->SetContourVisible(b); @@ -704,7 +707,7 @@ void vvToolROIManager::VisibleContourROIToggled(bool b) //------------------------------------------------------------------------------ void vvToolROIManager::OpacityChanged(int v) -{ +{ if (mCurrentROIActor == NULL) return; mCurrentROIActor->SetOpacity((double)v/100.0); mCurrentROIActor->UpdateColor(); @@ -715,7 +718,7 @@ void vvToolROIManager::OpacityChanged(int v) //------------------------------------------------------------------------------ void vvToolROIManager::AllVisibleROIToggled(int b) -{ +{ disconnect(mCheckBoxShowAll, SIGNAL(stateChanged(int)), this, SLOT(AllVisibleROIToggled(int))); bool status = false; if ((mCheckBoxShowAll->checkState() == Qt::Checked) || @@ -735,7 +738,7 @@ void vvToolROIManager::AllVisibleROIToggled(int b) //------------------------------------------------------------------------------ void vvToolROIManager::AllVisibleContourROIToggled(int b) -{ +{ disconnect(mContourCheckBoxShowAll, SIGNAL(stateChanged(int)), this, SLOT(AllVisibleContourROIToggled(int))); bool status = false; if ((mContourCheckBoxShowAll->checkState() == Qt::Checked) || @@ -756,7 +759,7 @@ void vvToolROIManager::AllVisibleContourROIToggled(int b) //------------------------------------------------------------------------------ void vvToolROIManager::ChangeColor() -{ +{ if (mCurrentROIActor == NULL) return; QColor color; color.setRgbF(mCurrentROIActor->GetROI()->GetDisplayColor()[0], @@ -782,7 +785,7 @@ void vvToolROIManager::ChangeColor() //------------------------------------------------------------------------------ void vvToolROIManager::ChangeContourColor() -{ +{ if (mCurrentROIActor == NULL) return; QColor color; color.setRgbF(mCurrentROIActor->GetContourColor()[0], @@ -800,7 +803,7 @@ void vvToolROIManager::ChangeContourColor() //------------------------------------------------------------------------------ void vvToolROIManager::ChangeContourWidth(int n) -{ +{ if (mCurrentROIActor == NULL) return; mCurrentROIActor->SetContourWidth(n); mCurrentROIActor->UpdateColor(); @@ -811,7 +814,7 @@ void vvToolROIManager::ChangeContourWidth(int n) //------------------------------------------------------------------------------ void vvToolROIManager::ChangeDepth(int n) -{ +{ if (mCurrentROIActor == NULL) return; mCurrentROIActor->SetDepth(n); // mCurrentROIActor->UpdateImage(); // FIXME @@ -825,7 +828,7 @@ void vvToolROIManager::ChangeDepth(int n) //------------------------------------------------------------------------------ void vvToolROIManager::ReloadCurrentROI() -{ +{ if (mCurrentROI->GetFilename() == "") { return; // do nothing (contour from rt struct do not reload) } @@ -870,7 +873,7 @@ void vvToolROIManager::SaveState(std::shared_ptr & m_XmlWrite #else void vvToolROIManager::SaveState(std::auto_ptr & m_XmlWriter) #endif -{ +{ // Get index of the image int n = mMainWindow->GetSlicerManagers().size(); int index=-1; @@ -916,7 +919,7 @@ void vvToolROIManager::SaveState(std::auto_ptr & m_XmlWriter) //------------------------------------------------------------------------------ void vvToolROIManager::ReadXMLInformation() -{ +{ std::string value=""; mInitialImageIndex = -1; while (!(m_XmlReader->isEndElement() && value == GetToolName().toStdString())) { @@ -938,7 +941,7 @@ void vvToolROIManager::ReadXMLInformation() //------------------------------------------------------------------------------ void vvToolROIManager::ReadXMLInformation_ROI() -{ +{ QString s; std::string value=""; QSharedPointer param = QSharedPointer(new vvROIActor); -- 2.45.1