From: tbaudier Date: Wed, 25 Nov 2015 10:14:49 +0000 (+0100) Subject: Correct Bounds in Input Contour Mapper X-Git-Tag: v1.4.0~90^2~7 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=f05dd3a888120632345251a479e953e14a117a58;p=clitk.git Correct Bounds in Input Contour Mapper Change SetInputData to SetInputConnection The real-time display doesn't work yet --- diff --git a/vv/vvBinaryImageOverlayActor.cxx b/vv/vvBinaryImageOverlayActor.cxx index aa5cecc..74aabac 100644 --- a/vv/vvBinaryImageOverlayActor.cxx +++ b/vv/vvBinaryImageOverlayActor.cxx @@ -31,6 +31,7 @@ #include #include #include +#include //------------------------------------------------------------------------------ vvBinaryImageOverlayActor::vvBinaryImageOverlayActor() @@ -143,7 +144,7 @@ void vvBinaryImageOverlayActor::Initialize(bool IsVisible) #if VTK_MAJOR_VERSION <= 5 mOverlayActor->SetInput(mOverlayMapper->GetOutput()); #else - mOverlayActor->SetInputData(mOverlayMapper->GetOutput()); + mOverlayActor->GetMapper()->SetInputConnection(mOverlayMapper->GetOutputPort()); #endif mOverlayActor->SetPickable(0); mOverlayActor->SetVisibility(IsVisible); diff --git a/vv/vvImageContour.cxx b/vv/vvImageContour.cxx index e4ecfdf..a4b2a05 100644 --- a/vv/vvImageContour.cxx +++ b/vv/vvImageContour.cxx @@ -27,6 +27,7 @@ #include #include #include +#include //------------------------------------------------------------------------------ vvImageContour::vvImageContour() @@ -226,12 +227,12 @@ void vvImageContour::UpdateWithPreserveMemoryMode() vtkActor * mSquaresActor = mSquaresActorList[mTSlice]; int orientation = ComputeCurrentOrientation(); - //UpdateActor(mSquaresActor, mapper, mSquares, mClipper, mValue, orientation, mSlice); + UpdateActor(mSquaresActor, mapper, mSquares, mClipper, mValue, orientation, mSlice); if (mPreviousTslice != mTSlice) { if (mPreviousTslice != -1) mSquaresActorList[mPreviousTslice]->VisibilityOff(); } - + mSlicer->Render(); } //------------------------------------------------------------------------------ @@ -325,16 +326,13 @@ void vvImageContour::CreateNewActor(int numImage) clipper->SetInputData(mSlicer->GetImage()->GetVTKImages()[numImage]); #endif } -clipper->Update(); #if VTK_MAJOR_VERSION <= 5 squares->SetInput(clipper->GetOutput()); squaresMapper->SetInput(squares->GetOutput()); #else - squares->SetInputData(clipper->GetOutput()); - squaresMapper->SetInputData(squares->GetOutput()); + squares->SetInputConnection(clipper->GetOutputPort(0)); + squaresMapper->SetInputConnection(squares->GetOutputPort(0)); #endif -squares->Update(); -squaresMapper->Update(); squaresMapper->ScalarVisibilityOff(); squaresActor->SetMapper(squaresMapper); squaresActor->GetProperty()->SetColor(1.0,0,0); @@ -399,9 +397,7 @@ void vvImageContour::UpdateActor(vtkActor * actor, clipper->SetOutputWholeExtent(extent2[0],extent2[1],extent2[2], extent2[3],extent2[4],extent2[5]); - clipper->Update(); - clipper->Print(cout); - + if (mHiddenImageIsUsed) delete extent2; // Move the actor to be visible diff --git a/vv/vvMainWindow.cxx b/vv/vvMainWindow.cxx index 590f3dd..203d7f2 100644 --- a/vv/vvMainWindow.cxx +++ b/vv/vvMainWindow.cxx @@ -3659,7 +3659,6 @@ vvSlicerManager* vvMainWindow::AddImage(vvImage::Pointer image,std::string filen ShowLastImage(); InitDisplay(); qApp->processEvents(); - // End ImageInfoChanged(); return slicer_manager; diff --git a/vv/vvSlicer.cxx b/vv/vvSlicer.cxx index 317dc06..cfaaf5a 100644 --- a/vv/vvSlicer.cxx +++ b/vv/vvSlicer.cxx @@ -1748,7 +1748,6 @@ void vvSlicer::Render() } if (mLandMapper) UpdateLandmarks(); - this->GetRenderWindow()->Render(); } //---------------------------------------------------------------------------- diff --git a/vv/vvToolBinarize.cxx b/vv/vvToolBinarize.cxx index 6cb7518..9644b02 100644 --- a/vv/vvToolBinarize.cxx +++ b/vv/vvToolBinarize.cxx @@ -31,6 +31,7 @@ #include #include + //------------------------------------------------------------------------------ // Create the tool and automagically (I like this word) insert it in // the main window menu. @@ -96,7 +97,6 @@ void vvToolBinarize::InteractiveDisplayToggled(bool b) } else { for(unsigned int i=0; iShowActors(); - mImageContour[i]->Print(cout); if (mRadioButtonLowerThan->isChecked()) mImageContourLower[i]->ShowActors(); } @@ -221,7 +221,6 @@ void vvToolBinarize::InputIsSelected(vvSlicerManager * m) mImageContourLower[i]->SetSlicer(mCurrentSlicerManager->GetSlicer(i)); mImageContourLower[i]->SetColor(0.0, 0.0, 1.0); mImageContourLower[i]->SetDepth(100); // to be in front of (whe used with ROI tool) - mImageContour[i]->Print(cout); } valueChangedT1(mThresholdSlider1->GetValue()); @@ -234,7 +233,6 @@ void vvToolBinarize::InputIsSelected(vvSlicerManager * m) connect(mCurrentSlicerManager,SIGNAL(UpdateOrientation(int,int)),this,SLOT(UpdateOrientation(int, int))); // connect(mCurrentSlicerManager, SIGNAL(LeftButtonReleaseSignal(int)), SLOT(LeftButtonReleaseEvent(int))); - cout << mInteractiveDisplayIsEnabled << endl; InteractiveDisplayToggled(mInteractiveDisplayIsEnabled); } //------------------------------------------------------------------------------ @@ -336,8 +334,8 @@ void vvToolBinarize::apply() { cout << __func__ << endl; if (!mCurrentSlicerManager) close(); QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); - GetArgsInfoFromGUI(); - + GetArgsInfoFromGUI(); + // Main filter clitk::BinarizeImageGenericFilter::Pointer filter = clitk::BinarizeImageGenericFilter::New(); @@ -345,8 +343,9 @@ void vvToolBinarize::apply() filter->SetArgsInfo(mArgsInfo); filter->Update(); + // Output - vvImage::Pointer output = filter->GetOutputVVImage(); + vvImage::Pointer output = filter->GetOutputVVImage(); std::ostringstream osstream; osstream << "Binarized_" << mCurrentSlicerManager->GetSlicer(0)->GetFileName() << ".mhd"; AddImage(output,osstream.str()); diff --git a/vv/vvToolROIManager.cxx b/vv/vvToolROIManager.cxx index c86b4b2..dae901b 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(); @@ -492,7 +492,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 +612,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 +624,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 +636,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 +647,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 +665,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 +684,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 +710,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 +728,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 +739,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 +753,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 +795,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 +841,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 +863,7 @@ void vvToolROIManager::ReadXMLInformation() //------------------------------------------------------------------------------ void vvToolROIManager::ReadXMLInformation_ROI() -{ +{ //out << __func__ << endl; QString s; std::string value=""; QSharedPointer param = QSharedPointer(new vvROIActor); diff --git a/vv/vvToolWidgetBase.cxx b/vv/vvToolWidgetBase.cxx index 6abc741..6d89fcf 100644 --- a/vv/vvToolWidgetBase.cxx +++ b/vv/vvToolWidgetBase.cxx @@ -38,7 +38,7 @@ bool vvToolWidgetBase::mIsAnotherToolWaitInput = false; vvToolWidgetBase::vvToolWidgetBase(vvMainWindowBase * parent, Qt::WindowFlags f, bool initialize): QWidget(parent, f), Ui::vvToolWidgetBase() -{ +{ //out << __func__ << endl; mMainWindow = parent; setAttribute(Qt::WA_DeleteOnClose); if (initialize) Initialization(); @@ -116,7 +116,7 @@ vvToolWidgetBase::vvToolWidgetBase(vvMainWindowBase * parent, Qt::WindowFlags f, //------------------------------------------------------------------------------ void vvToolWidgetBase::Initialization() -{ +{ //out << __func__ << endl; mCurrentSlicerManager = 0; mIsInitialized = false; mFilter = 0; @@ -139,14 +139,14 @@ void vvToolWidgetBase::Initialization() //------------------------------------------------------------------------------ vvToolWidgetBase::~vvToolWidgetBase() -{ +{ //out << __func__ << endl; } //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ void vvToolWidgetBase::keyPressEvent(QKeyEvent *event) -{ +{ //out << __func__ << endl; if (event->key() == Qt::Key_Escape) { reject(); event->accept(); @@ -164,7 +164,7 @@ void vvToolWidgetBase::keyPressEvent(QKeyEvent *event) //------------------------------------------------------------------------------ void vvToolWidgetBase::accept() -{ +{ //out << __func__ << endl; apply(); } //------------------------------------------------------------------------------ @@ -172,7 +172,7 @@ void vvToolWidgetBase::accept() //------------------------------------------------------------------------------ void vvToolWidgetBase::reject() -{ +{ //out << __func__ << endl; close(); } //------------------------------------------------------------------------------ @@ -180,7 +180,7 @@ void vvToolWidgetBase::reject() //------------------------------------------------------------------------------ void vvToolWidgetBase::AddInputSelector(QString s, clitk::ImageToImageGenericFilterBase * f, bool allowSkip) -{ +{ //out << __func__ << endl; int j=0; mFilter = f; mSlicerManagersCompatible.clear(); @@ -219,7 +219,7 @@ void vvToolWidgetBase::AddInputSelector(QString s, clitk::ImageToImageGenericFil //------------------------------------------------------------------------------ void vvToolWidgetBase::AddInputSelector(QString s, bool allowSkip) -{ +{ //out << __func__ << endl; mSlicerManagersCompatible.clear(); for(unsigned int i=0; iGetSlicerManagers().size(); i++) { mSlicerManagersCompatible.push_back(mMainWindow->GetSlicerManagers()[i]); @@ -245,7 +245,7 @@ void vvToolWidgetBase::AddInputSelector(QString s, bool allowSkip) //------------------------------------------------------------------------------ void vvToolWidgetBase::HideInputSelector() -{ +{ //out << __func__ << endl; mToolInputSelectionWidget->hide(); } //------------------------------------------------------------------------------ @@ -253,7 +253,7 @@ void vvToolWidgetBase::HideInputSelector() //------------------------------------------------------------------------------ void vvToolWidgetBase::show() -{ +{ //out << __func__ << endl; if (!mIsInitialized) { mToolInputSelectionWidget->Initialize(); mIsInitialized = true; @@ -265,7 +265,7 @@ void vvToolWidgetBase::show() //------------------------------------------------------------------------------ void vvToolWidgetBase::closeEvent(QCloseEvent *event) -{ +{ //out << __func__ << endl; mIsAnotherToolWaitInput = false; if (isWindow()) { event->accept();//return QWidget::close(); @@ -292,7 +292,7 @@ void vvToolWidgetBase::closeEvent(QCloseEvent *event) //------------------------------------------------------------------------------ bool vvToolWidgetBase::close() -{ +{ //out << __func__ << endl; QApplication::restoreOverrideCursor(); return QWidget::close(); } @@ -301,7 +301,7 @@ bool vvToolWidgetBase::close() //------------------------------------------------------------------------------ void vvToolWidgetBase::AnImageIsBeingClosed(vvSlicerManager * m) -{ +{ //out << __func__ << endl; mToolInputSelectionWidget->AnImageIsBeingClosed(m); if (m == mCurrentSlicerManager) { close(); @@ -312,7 +312,7 @@ void vvToolWidgetBase::AnImageIsBeingClosed(vvSlicerManager * m) //------------------------------------------------------------------------------ void vvToolWidgetBase::SwapCurrentWidget() -{ +{ //out << __func__ << endl; mStaticWidgetForTab->setUpdatesEnabled(false); QList l =mStaticWidgetForTab->children(); for(int i=1; isetEnabled(true); std::vector & l = mToolInputSelectionWidget->GetSelectedInputs(); mCurrentSlicerManager = l[0]; @@ -372,7 +372,7 @@ void vvToolWidgetBase::InputIsSelected() //------------------------------------------------------------------------------ void vvToolWidgetBase::InputIsSelected(vvSlicerManager * m) -{ +{ //out << __func__ << endl; std::cerr << "You MUST overwrite this method vvToolWidgetBase::InputIsSelected(vvSlicerManager * m) if you use one single input" << std::endl; exit(0); } @@ -381,7 +381,7 @@ void vvToolWidgetBase::InputIsSelected(vvSlicerManager * m) //------------------------------------------------------------------------------ void vvToolWidgetBase::InputIsSelected(std::vector & l) -{ +{ //out << __func__ << endl; mMainButtonBox->setEnabled(true); if (l.size() == 1) InputIsSelected(l[0]); else {