From 48d8569538b93bf923de2f8d5c4b9db51640978f Mon Sep 17 00:00:00 2001 From: bharath Date: Mon, 26 Apr 2010 18:21:49 +0000 Subject: [PATCH] Added Manual Registration Tool with updated Median Filter tool --- common/vvImage.cxx | 215 +++++++++++++------- common/vvImage.h | 23 ++- filters/CMakeLists.txt | 9 +- filters/clitkBinarizeImageGenericFilter.txx | 2 +- filters/clitkMedianImageGenericFilter.txx | 2 +- tools/CMakeLists.txt | 6 +- vv/CMakeLists.txt | 3 + vv/qt_ui/vvToolMedianFilter.ui | 34 ++-- vv/vv.cxx | 2 +- vv/vvIcons.qrc | 1 + vv/vvMainWindow.cxx | 7 +- vv/vvSlicer.cxx | 7 + vv/vvSlicer.h | 8 +- vv/vvSlicerManager.cxx | 3 +- vv/vvSlicerManagerCommand.cxx | 7 +- vv/vvSlicerManagerCommand.h | 1 + vv/vvToolMedianFilter.cxx | 94 ++++----- vv/vvToolMedianFilter.h | 17 +- 18 files changed, 268 insertions(+), 173 deletions(-) diff --git a/common/vvImage.cxx b/common/vvImage.cxx index cb73874..2a47a99 100644 --- a/common/vvImage.cxx +++ b/common/vvImage.cxx @@ -19,15 +19,14 @@ #define VVIMAGE_CXX #include "vvImage.h" #include "clitkCommon.h" - +#include #include #include - #include //-------------------------------------------------------------------- vvImage::vvImage() { - Init(); + Init(); } //-------------------------------------------------------------------- @@ -36,23 +35,25 @@ vvImage::vvImage() { void vvImage::Init() { mTimeSpacing = 1; mTimeOrigin = 0; + if (CLITK_EXPERIMENTAL) { mVtkImageReslice = vtkSmartPointer::New(); + transform = vtkSmartPointer::New(); mVtkImageReslice->SetInterpolationModeToLinear(); mVtkImageReslice->AutoCropOutputOn(); + mVtkImageReslice->SetBackgroundColor(-1000,-1000,-1000,1); + mVtkImageReslice->SetResliceTransform(transform); } } //-------------------------------------------------------------------- - //-------------------------------------------------------------------- vvImage::~vvImage() { Reset(); } //-------------------------------------------------------------------- - //-------------------------------------------------------------------- void vvImage::Reset() { if (CLITK_EXPERIMENTAL) @@ -91,133 +92,123 @@ void vvImage::AddImage(vtkImageData* image) { } //-------------------------------------------------------------------- - //-------------------------------------------------------------------- int vvImage::GetNumberOfSpatialDimensions() { - int dim=GetNumberOfDimensions(); - if (IsTimeSequence()) - return dim-1; - else - return dim; + int dim=GetNumberOfDimensions(); + if (IsTimeSequence()) + return dim-1; + else + return dim; } //-------------------------------------------------------------------- - - +// //-------------------------------------------------------------------- int vvImage::GetNumberOfDimensions() const { - if (mVtkImages.size()) + if (mVtkImages.size()) { - int dimension = 2; - int extent[6]; - mVtkImages[0]->GetWholeExtent(extent); - if (extent[5] - extent[4] >= 1) - dimension++; - if (mVtkImages.size() > 1) - dimension++; - return dimension; + int dimension = 2; + int extent[6]; + mVtkImages[0]->GetWholeExtent(extent); + if (extent[5] - extent[4] >= 1) + dimension++; + if (mVtkImages.size() > 1) + dimension++; + return dimension; } - return 0; + return 0; } -//-------------------------------------------------------------------- - - //-------------------------------------------------------------------- void vvImage::GetScalarRange(double* range) { - assert(mVtkImages.size()); - double * temp = mVtkImages[0]->GetScalarRange(); - range[0]=temp[0];range[1]=temp[1]; - for (unsigned int i=1;iGetScalarRange(); + range[0]=temp[0];range[1]=temp[1]; + for (unsigned int i=1;iGetScalarRange(); - if (temp[0] < range[0]) range[0]=temp[0]; - if (temp[1] > range[1]) range[1]=temp[1]; + temp = mVtkImages[i]->GetScalarRange(); + if (temp[0] < range[0]) range[0]=temp[0]; + if (temp[1] > range[1]) range[1]=temp[1]; } } -//-------------------------------------------------------------------- - //-------------------------------------------------------------------- std::string vvImage::GetScalarTypeAsString() { - // WARNING VTK pixel type different from ITK Pixel type - std::string vtktype = mVtkImages[0]->GetScalarTypeAsString(); - if (vtktype == "unsigned char") return "unsigned_char"; - if (vtktype == "unsigned short") return "unsigned_short"; - if (vtktype == "unsigned int") return "unsigned_int"; - return vtktype; + return mVtkImages[0]->GetScalarTypeAsString(); } //-------------------------------------------------------------------- - //-------------------------------------------------------------------- int vvImage::GetNumberOfScalarComponents() { - return mVtkImages[0]->GetNumberOfScalarComponents(); + return mVtkImages[0]->GetNumberOfScalarComponents(); } //-------------------------------------------------------------------- - //-------------------------------------------------------------------- int vvImage::GetScalarSize() { - return mVtkImages[0]->GetScalarSize(); + return mVtkImages[0]->GetScalarSize(); } //-------------------------------------------------------------------- - //-------------------------------------------------------------------- std::vector vvImage::GetSpacing() { - std::vector spacing; - int dim = this->GetNumberOfDimensions(); - for (int i = 0; i < dim; i++) + std::vector spacing; + int dim = this->GetNumberOfDimensions(); + for (int i = 0; i < dim; i++) { + if (i == 3) + spacing.push_back(1); + else + spacing.push_back(mVtkImages[0]->GetSpacing()[i]); if (i == 3) spacing.push_back(mTimeSpacing); else spacing.push_back(mVtkImages[0]->GetSpacing()[i]); } - return spacing; + return spacing; } //-------------------------------------------------------------------- - //-------------------------------------------------------------------- std::vector vvImage::GetOrigin() const { - std::vector origin; - int dim = this->GetNumberOfDimensions(); - for (int i = 0; i < dim; i++) + std::vector origin; + int dim = this->GetNumberOfDimensions(); + for (int i = 0; i < dim; i++) { + if (i == 3) + origin.push_back(0); + else + origin.push_back(mVtkImages[0]->GetOrigin()[i]); if (i == 3) origin.push_back(mTimeOrigin); else origin.push_back(mVtkImages[0]->GetOrigin()[i]); } - return origin; + return origin; } //-------------------------------------------------------------------- - //-------------------------------------------------------------------- std::vector vvImage::GetSize() { - std::vector size0; - int dim = this->GetNumberOfDimensions(); - for (int i = 0; i < dim; i++) + std::vector size0; + int dim = this->GetNumberOfDimensions(); + for (int i = 0; i < dim; i++) { - if (i == 3) - size0.push_back(mVtkImages.size()); - else - size0.push_back(mVtkImages[0]->GetDimensions()[i]); + if (i == 3) + size0.push_back(mVtkImages.size()); + else + size0.push_back(mVtkImages[0]->GetDimensions()[i]); } - return size0; + return size0; } //-------------------------------------------------------------------- - //-------------------------------------------------------------------- unsigned long vvImage::GetActualMemorySize() { - unsigned long size = 0; - for (unsigned int i = 0; i < mVtkImages.size(); i++) { - size += mVtkImages[i]->GetActualMemorySize(); - } - return size; + unsigned long size = 0; + for (unsigned int i = 0; i < mVtkImages.size(); i++) { + size += mVtkImages[i]->GetActualMemorySize(); + } + return size; } //-------------------------------------------------------------------- @@ -251,7 +242,6 @@ bool vvImage::IsScalarTypeInteger() { } //-------------------------------------------------------------------- - //-------------------------------------------------------------------- bool vvImage::IsScalarTypeInteger(int t) { if ((t == VTK_BIT) || @@ -269,8 +259,91 @@ bool vvImage::IsScalarTypeInteger(int t) { return false; } } + +//-------------------------------------------------------------------- + +//-------------------------------------------------------------------- + +void vvImage::SetVTKImageReslice(vtkImageReslice* reslice) { + mVtkImageReslice=reslice; + +} +//-------------------------------------------------------------------- + +//-------------------------------------------------------------------- +vtkAbstractTransform * vvImage::GetTransform() +{ + return mVtkImageReslice->GetResliceTransform(); +} //-------------------------------------------------------------------- +//------------------------------------------------------------------- +void vvImage::SetRotateX(int xvalue) +{ + transform->PostMultiply(); + transform->Translate(-origin[0],-origin[1],-origin[2]); + transform->RotateX(xvalue); + transform->Translate(origin[0],origin[1],origin[2]); + mVtkImageReslice->Update(); +} + +//-------------------------------------------------------------------- + +//------------------------------------------------------------------- +void vvImage::SetRotateY(int yvalue) +{ + transform->PostMultiply(); + transform->Translate(-origin[0],-origin[1],-origin[2]); + transform->RotateY(yvalue); + transform->Translate(origin[0],origin[1],origin[2]); + mVtkImageReslice->Update(); +} +//-------------------------------------------------------------------- + +//------------------------------------------------------------------- +void vvImage::SetRotateZ(int zvalue) +{ + transform->PostMultiply(); + transform->Translate(-origin[0],-origin[1],-origin[2]); + transform->RotateZ(zvalue); + transform->Translate(origin[0],origin[1],origin[2]); + mVtkImageReslice->Update(); +} +//-------------------------------------------------------------------- + +//------------------------------------------------------------------- +void vvImage::SetTranslationX(int xvalue) +{ + transform->Translate(xvalue,0,0); + mVtkImageReslice->Update(); +} +//-------------------------------------------------------------------- + +//------------------------------------------------------------------- + +void vvImage::SetTranslationY(int yvalue) +{ + transform->Translate(0,yvalue,0); + mVtkImageReslice->Update(); +} +//-------------------------------------------------------------------- + +//------------------------------------------------------------------- +void vvImage::SetTranslationZ(int zvalue) +{ + transform->Translate(0,0,zvalue); + mVtkImageReslice->Update(); +} +//------------------------------------------------------------------- + +//------------------------------------------------------------------- +void vvImage::SetOrigin(double value[3]) +{ + origin=new double[mVtkImageReslice->GetOutputDimensionality()]; + origin[0]=value[0]; + origin[1]=value[1]; + origin[2]=value[2]; +} //-------------------------------------------------------------------- void vvImage::SetTransform(vtkAbstractTransform *transform) diff --git a/common/vvImage.h b/common/vvImage.h index a0ab108..106189f 100644 --- a/common/vvImage.h +++ b/common/vvImage.h @@ -25,6 +25,8 @@ class vtkImageData; class vtkImageReslice; +class vtkTransform; +class vtkImageReslice; class vtkAbstractTransform; class vvImage : public itk::LightObject { @@ -55,18 +57,33 @@ public : bool IsTimeSequence(); bool IsScalarTypeInteger(); bool IsScalarTypeInteger(int t); + vtkAbstractTransform * GetTransform(); + void SetTransform(vtkAbstractTransform *transform); + vtkImageReslice* GetVTKImageReslice(); + void SetVTKImageReslice(vtkImageReslice *reslice); + + void SetRotateX(int xvalue); + void SetRotateY(int yvalue); + void SetRotateZ(int zvalue); + + void SetTranslationX(int xvalue); + void SetTranslationY(int yvalue); + void SetTranslationZ(int zvalue); + void SetOrigin(double value[3]); + private: void SetTimeSpacing(double s) { mTimeSpacing = s; } void SetTimeOrigin(double o) { mTimeOrigin = o; } - void SetTransform(vtkAbstractTransform *transform); -private: + private: vvImage(); ~vvImage(); std::vector mVtkImages; + vtkSmartPointer mVtkImageReslice; + vtkSmartPointer transform; double mTimeOrigin; double mTimeSpacing; - vtkSmartPointer mVtkImageReslice; + double * origin; }; #endif diff --git a/filters/CMakeLists.txt b/filters/CMakeLists.txt index e6258ce..3c024ad 100644 --- a/filters/CMakeLists.txt +++ b/filters/CMakeLists.txt @@ -6,19 +6,24 @@ INCLUDE(../cmake/common.cmake) SET(clitkFilters_SRC clitkGuerreroVentilationGenericFilter.cxx - clitkImageArithm_ggo.c - clitkImageArithmGenericFilter.cxx + #clitkBinarizeImage_ggo.c + #clitkImageArithmGenericFilter.cxx clitkImageConvertGenericFilter.cxx clitkImageFillRegionGenericFilter.cxx clitkImageResampleGenericFilter.cxx clitkSplitImageGenericFilter.cxx clitkVFResampleGenericFilter.cxx + clitkBinarizeImageGenericFilter.cxx + clitkImageArithmGenericFilter.cxx + clitkMedianImageGenericFilter.cxx + # clitkMedianImageFilter_ggo.c # clitkBinarizeImageGenericFilter.cxx clitkBinarizeImage_ggo.c # clitkMedianImageGenericFilter.cxx clitkMedianImageFilter_ggo.c clitkUnsharpMask_ggo.c clitkFooImage_ggo.c + clitkImageArithm_ggo.c ) ADD_LIBRARY(clitkFilters STATIC ${clitkFilters_SRC}) diff --git a/filters/clitkBinarizeImageGenericFilter.txx b/filters/clitkBinarizeImageGenericFilter.txx index a35a730..cdf0961 100644 --- a/filters/clitkBinarizeImageGenericFilter.txx +++ b/filters/clitkBinarizeImageGenericFilter.txx @@ -23,6 +23,7 @@ #include "itkBinaryThresholdImageFilter.h" #include "itkMaskImageFilter.h" #include "itkMaskNegatedImageFilter.h" + #include // #include @@ -100,7 +101,6 @@ namespace clitk // DD(mArgsInfo.bg_given); // DD(mArgsInfo.mode_arg); -// <<<<<<< clitkBinarizeImageGenericFilter.txx // DD(mArgsInfo.useFG_flag); // DD(mArgsInfo.useBG_flag); diff --git a/filters/clitkMedianImageGenericFilter.txx b/filters/clitkMedianImageGenericFilter.txx index 94842b3..292997b 100644 --- a/filters/clitkMedianImageGenericFilter.txx +++ b/filters/clitkMedianImageGenericFilter.txx @@ -1,4 +1,4 @@ -#ifndef clitkMedianImageGenericFilter_txx + #ifndef clitkMedianImageGenericFilter_txx #define clitkMedianImageGenericFilter_txx /* ================================================= diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index becacb2..6acef2c 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -69,7 +69,7 @@ ADD_EXECUTABLE(clitkGuerreroVentilation clitkGuerreroVentilation.cxx TARGET_LINK_LIBRARIES(clitkGuerreroVentilation clitkCommon ITKIO ITKBasicFilters clitkFilters) -ADD_EXECUTABLE(clitkImageArithm clitkImageArithm.cxx) +ADD_EXECUTABLE(clitkImageArithm clitkImageArithm.cxx clitkImageArithm_ggo.c ) TARGET_LINK_LIBRARIES(clitkImageArithm clitkCommon ITKIO ITKStatistics clitkFilters) ADD_EXECUTABLE(clitkUnsharpMask clitkUnsharpMask.cxx) @@ -78,8 +78,8 @@ TARGET_LINK_LIBRARIES(clitkUnsharpMask clitkCommon ITKIO clitkFilters) ADD_EXECUTABLE(clitkFooImage clitkFooImage.cxx) TARGET_LINK_LIBRARIES(clitkFooImage clitkCommon ITKIO clitkFilters) -ADD_EXECUTABLE(clitkBinarizeImage clitkBinarizeImage.cxx) +ADD_EXECUTABLE(clitkBinarizeImage clitkBinarizeImage.cxx clitkBinarizeImage_ggo.c) TARGET_LINK_LIBRARIES(clitkBinarizeImage clitkCommon ITKIO clitkFilters) -ADD_EXECUTABLE(clitkMedianImageFilter clitkMedianImageFilter.cxx) +ADD_EXECUTABLE(clitkMedianImageFilter clitkMedianImageFilter.cxx clitkMedianImageFilter_ggo.c) TARGET_LINK_LIBRARIES(clitkMedianImageFilter clitkCommon ITKIO clitkFilters ITKBasicFilters) diff --git a/vv/CMakeLists.txt b/vv/CMakeLists.txt index 1094b6c..6c7f8fe 100644 --- a/vv/CMakeLists.txt +++ b/vv/CMakeLists.txt @@ -103,6 +103,7 @@ SET(vv_SRCS vvToolCreatorBase.cxx vvToolWidgetBase.cxx vvToolMedianFilter.cxx + vvToolRigidReg.cxx # vvToolFoo.cxx # vvToolFooWithWidgetBase.cxx vvToolCropImage.cxx @@ -141,6 +142,7 @@ QT4_WRAP_CPP(vv_SRCS # vvToolFoo.h # vvToolFooWithWidgetBase.h vvToolMedianFilter.h + vvToolRigidReg.h vvToolBinarize.h vvToolSimpleInputSelectorWidget.h vvToolInputSelectorWidget.h @@ -174,6 +176,7 @@ QT4_WRAP_UI(vv_UI_CXX qt_ui/vvToolInputSelectorWidget.ui qt_ui/vvToolWidgetBase.ui qt_ui/vvToolMedianFilter.ui + qt_ui/vvToolRigidReg.ui # qt_ui/vvToolFoo.ui qt_ui/vvToolCropImage.ui qt_ui/vvToolBinarize.ui diff --git a/vv/qt_ui/vvToolMedianFilter.ui b/vv/qt_ui/vvToolMedianFilter.ui index fe31b04..f82a646 100644 --- a/vv/qt_ui/vvToolMedianFilter.ui +++ b/vv/qt_ui/vvToolMedianFilter.ui @@ -6,16 +6,16 @@ 0 0 - 735 - 290 + 400 + 300 - Mean Filter + Form - + - + @@ -31,11 +31,12 @@ - - - - + + + + + @@ -44,18 +45,19 @@ - + Qt::Horizontal - - - - + + + + + @@ -64,14 +66,14 @@ - + Qt::Horizontal - + diff --git a/vv/vv.cxx b/vv/vv.cxx index 73e7792..7d40972 100644 --- a/vv/vv.cxx +++ b/vv/vv.cxx @@ -41,7 +41,7 @@ int main( int argc, char** argv ) Q_INIT_RESOURCE(vvIcons); //QPixmap pixmap(":/splashscreen.PNG"); QSplashScreen *splash = new QSplashScreen(QPixmap(QString::fromUtf8(":/new/prefix1/splashscreen.PNG"))); - /*splash->showMessage("VV 1.0 developped by Léon Bérard cancer center http://oncora1.lyon.fnclcc.fr and CREATIS-LRMN http://www.creatis.insa-lyon.fr",(Qt::AlignRight | Qt::AlignBottom));*/ + /*splash->showMessage("VV 1.0 developped by Léon Bérard c`ancer center http://oncora1.lyon.fnclcc.fr and CREATIS-LRMN http://www.creatis.insa-lyon.fr",(Qt::AlignRight | Qt::AlignBottom));*/ // splash->show(); QTimer::singleShot(2000, splash, SLOT(close())); while (!splash->isHidden()) diff --git a/vv/vvIcons.qrc b/vv/vvIcons.qrc index 9f7c895..b3c230f 100644 --- a/vv/vvIcons.qrc +++ b/vv/vvIcons.qrc @@ -28,6 +28,7 @@ icons/player_play.png icons/player_pause.png icons/ducky.png + icons/register.png icons/exit.png icons/rotateright.png icons/adjustsize.png diff --git a/vv/vvMainWindow.cxx b/vv/vvMainWindow.cxx index abf38e9..a35922f 100644 --- a/vv/vvMainWindow.cxx +++ b/vv/vvMainWindow.cxx @@ -1545,7 +1545,7 @@ void vvMainWindow::CloseImage(QTreeWidgetItem* item, int column) { msgBox.addButton(tr("Cancel"), QMessageBox::RejectRole); if (msgBox.exec() == QMessageBox::AcceptRole) { - this->close(); + this->close(); } } else @@ -1904,6 +1904,7 @@ void vvMainWindow::SelectOverlayImage() { //------------------------------------------------------------------------------ void vvMainWindow::AddOverlayImage(int index, QString file) { + mInputPathName = itksys::SystemTools::GetFilenamePath(file.toStdString()).c_str(); itk::ImageIOBase::Pointer reader = itk::ImageIOFactory::CreateImageIO( file.toStdString().c_str(), itk::ImageIOFactory::ReadMode); @@ -1914,7 +1915,7 @@ void vvMainWindow::AddOverlayImage(int index, QString file) { QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); vvProgressDialog progress("Opening " + file.toStdString()); qApp->processEvents(); - + std::string filename = itksys::SystemTools::GetFilenameWithoutExtension(file.toStdString()).c_str(); if (mSlicerManagers[index]->SetOverlay(file.toStdString(),dimension, component)) { @@ -1929,7 +1930,7 @@ void vvMainWindow::AddOverlayImage(int index, QString file) { { item->setData(j,Qt::CheckStateRole,DataTree->topLevelItem(index)->data(j,Qt::CheckStateRole)); mSlicerManagers[index]->GetSlicer(j-1)->SetActorVisibility("overlay",0, - DataTree->topLevelItem(index)->data(j,Qt::CheckStateRole).toInt()); + DataTree->topLevelItem(index)->data(j,Qt::CheckStateRole).toInt()); } //Create the buttons for reload and close diff --git a/vv/vvSlicer.cxx b/vv/vvSlicer.cxx index af609a7..256981f 100644 --- a/vv/vvSlicer.cxx +++ b/vv/vvSlicer.cxx @@ -64,6 +64,7 @@ #include #include #include +#include vtkCxxRevisionMacro(vvSlicer, "DummyRevision"); vtkStandardNewMacro(vvSlicer); @@ -140,6 +141,7 @@ vvSlicer::vvSlicer() this->WindowLevel->Delete(); this->WindowLevel = vvImageMapToWLColors::New(); this->InstallPipeline(); + } //------------------------------------------------------------------------------ @@ -1414,3 +1416,8 @@ void vvSlicer::PrintSelf(ostream& os, vtkIndent indent) //---------------------------------------------------------------------------- + + + + + diff --git a/vv/vvSlicer.h b/vv/vvSlicer.h index 4315dd8..3a05a16 100644 --- a/vv/vvSlicer.h +++ b/vv/vvSlicer.h @@ -46,7 +46,8 @@ class vtkCursor3D; class vtkCutter; class vtkAssignAttribute; class vtkScalarBarActor; - +class vtkTransform; +class vtkImageReslice; class vvSlicer: public vtkImageViewer2 { @@ -70,8 +71,8 @@ public: vtkImageMapToWindowLevelColors* GetFusionMapper() ; vtkImageActor* GetFusionActor() ; vtkActor* GetVFActor() ; - vtkCornerAnnotation* GetAnnotation() ; - + vtkCornerAnnotation* GetAnnotation(); + void SetFusion(vvImage::Pointer inputFusion); vvImage::Pointer GetFusion() { return mFusion; @@ -197,7 +198,6 @@ protected: vtkSmartPointer mLandActor; vtkSmartPointer mClipBox; vtkSmartPointer legend; - std::vector mSurfaceCutActors; int mCurrentTSlice; diff --git a/vv/vvSlicerManager.cxx b/vv/vvSlicerManager.cxx index b14bfde..344fa73 100644 --- a/vv/vvSlicerManager.cxx +++ b/vv/vvSlicerManager.cxx @@ -1,4 +1,4 @@ -/*========================================================================= + /*========================================================================= Program: vv http://www.creatis.insa-lyon.fr/rio/vv Authors belong to: @@ -1265,4 +1265,5 @@ void vvSlicerManager::NextImage(int slicer) void vvSlicerManager::VerticalSliderHasChanged(int slicer, int slice) { emit AVerticalSliderHasChanged(slicer, slice); } + //---------------------------------------------------------------------------- diff --git a/vv/vvSlicerManagerCommand.cxx b/vv/vvSlicerManagerCommand.cxx index 0415c9e..5b35bdd 100644 --- a/vv/vvSlicerManagerCommand.cxx +++ b/vv/vvSlicerManagerCommand.cxx @@ -31,9 +31,11 @@ #include #include #include - +#include +#include #include "vvSlicer.h" #include "vvInteractorStyleNavigator.h" +#include "vtkTransform.h" #include @@ -80,6 +82,8 @@ void vvSlicerManagerCommand::Execute(vtkObject *caller, if (VisibleInWindow>-1) renderer=this->SM->GetSlicer(VisibleInWindow)->GetRenderer(); newLandmark = false; + + if (event == vtkCommand::StartPickEvent && VisibleInWindow == -1) { @@ -283,6 +287,7 @@ void vvSlicerManagerCommand::Execute(vtkObject *caller, this->SM->UpdateSliceRange(VisibleInWindow); this->SM->UpdateInfoOnCursorPosition(VisibleInWindow); } + } //All type of mouse events diff --git a/vv/vvSlicerManagerCommand.h b/vv/vvSlicerManagerCommand.h index 12aedcc..7a5b492 100644 --- a/vv/vvSlicerManagerCommand.h +++ b/vv/vvSlicerManagerCommand.h @@ -54,6 +54,7 @@ protected : private: + int FindSlicerNumber(vtkRenderWindow* renwin); double InitialWindow; diff --git a/vv/vvToolMedianFilter.cxx b/vv/vvToolMedianFilter.cxx index 0d69855..c4f8029 100644 --- a/vv/vvToolMedianFilter.cxx +++ b/vv/vvToolMedianFilter.cxx @@ -3,8 +3,8 @@ Program: vv Module: $RCSfile: vvToolMedianFilter.cxx,v $ Language: C++ - Date: $Date: 2010/04/09 09:53:27 $ - Version: $Revision: 1.1 $ + Date: $Date: 2010/04/26 18:21:55 $ + Version: $Revision: 1.2 $ Author : Bharath Navalpakkam (Bharath.Navalpakkam@creatis.insa-lyon.fr) Copyright (C) 2010 @@ -42,7 +42,7 @@ :vvToolWidgetBase(parent,f), vvToolBase(parent), Ui::vvToolMedianFilter() - { + { // Setup the UI @@ -62,13 +62,10 @@ vvToolMedianFilter::~vvToolMedianFilter() { } //------------------------------------------------------------------------------ - - - void vvToolMedianFilter::Initialize() { SetToolName("MedianFilter"); SetToolMenuName("MedianFilter"); - SetToolIconFilename(":/new/prefix1/icons/ducky.png"); + SetToolIconFilename(":common/icons/ducky.png"); SetToolTip("Make 'MedianFilter' on an image."); } //------------------------------------------------------------------------------ @@ -76,21 +73,15 @@ void vvToolMedianFilter::apply() { GetArgsInfoFromGUI(); - if (!mCurrentSlicerManager) close(); QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); // Main filter clitk::MedianImageGenericFilter::Pointer filter = clitk::MedianImageGenericFilter::New(); - - filter->SetInputVVImage(mCurrentImage); - filter->SetArgsInfo(mArgsInfo); - - filter->EnableReadOnDisk(false); - filter->Update(); - - + filter->SetArgsInfo(mArgsInfo); + filter->EnableReadOnDisk(false); + filter->Update(); // Output vvImage::Pointer output = filter->GetOutputVVImage(); std::ostringstream osstream; @@ -98,14 +89,9 @@ AddImage(output,osstream.str()); QApplication::restoreOverrideCursor(); close(); - - } - //------------------------------------------------------------------------------ - void vvToolMedianFilter::GetArgsInfoFromGUI() { - /* //KEEP THIS FOR READING GGO FROM FILE int argc=1; std::string a = "toto"; @@ -116,59 +102,57 @@ int good = cmdline_parser_ext(argc, argv, &args_info, &p); DD(good); */ - mArgsInfo.radius_given=0; - mArgsInfo.verbose_flag = false; + mArgsInfo.radius_given=0; + mArgsInfo.verbose_flag = false; // mArgsInfo.radius_arg = new int[3]; - // Required (even if not used) mArgsInfo.input_given = 0; mArgsInfo.output_given = 0; - mArgsInfo.input_arg=new char; mArgsInfo.output_arg = new char; - - - mArgsInfo.config_given=0; - mArgsInfo.verbose_given=0; - - - // mArgsInfo.radius_arg[0]=1; - // mArgsInfo.radius_arg[1]=1; - // mArgsInfo.radius_arg[2]=1; - + mArgsInfo.config_given=0; + mArgsInfo.verbose_given=0; } //------------------------------------------------------------------------------ void vvToolMedianFilter::InputIsSelected(vvSlicerManager *m){ mCurrentSlicerManager =m; // Specific for this gui - - mArgsInfo.radius_arg = new int[3]; - connect(horizontalSlider, SIGNAL(valueChanged(int)), this, SLOT(UpdatevalueH1())); - connect(horizontalSlider_2, SIGNAL(valueChanged(int)), this, SLOT(UpdatevalueH2())); - connect(horizontalSlider_3, SIGNAL(valueChanged(int)), this, SLOT(UpdatevalueH3())); - - - + mArgsInfo.radius_arg = new int[3]; + int checkdimensions=mCurrentSlicerManager->GetDimension(); + if(checkdimensions<3) + { + horizontalSlider_3->hide(); + spinBox_3->hide(); + mArgsInfo.radius_arg[2]=0; + connect(horizontalSlider, SIGNAL(valueChanged(int)), this, SLOT(UpdateH1slider())); + connect(horizontalSlider_2, SIGNAL(valueChanged(int)), this, SLOT(UpdateH2slider())); + } + else + { + horizontalSlider->show(); + horizontalSlider_2->show(); + horizontalSlider_3->show(); + connect(horizontalSlider, SIGNAL(valueChanged(int)), this, SLOT(UpdateH1slider())); + connect(horizontalSlider_2, SIGNAL(valueChanged(int)), this, SLOT(UpdateH2slider())); + connect(horizontalSlider_3, SIGNAL(valueChanged(int)), this, SLOT(UpdateH3slider())); + } } - //----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- -void vvToolMedianFilter::UpdatevalueH1() +void vvToolMedianFilter::UpdateH1slider() { + mArgsInfo.radius_arg[0]=horizontalSlider->value(); - QString string1 = QString::number(mArgsInfo.radius_arg[0]); - lineEdit->setText(string1); + spinBox->setValue(mArgsInfo.radius_arg[0]); } -void vvToolMedianFilter::UpdatevalueH2() +void vvToolMedianFilter::UpdateH2slider() { - mArgsInfo.radius_arg[1]=horizontalSlider_2->value(); - QString string2 = QString::number(mArgsInfo.radius_arg[1]); - lineEdit_2->setText(string2); + mArgsInfo.radius_arg[1]=horizontalSlider_2->value(); + spinBox_2->setValue(mArgsInfo.radius_arg[1]); } -void vvToolMedianFilter::UpdatevalueH3() +void vvToolMedianFilter::UpdateH3slider() { mArgsInfo.radius_arg[2]=horizontalSlider_3->value(); - QString string3 = QString::number(mArgsInfo.radius_arg[2]); - lineEdit_3->setText(string3); - + spinBox_3->setValue(mArgsInfo.radius_arg[2]); } diff --git a/vv/vvToolMedianFilter.h b/vv/vvToolMedianFilter.h index c569a19..c4f8629 100644 --- a/vv/vvToolMedianFilter.h +++ b/vv/vvToolMedianFilter.h @@ -3,8 +3,8 @@ Program: vv Module: $RCSfile: vvToolMedianFilter.h,v $ Language: C++ - Date: $Date: 2010/04/09 09:53:50 $ - Version: $Revision: 1.1 $ + Date: $Date: 2010/04/26 18:21:55 $ + Version: $Revision: 1.2 $ Author : Bharath Navalpakkam (Bharath.Navalpakkam@creatis.insa-lyon.fr) Copyright (C) 2010 @@ -30,7 +30,7 @@ #include #include "vvToolBase.h" - #include "QDialog" + #include "QWidget" #include "vvToolWidgetBase.h" #include "ui_vvToolMedianFilter.h" #include "clitkMedianImageFilter_ggo.h" @@ -55,15 +55,10 @@ public slots: - void UpdatevalueH1(); - void UpdatevalueH2(); - void UpdatevalueH3(); - - - - - + void UpdateH1slider(); + void UpdateH2slider(); + void UpdateH3slider(); protected: Ui::vvToolMedianFilter ui; -- 2.47.1