From 34490f432219fe05c7ae19c4cf012b5529d784dc Mon Sep 17 00:00:00 2001 From: dsarrut Date: Wed, 24 Mar 2010 10:48:05 +0000 Subject: [PATCH] - multiple inputs in vv - example with (vv/clitk)ImageArithm --- common/clitkCommon.txx | 1 + common/clitkImageToImageGenericFilterBase.cxx | 49 +- common/clitkImageToImageGenericFilterBase.h | 8 +- filters/CMakeLists.txt | 1 + filters/clitkBinarizeImageGenericFilter.h | 5 +- filters/clitkImageArithmGenericFilter.cxx | 239 --------- filters/clitkImageArithmGenericFilter.h | 46 +- filters/clitkImageArithmGenericFilter.txx | 497 ++++++++++-------- filters/clitkImageResampleGenericFilter.cxx | 1 + tools/CMakeLists.txt | 6 +- tools/clitkBinarizeImage.cxx | 4 +- tools/clitkImageArithm.cxx | 77 +-- vv/CMakeLists.txt | 7 +- vv/qt_ui/vvToolSimpleInputSelectorWidget.ui | 139 +---- vv/qt_ui/vvToolWidgetBase.ui | 4 +- vv/vvMainWindow.cxx | 6 +- vv/vvToolBinarize.cxx | 11 +- vv/vvToolBinarize.h | 6 +- vv/vvToolCropImage.cxx | 6 +- vv/vvToolFooWithWidgetBase.cxx | 6 +- vv/vvToolFooWithWidgetBase.h | 6 +- vv/vvToolInputSelectorWidget.cxx | 55 +- vv/vvToolInputSelectorWidget.h | 8 +- vv/vvToolSimpleInputSelectorWidget.cxx | 44 +- vv/vvToolSimpleInputSelectorWidget.h | 9 +- vv/vvToolWidgetBase.cxx | 91 ++-- vv/vvToolWidgetBase.h | 8 +- 27 files changed, 543 insertions(+), 797 deletions(-) diff --git a/common/clitkCommon.txx b/common/clitkCommon.txx index 4d16648..bb4508a9 100644 --- a/common/clitkCommon.txx +++ b/common/clitkCommon.txx @@ -132,6 +132,7 @@ std::string GetTypeAsString() { template void CloneImage(const typename ImageType::Pointer & input, typename ImageType::Pointer & output) { output->SetRegions(input->GetLargestPossibleRegion()); + output->SetOrigin(input->GetOrigin()); output->SetSpacing(input->GetSpacing()); output->Allocate(); typedef itk::ImageRegionConstIterator ConstIteratorType; diff --git a/common/clitkImageToImageGenericFilterBase.cxx b/common/clitkImageToImageGenericFilterBase.cxx index 1a3782a..2c445bc 100644 --- a/common/clitkImageToImageGenericFilterBase.cxx +++ b/common/clitkImageToImageGenericFilterBase.cxx @@ -3,8 +3,8 @@ Program: vv Module: $RCSfile: clitkImageToImageGenericFilterBase.cxx,v $ Language: C++ - Date: $Date: 2010/03/03 13:00:36 $ - Version: $Revision: 1.2 $ + Date: $Date: 2010/03/24 10:48:05 $ + Version: $Revision: 1.3 $ Author : Joel Schaerer David Sarrut @@ -39,6 +39,7 @@ clitk::ImageToImageGenericFilterBase::ImageToImageGenericFilterBase(std::string :mIOVerbose(false) { mFilterName = n; mFailOnImageTypeError = true; + mReadOnDisk = true; } //-------------------------------------------------------------------- @@ -50,6 +51,13 @@ void clitk::ImageToImageGenericFilterBase::SetInputFilenames(const std::vector f; @@ -104,21 +112,20 @@ std::string clitk::ImageToImageGenericFilterBase::GetOutputFilename() void clitk::ImageToImageGenericFilterBase::GetInputImageDimensionAndPixelType(unsigned int& dim, \ std::string& pixeltype,unsigned int& components) { - if (mInputFilenames.size()) - { - int comp_temp,dim_temp; //clitkCommonImage takes ints - ReadImageDimensionAndPixelType(mInputFilenames[0], dim_temp, pixeltype,comp_temp); - components=comp_temp; dim=dim_temp; - } - else if (mInputVVImages.size()) - { + if (mReadOnDisk && mInputFilenames.size()) { + int comp_temp,dim_temp; //clitkCommonImage takes ints + ReadImageDimensionAndPixelType(mInputFilenames[0], dim_temp, pixeltype,comp_temp); + components=comp_temp; dim=dim_temp; + } + else { + if (mInputVVImages.size()) { pixeltype=mInputVVImages[0]->GetScalarTypeAsString(); dim=mInputVVImages[0]->GetNumberOfDimensions(); components=mInputVVImages[0]->GetNumberOfScalarComponents(); } - else + else assert(false); //No input image, shouldn't happen - + } if (mIOVerbose) { std::cout << "Input is " << mDim << "D " << mPixelTypeName << "." << std::endl; } @@ -280,16 +287,18 @@ void clitk::ImageToImageGenericFilterBase::SetNextOutput(typename ImageType::Poi //-------------------------------------------------------------------- template typename ImageType::Pointer clitk::ImageToImageGenericFilterBase::GetInput(unsigned int n) { - if (mInputFilenames.size() > n) { + if (mReadOnDisk && mInputFilenames.size() > n) { return clitk::readImage(mInputFilenames[n], mIOVerbose); } - else if (mInputVVImages.size() > n) - return typename ImageType::Pointer(const_cast(vvImageToITK(mInputVVImages[n]).GetPointer())); - else - { - assert(false); //No input, this shouldn't happen - return typename ImageType::Pointer(NULL); - } + else { + if (mInputVVImages.size() > n) + return typename ImageType::Pointer(const_cast(vvImageToITK(mInputVVImages[n]).GetPointer())); + else + { + assert(false); //No input, this shouldn't happen + return typename ImageType::Pointer(NULL); + } + } } //-------------------------------------------------------------------- diff --git a/common/clitkImageToImageGenericFilterBase.h b/common/clitkImageToImageGenericFilterBase.h index 4933b10..7d5583c 100644 --- a/common/clitkImageToImageGenericFilterBase.h +++ b/common/clitkImageToImageGenericFilterBase.h @@ -3,8 +3,8 @@ Program: clitk Module: $RCSfile: clitkImageToImageGenericFilterBase.h,v $ Language: C++ - Date: $Date: 2010/03/03 13:00:36 $ - Version: $Revision: 1.2 $ + Date: $Date: 2010/03/24 10:48:05 $ + Version: $Revision: 1.3 $ Author : Joel Schaerer David Sarrut @@ -71,6 +71,7 @@ namespace clitk { void SetInputFilename(const std::string & filename); void AddInputFilename(const std::string & filename); void SetInputFilenames(const std::vector & filenames); + void EnableReadOnDisk(bool b); void SetOutputFilename(const std::string & filename); void AddOutputFilename(const std::string & filename); void SetOutputFilenames(const std::vector & filenames); @@ -95,6 +96,7 @@ namespace clitk { virtual bool Update() = 0; protected: + bool mReadOnDisk; /// Call this function to dispatch an output towards the correct sink template void SetNextOutput(typename ImageType::Pointer output); @@ -124,7 +126,7 @@ namespace clitk { #define ADD_VEC_IMAGE_TYPE(DIM, COMP, PT) this->mImageTypesManager.template AddNewDimensionAndPixelType(); #define ADD_IMAGE_TYPE(DIM, PT) this->mImageTypesManager.template AddNewDimensionAndPixelType(); -#include "clitkImageToImageGenericFilterBase.txx" + //#include "clitkImageToImageGenericFilterBase.txx" } // end namespace diff --git a/filters/CMakeLists.txt b/filters/CMakeLists.txt index ca56f4e..89339ca 100644 --- a/filters/CMakeLists.txt +++ b/filters/CMakeLists.txt @@ -6,6 +6,7 @@ INCLUDE(../cmake/common.cmake) SET(clitkFilters_SRC clitkGuerreroVentilationGenericFilter.cxx + clitkImageArithm_ggo.c clitkImageArithmGenericFilter.cxx clitkImageConvertGenericFilter.cxx clitkImageFillRegionGenericFilter.cxx diff --git a/filters/clitkBinarizeImageGenericFilter.h b/filters/clitkBinarizeImageGenericFilter.h index ad2966d..ddab776 100644 --- a/filters/clitkBinarizeImageGenericFilter.h +++ b/filters/clitkBinarizeImageGenericFilter.h @@ -3,8 +3,8 @@ Program: clitk Module: $RCSfile: clitkBinarizeImageGenericFilter.h,v $ Language: C++ - Date: $Date: 2010/02/03 10:54:58 $ - Version: $Revision: 1.2 $ + Date: $Date: 2010/03/24 10:48:09 $ + Version: $Revision: 1.3 $ Author : Jef Vandemeulebroucke David Sarrut (david.sarrut@creatis.insa-lyon.fr) @@ -31,7 +31,6 @@ // clitk include #include "clitkIO.h" -#include "clitkCommon.h" #include "clitkImageToImageGenericFilter.h" //-------------------------------------------------------------------- diff --git a/filters/clitkImageArithmGenericFilter.cxx b/filters/clitkImageArithmGenericFilter.cxx index fb33c2b..ea22f14 100644 --- a/filters/clitkImageArithmGenericFilter.cxx +++ b/filters/clitkImageArithmGenericFilter.cxx @@ -24,244 +24,5 @@ #include "clitkImageArithmGenericFilter.h" -//-------------------------------------------------------------------- -clitk::ImageArithmGenericFilter::ImageArithmGenericFilter() - :ImageToImageGenericFilter("ImageArithmGenericFilter"),mTypeOfOperation(0) { - InitializeImageType<2>(); - InitializeImageType<3>(); - InitializeImageType<4>(); - mIsOperationUseASecondImage = false; -} -//-------------------------------------------------------------------- - -//-------------------------------------------------------------------- -template -void clitk::ImageArithmGenericFilter::InitializeImageType() { - ADD_IMAGE_TYPE(Dim, char); - ADD_IMAGE_TYPE(Dim, short); - ADD_IMAGE_TYPE(Dim, float); - /* ADD_IMAGE_TYPE(Dim, short); - ADD_IMAGE_TYPE(Dim, ushort; - ADD_IMAGE_TYPE(Dim, int); - ADD_IMAGE_TYPE(Dim, unsigned int); - ADD_IMAGE_TYPE(Dim, double); - */ -} -//-------------------------------------------------------------------- - - -//-------------------------------------------------------------------- -template -void clitk::ImageArithmGenericFilter::UpdateWithInputImageType() { - - // Check Input - - //DS TO BE CHANGED IN GetNumberOfInput() !!!!!!!! - - if (mInputFilenames.size() == 0) { - std::cerr << "ERROR : please provide at least a input filename." << std::endl; - } - if (mInputFilenames.size() == 1) { - mIsOperationUseASecondImage = false; - } - if (mInputFilenames.size() == 2) { - mIsOperationUseASecondImage = true; - } - if (mInputFilenames.size() > 2) { - std::cerr << "ERROR : please provide only 1 or 2 input filenames." << std::endl; - } - - // Read input1 - // typename ImageType::Pointer input1 = clitk::readImage(mInputFilenames[0], mIOVerbose); - typename ImageType::Pointer input1 = this->template GetInput(0); - typename ImageType::Pointer outputImage; - - // Read input2 (float is ok altough it could take too memory ...) - if (mIsOperationUseASecondImage) { - typedef itk::Image ImageType2; - // typename ImageType2::Pointer input2 = clitk::readImage(mInputFilenames[1], mIOVerbose); - typename ImageType2::Pointer input2 = this->template GetInput(1); - outputImage = ComputeImage(input1, input2); - } - else { - outputImage = ComputeImage(input1); - } - - // Write results - this->SetNextOutput(outputImage); -} -//-------------------------------------------------------------------- - -//-------------------------------------------------------------------- -template -typename ImageType::Pointer -clitk::ImageArithmGenericFilter::ComputeImage(typename ImageType::Pointer inputImage) { - - typedef typename ImageType::PixelType PixelType; - typedef itk::ImageRegionIterator IteratorType; - IteratorType it(inputImage, inputImage->GetLargestPossibleRegion()); - it.GoToBegin(); - - switch (mTypeOfOperation) { - case 0: // Addition - while (!it.IsAtEnd()) { - it.Set(PixelTypeDownCast((double)it.Get() + mScalar) ); - ++it; - } - break; - case 1: // Multiply - while (!it.IsAtEnd()) { - it.Set(PixelTypeDownCast((double)it.Get() * mScalar) ); - ++it; - } - break; - case 2: // Inverse - while (!it.IsAtEnd()) { - if (it.Get() != 0) - it.Set(PixelTypeDownCast(mScalar / (double)it.Get())); - else it.Set(mDefaultPixelValue); - ++it; - } - break; - case 3: // Max - while (!it.IsAtEnd()) { - if (it.Get() < mScalar) it.Set(PixelTypeDownCast(mScalar)); - ++it; - } - break; - case 4: // Min - while (!it.IsAtEnd()) { - if (it.Get() > mScalar) it.Set(PixelTypeDownCast(mScalar)); - ++it; - } - break; - case 5: // Absolute value - while (!it.IsAtEnd()) { - if (it.Get() <= 0) it.Set(PixelTypeDownCast(-it.Get())); - // <= zero to avoid warning for unsigned types - ++it; - } - break; - case 6: // Squared value - while (!it.IsAtEnd()) { - it.Set(PixelTypeDownCast((double)it.Get()*(double)it.Get())); - ++it; - } - break; - case 7: // Log - while (!it.IsAtEnd()) { - if (it.Get() > 0) - it.Set(PixelTypeDownCast(log((double)it.Get()))); - else it.Set(mDefaultPixelValue); - ++it; - } - break; - case 8: // exp - while (!it.IsAtEnd()) { - it.Set(PixelTypeDownCast(exp((double)it.Get()))); - ++it; - } - break; - case 9: // sqrt - while (!it.IsAtEnd()) { - if (it.Get() > 0) - it.Set(PixelTypeDownCast(sqrt((double)it.Get()))); - else { - if (it.Get() ==0) it.Set(0); - else it.Set(mDefaultPixelValue); - } - ++it; - } - break; - default: // error ? - std::cerr << "ERROR : the operation number (" << mTypeOfOperation << ") is not known." << std::endl; - exit(-1); - } - - return inputImage; -} -//-------------------------------------------------------------------- - -//-------------------------------------------------------------------- -template -typename ImageType1::Pointer -clitk::ImageArithmGenericFilter::ComputeImage(typename ImageType1::Pointer inputImage1, - typename ImageType2::Pointer inputImage2) { - - typedef typename ImageType1::PixelType PixelType; - typedef itk::ImageRegionIterator IteratorType; - IteratorType it1(inputImage1, inputImage1->GetLargestPossibleRegion()); - it1.GoToBegin(); - - typedef itk::ImageRegionConstIterator ConstIteratorType; - ConstIteratorType it2(inputImage2, inputImage2->GetLargestPossibleRegion()); - it2.GoToBegin(); - - switch (mTypeOfOperation) { - case 0: // Addition - while (!it1.IsAtEnd()) { - it1.Set(PixelTypeDownCast((double)it1.Get() + (double)it2.Get()) ); - ++it1; ++it2; - } - break; - case 1: // Multiply - while (!it1.IsAtEnd()) { - it1.Set(PixelTypeDownCast((double)it1.Get() * (double)it2.Get()) ); - ++it1; ++it2; - } - break; - case 2: // Divide - while (!it1.IsAtEnd()) { - if (it1.Get() != 0) - it1.Set(PixelTypeDownCast((double)it1.Get() / (double)it2.Get())); - else it1.Set(mDefaultPixelValue); - ++it1; ++it2; - } - break; - case 3: // Max - while (!it1.IsAtEnd()) { - if (it1.Get() < it2.Get()) it1.Set(PixelTypeDownCast(it2.Get())); - ++it1; ++it2; - } - break; - case 4: // Min - while (!it1.IsAtEnd()) { - if (it1.Get() > it2.Get()) it1.Set(PixelTypeDownCast(it2.Get())); - ++it1; ++it2; - } - break; - case 5: // Absolute difference - while (!it1.IsAtEnd()) { - it1.Set(PixelTypeDownCast(fabs(it2.Get()-it1.Get()))); - ++it1; ++it2; - } - break; - case 6: // Squared differences - while (!it1.IsAtEnd()) { - it1.Set(PixelTypeDownCast(pow((double)it1.Get()-(double)it2.Get(),2))); - ++it1; ++it2; - } - break; - case 7: // Difference - while (!it1.IsAtEnd()) { - it1.Set(PixelTypeDownCast((double)it1.Get()-(double)it2.Get())); - ++it1; ++it2; - } - break; - case 8: // Relative Difference - while (!it1.IsAtEnd()) { - if (it1.Get() != 0) it1.Set(PixelTypeDownCast(((double)it1.Get()-(double)it2.Get()))/(double)it1.Get()); - else it1.Set(0.0); - ++it1; ++it2; - } - break; - default: // error ? - std::cerr << "ERROR : the operation number (" << mTypeOfOperation << ") is not known." << std::endl; - exit(-1); - } - - return inputImage1; -} -//-------------------------------------------------------------------- #endif //define CLITKIMAGEARITHMGENERICFILTER_CXX diff --git a/filters/clitkImageArithmGenericFilter.h b/filters/clitkImageArithmGenericFilter.h index afc6134..ebe9c0b 100644 --- a/filters/clitkImageArithmGenericFilter.h +++ b/filters/clitkImageArithmGenericFilter.h @@ -24,7 +24,6 @@ // clitk include #include "clitkCommon.h" -#include "clitkImageCommon.h" #include "clitkImageToImageGenericFilter.h" // itk include @@ -33,32 +32,35 @@ #include "itkImageRegionIterator.h" #include "itkImageRegionConstIterator.h" +//-------------------------------------------------------------------- namespace clitk { - //-------------------------------------------------------------------- - // Main class for an Image Resample Generic Filter - // (multiple dimensions, multiple pixel types) - class ImageArithmGenericFilter: - public clitk::ImageToImageGenericFilter { - + template + class ITK_EXPORT ImageArithmGenericFilter: + public clitk::ImageToImageGenericFilter > { + public: // Constructor ImageArithmGenericFilter (); // Types - typedef ImageArithmGenericFilter Self; - typedef ImageToImageGenericFilterBase Superclass; - typedef itk::SmartPointer Pointer; - typedef itk::SmartPointer ConstPointer; + typedef ImageArithmGenericFilter Self; + typedef ImageToImageGenericFilterBase Superclass; + typedef itk::SmartPointer Pointer; + typedef itk::SmartPointer ConstPointer; // New itkNewMacro(Self); + //-------------------------------------------------------------------- + void SetArgsInfo(const args_info_type & a); + // Set methods void SetDefaultPixelValue (double value) { mDefaultPixelValue = value ;} void SetTypeOfOperation (int value) { mTypeOfOperation = value ;} void SetScalar (double value) { mScalar = value ;} + void EnableOverwriteInputImage(bool b); // Get methods double GetDefaultPixelValue () { return mDefaultPixelValue ;} @@ -76,23 +78,25 @@ namespace clitk { double mScalar; double mDefaultPixelValue; int mTypeOfOperation; + args_info_type mArgsInfo; + bool mOverwriteInputImage; + bool mOutputIsFloat; + + template + void ComputeImage(Iter1 it, Iter2 ito); - template - typename ImageType::Pointer ComputeImage(typename ImageType::Pointer inputImage); + template + void ComputeImage(Iter1 it1, Iter2 it2, Iter3 ito); - template - typename ImageType1::Pointer - ComputeImage(typename ImageType1::Pointer inputImage1, - typename ImageType2::Pointer inputImage2); //-------------------------------------------------------------------- }; // end class ImageArithmGenericFilter -//-------------------------------------------------------------------- - -//#include "clitkImageArithmGenericFilter.txx" - } // end namespace //-------------------------------------------------------------------- +#ifndef ITK_MANUAL_INSTANTIATION +#include "clitkImageArithmGenericFilter.txx" +#endif + #endif //#define CLITKIMAGEARITHMGENERICFILTER_H diff --git a/filters/clitkImageArithmGenericFilter.txx b/filters/clitkImageArithmGenericFilter.txx index 8557dc0..6d40681 100644 --- a/filters/clitkImageArithmGenericFilter.txx +++ b/filters/clitkImageArithmGenericFilter.txx @@ -13,229 +13,316 @@ #ifndef CLITKIMAGEARITHMGENERICFILTER_TXX #define CLITKIMAGEARITHMGENERICFILTER_TXX -/*------------------------------------------------- - * @file clitkImageArithmGenericFilter.txx - * @author David Sarrut - * @date 9 August 2006 - * - -------------------------------------------------*/ - -//-------------------------------------------------------------------- -template -void ImageArithmGenericFilter::Update_WithDim() { -#define TRY_TYPE(TYPE) \ - if (IsSameType(mPixelTypeName)) { Update_WithDimAndPixelType(); return; } - TRY_TYPE(char); - TRY_TYPE(uchar); - TRY_TYPE(short); - TRY_TYPE(ushort); - TRY_TYPE(int); - TRY_TYPE(unsigned int); - TRY_TYPE(float); - TRY_TYPE(double); -#undef TRY_TYPE - - std::string list = CreateListOfTypes(); - std::cerr << "Error, I don't know the type '" << mPixelTypeName << "' for the input image '" - << mInputFilenames[0] << "'." << std::endl << "Known types are " << list << std::endl; - exit(0); -} -//-------------------------------------------------------------------- - -//-------------------------------------------------------------------- -template -void ImageArithmGenericFilter::Update_WithDimAndPixelType() { - // Read input1 - typedef itk::Image ImageType; - typename ImageType::Pointer input1 = clitk::readImage(mInputFilenames[0], mIOVerbose); - typename ImageType::Pointer outputImage; - - // Read input2 (float is ok altough it could take too memory ...) - if (mIsOperationUseASecondImage) { - typedef itk::Image ImageType2; - typename ImageType2::Pointer input2 = clitk::readImage(mInputFilenames[1], mIOVerbose); - outputImage = ComputeImage(input1, input2); +namespace clitk +{ + + //-------------------------------------------------------------------- + template + ImageArithmGenericFilter::ImageArithmGenericFilter() + :ImageToImageGenericFilter("ImageArithmGenericFilter"),mTypeOfOperation(0) { + InitializeImageType<2>(); + InitializeImageType<3>(); + InitializeImageType<4>(); + mIsOperationUseASecondImage = false; + mOverwriteInputImage = true; } - else { - outputImage = ComputeImage(input1); + //-------------------------------------------------------------------- + + + //-------------------------------------------------------------------- + template + template + void ImageArithmGenericFilter::InitializeImageType() { + ADD_IMAGE_TYPE(Dim, char); + ADD_IMAGE_TYPE(Dim, short); + ADD_IMAGE_TYPE(Dim, float); } + //-------------------------------------------------------------------- - // Write results - this->SetNextOutput(outputImage); - //clitk::writeImage(outputImage, mOutputFilename, mIOVerbose); -} -//-------------------------------------------------------------------- - -//-------------------------------------------------------------------- -template -typename ImageType::Pointer -ImageArithmGenericFilter::ComputeImage(typename ImageType::Pointer inputImage) { - - typedef typename ImageType::PixelType PixelType; - typedef itk::ImageRegionIterator IteratorType; - IteratorType it(inputImage, inputImage->GetLargestPossibleRegion()); - it.GoToBegin(); - - switch (mTypeOfOperation) { - case 0: // Addition - while (!it.IsAtEnd()) { - it.Set(PixelTypeDownCast((double)it.Get() + mScalar) ); - ++it; - } - break; - case 1: // Multiply - while (!it.IsAtEnd()) { - it.Set(PixelTypeDownCast((double)it.Get() * mScalar) ); - ++it; - } - break; - case 2: // Inverse - while (!it.IsAtEnd()) { - if (it.Get() != 0) - it.Set(PixelTypeDownCast(mScalar / (double)it.Get())); - else it.Set(mDefaultPixelValue); - ++it; - } - break; - case 3: // Max - while (!it.IsAtEnd()) { - if (it.Get() < mScalar) it.Set(PixelTypeDownCast(mScalar)); - ++it; - } - break; - case 4: // Min - while (!it.IsAtEnd()) { - if (it.Get() > mScalar) it.Set(PixelTypeDownCast(mScalar)); - ++it; - } - break; - case 5: // Absolute value - while (!it.IsAtEnd()) { - if (it.Get() <= 0) it.Set(PixelTypeDownCast(-it.Get())); - // <= zero to avoid warning for unsigned types - ++it; - } - break; - case 6: // Squared value - while (!it.IsAtEnd()) { - it.Set(PixelTypeDownCast((double)it.Get()*(double)it.Get())); - ++it; - } - break; - case 7: // Log - while (!it.IsAtEnd()) { - if (it.Get() > 0) - it.Set(PixelTypeDownCast(log((double)it.Get()))); - else it.Set(mDefaultPixelValue); - ++it; + + //-------------------------------------------------------------------- + template + void ImageArithmGenericFilter::EnableOverwriteInputImage(bool b) { + mOverwriteInputImage = b; + } + //-------------------------------------------------------------------- + + + //-------------------------------------------------------------------- + template + void ImageArithmGenericFilter::SetArgsInfo(const args_info_type & a) { + mArgsInfo=a; + + // Set value + SetIOVerbose(mArgsInfo.verbose_flag); + mTypeOfOperation = mArgsInfo.operation_arg; + mDefaultPixelValue = mArgsInfo.pixelValue_arg; + mScalar = mArgsInfo.scalar_arg; + mOutputIsFloat = mArgsInfo.setFloatOutput_flag; + + if (mArgsInfo.imagetypes_flag) this->PrintAvailableImageTypes(); + + if (mArgsInfo.input1_given) AddInputFilename(mArgsInfo.input1_arg); + if (mArgsInfo.input2_given) { + mIsOperationUseASecondImage = true; + AddInputFilename(mArgsInfo.input2_arg); } - break; - case 8: // exp - while (!it.IsAtEnd()) { - it.Set(PixelTypeDownCast(exp((double)it.Get()))); - ++it; + + if (mArgsInfo.output_given) SetOutputFilename(mArgsInfo.output_arg); + + // Check type of operation (with scalar or with other image) + if ((mArgsInfo.input2_given) && (mArgsInfo.scalar_given)) { + std::cerr << "ERROR : you cannot provide both --scalar and --input2 option" << std::endl; + exit(-1); } - break; - case 9: // sqrt - while (!it.IsAtEnd()) { - if (it.Get() > 0) - it.Set(PixelTypeDownCast(sqrt((double)it.Get()))); - else { - if (it.Get() ==0) it.Set(0); - else it.Set(mDefaultPixelValue); + if ((!mArgsInfo.input2_given) && (!mArgsInfo.scalar_given)) { + if (mArgsInfo.operation_arg < 5) { + std::cerr << "Such operation need the --scalar option." << std::endl; + exit(-1); } - ++it; } - break; - default: // error ? - std::cerr << "ERROR : the operation number (" << mTypeOfOperation << ") is not known." << std::endl; - exit(-1); } + //-------------------------------------------------------------------- - return inputImage; -} -//-------------------------------------------------------------------- -//-------------------------------------------------------------------- -template -typename ImageType1::Pointer -ImageArithmGenericFilter::ComputeImage(typename ImageType1::Pointer inputImage1, - typename ImageType2::Pointer inputImage2) { + //-------------------------------------------------------------------- + template + template + void ImageArithmGenericFilter::UpdateWithInputImageType() { + // Read input1 + typename ImageType::Pointer input1 = this->template GetInput(0); + typename ImageType::PixelType PixelType; - typedef typename ImageType1::PixelType PixelType; - typedef itk::ImageRegionIterator IteratorType; - IteratorType it1(inputImage1, inputImage1->GetLargestPossibleRegion()); - it1.GoToBegin(); - - typedef itk::ImageRegionConstIterator ConstIteratorType; - ConstIteratorType it2(inputImage2, inputImage2->GetLargestPossibleRegion()); - it2.GoToBegin(); - - switch (mTypeOfOperation) { - case 0: // Addition - while (!it1.IsAtEnd()) { - it1.Set(PixelTypeDownCast((double)it1.Get() + (double)it2.Get()) ); - ++it1; ++it2; - } - break; - case 1: // Multiply - while (!it1.IsAtEnd()) { - it1.Set(PixelTypeDownCast((double)it1.Get() * (double)it2.Get()) ); - ++it1; ++it2; - } - break; - case 2: // Divide - while (!it1.IsAtEnd()) { - if (it1.Get() != 0) - it1.Set(PixelTypeDownCast((double)it1.Get() / (double)it2.Get())); - else it1.Set(mDefaultPixelValue); - ++it1; ++it2; - } - break; - case 3: // Max - while (!it1.IsAtEnd()) { - if (it1.Get() < it2.Get()) it1.Set(PixelTypeDownCast(it2.Get())); - ++it1; ++it2; + // Set input image iterator + typedef itk::ImageRegionIterator IteratorType; + IteratorType it(input1, input1->GetLargestPossibleRegion()); + + // typedef input2 + typename ImageType::Pointer input2 = this->template GetInput(1); + IteratorType it2; + + if (mIsOperationUseASecondImage) { + // Read input2 + input2 = this->template GetInput(1); + // Set input image iterator + it2 = IteratorType(input2, input2->GetLargestPossibleRegion()); } - break; - case 4: // Min - while (!it1.IsAtEnd()) { - if (it1.Get() > it2.Get()) it1.Set(PixelTypeDownCast(it2.Get())); - ++it1; ++it2; + + // Check if overwrite and outputisfloat and pixeltype is not float -> do not overwrite + if (mOverwriteInputImage && mOutputIsFloat && (typeid(PixelType) != typeid(float))) { + // std::cerr << "Warning. Could not use both mOverwriteInputImage and mOutputIsFloat, because input is " + // << typeid(PixelType).name() + // << std::endl; + mOverwriteInputImage = false; } - break; - case 5: // Absolute difference - while (!it1.IsAtEnd()) { - it1.Set(PixelTypeDownCast(fabs(it2.Get()-it1.Get()))); - ++it1; ++it2; + + // ---------------- Overwrite input Image --------------------- + if (mOverwriteInputImage) { + // Set output iterator (to input1) + IteratorType ito = IteratorType(input1, input1->GetLargestPossibleRegion()); + if (mIsOperationUseASecondImage) ComputeImage(it, it2, ito); + else ComputeImage(it, ito); + this->template SetNextOutput(input1); } - break; - case 6: // Squared differences - while (!it1.IsAtEnd()) { - it1.Set(PixelTypeDownCast(pow((double)it1.Get()-(double)it2.Get(),2))); - ++it1; ++it2; + + // ---------------- Create new output Image --------------------- + else { + if (mOutputIsFloat) { + // Create output image + typedef itk::Image OutputImageType; + typename OutputImageType::Pointer output = OutputImageType::New(); + output->SetRegions(input1->GetLargestPossibleRegion()); + output->SetOrigin(input1->GetOrigin()); + output->SetSpacing(input1->GetSpacing()); + output->Allocate(); + // Set output iterator + typedef itk::ImageRegionIterator IteratorOutputType; + IteratorOutputType ito = IteratorOutputType(output, output->GetLargestPossibleRegion()); + if (mIsOperationUseASecondImage) ComputeImage(it, it2, ito); + else ComputeImage(it, ito); + this->template SetNextOutput(output); + } + else { + // Create output image + typedef ImageType OutputImageType; + typename OutputImageType::Pointer output = OutputImageType::New(); + output->SetRegions(input1->GetLargestPossibleRegion()); + output->SetOrigin(input1->GetOrigin()); + output->SetSpacing(input1->GetSpacing()); + output->Allocate(); + // Set output iterator + typedef itk::ImageRegionIterator IteratorOutputType; + IteratorOutputType ito = IteratorOutputType(output, output->GetLargestPossibleRegion()); + if (mIsOperationUseASecondImage) ComputeImage(it, it2, ito); + else ComputeImage(it, ito); + this->template SetNextOutput(output); + } } - break; - case 7: // Difference - while (!it1.IsAtEnd()) { - it1.Set(PixelTypeDownCast((double)it1.Get()-(double)it2.Get())); - ++it1; ++it2; + } + //-------------------------------------------------------------------- + + //-------------------------------------------------------------------- + template + template + void ImageArithmGenericFilter::ComputeImage(Iter1 it1, Iter2 it2, Iter3 ito) { + it1.GoToBegin(); + it2.GoToBegin(); + ito.GoToBegin(); + typedef typename Iter3::PixelType PixelType; + + switch (mTypeOfOperation) { + case 0: // Addition + while (!ito.IsAtEnd()) { + ito.Set(PixelTypeDownCast((double)it1.Get() + (double)it2.Get()) ); + ++it1; ++it2; ++ito; + } + break; + case 1: // Multiply + while (!ito.IsAtEnd()) { + ito.Set(PixelTypeDownCast((double)it1.Get() * (double)it2.Get()) ); + ++it1; ++it2; ++ito; + } + break; + case 2: // Divide + while (!ito.IsAtEnd()) { + if (it1.Get() != 0) + ito.Set(PixelTypeDownCast((double)it1.Get() / (double)it2.Get())); + else ito.Set(mDefaultPixelValue); + ++it1; ++it2; ++ito; + } + break; + case 3: // Max + while (!ito.IsAtEnd()) { + if (it1.Get() < it2.Get()) ito.Set(PixelTypeDownCast(it2.Get())); + ++it1; ++it2; ++ito; + } + break; + case 4: // Min + while (!ito.IsAtEnd()) { + if (it1.Get() > it2.Get()) ito.Set(PixelTypeDownCast(it2.Get())); + ++it1; ++it2; ++ito; + } + break; + case 5: // Absolute difference + while (!ito.IsAtEnd()) { + ito.Set(PixelTypeDownCast(fabs(it2.Get()-it1.Get()))); + ++it1; ++it2; ++ito; + } + break; + case 6: // Squared differences + while (!ito.IsAtEnd()) { + ito.Set(PixelTypeDownCast(pow((double)it1.Get()-(double)it2.Get(),2))); + ++it1; ++it2; ++ito; + } + break; + case 7: // Difference + while (!ito.IsAtEnd()) { + ito.Set(PixelTypeDownCast((double)it1.Get()-(double)it2.Get())); + ++it1; ++it2; ++ito; + } + break; + case 8: // Relative Difference + while (!ito.IsAtEnd()) { + if (it1.Get() != 0) ito.Set(PixelTypeDownCast(((double)it1.Get()-(double)it2.Get()))/(double)it1.Get()); + else ito.Set(0.0); + ++it1; ++it2; ++ito; + } + break; + default: // error ? + std::cerr << "ERROR : the operation number (" << mTypeOfOperation << ") is not known." << std::endl; + exit(-1); } - break; - case 8: // Relative Difference - while (!it1.IsAtEnd()) { - if (it1.Get() != 0) it1.Set(PixelTypeDownCast(((double)it1.Get()-(double)it2.Get()))/(double)it1.Get()); - else it1.Set(0.0); - ++it1; ++it2; + } + //-------------------------------------------------------------------- + + + //-------------------------------------------------------------------- + template + template + void clitk::ImageArithmGenericFilter::ComputeImage(Iter1 it, Iter2 ito) { + ito.GoToBegin(); + it.GoToBegin(); + typedef typename Iter2::PixelType PixelType; + + // Perform operation + switch (mTypeOfOperation) { + case 0: // Addition + while (!it.IsAtEnd()) { + ito.Set(clitk::PixelTypeDownCast((double)it.Get() + mScalar) ); + ++it; ++ito; + } + break; + case 1: // Multiply + while (!it.IsAtEnd()) { + ito.Set(PixelTypeDownCast((double)it.Get() * mScalar) ); + ++it; ++ito; + } + break; + case 2: // Inverse + while (!it.IsAtEnd()) { + if (it.Get() != 0) + ito.Set(PixelTypeDownCast(mScalar / (double)it.Get())); + else ito.Set(mDefaultPixelValue); + ++it; ++ito; + } + break; + case 3: // Max + while (!it.IsAtEnd()) { + if (it.Get() < mScalar) ito.Set(PixelTypeDownCast(mScalar)); + ++it; ++ito; + } + break; + case 4: // Min + while (!it.IsAtEnd()) { + if (it.Get() > mScalar) ito.Set(PixelTypeDownCast(mScalar)); + ++it; ++ito; + } + break; + case 5: // Absolute value + while (!it.IsAtEnd()) { + if (it.Get() <= 0) ito.Set(PixelTypeDownCast(-it.Get())); + // <= zero to avoid warning for unsigned types + ++it; ++ito; + } + break; + case 6: // Squared value + while (!it.IsAtEnd()) { + ito.Set(PixelTypeDownCast((double)it.Get()*(double)it.Get())); + ++it; ++ito; + } + break; + case 7: // Log + while (!it.IsAtEnd()) { + if (it.Get() > 0) + ito.Set(PixelTypeDownCast(log((double)it.Get()))); + else ito.Set(mDefaultPixelValue); + ++it; ++ito; + } + break; + case 8: // exp + while (!it.IsAtEnd()) { + ito.Set(PixelTypeDownCast(exp((double)it.Get()))); + ++it; ++ito; + } + break; + case 9: // sqrt + while (!it.IsAtEnd()) { + if (it.Get() > 0) + ito.Set(PixelTypeDownCast(sqrt((double)it.Get()))); + else { + if (it.Get() ==0) ito.Set(0); + else ito.Set(mDefaultPixelValue); + } + ++it; ++ito; + } + break; + default: // error ? + std::cerr << "ERROR : the operation number (" << mTypeOfOperation << ") is not known." << std::endl; + exit(-1); } - break; - default: // error ? - std::cerr << "ERROR : the operation number (" << mTypeOfOperation << ") is not known." << std::endl; - exit(-1); } + //-------------------------------------------------------------------- - return inputImage1; -} -//-------------------------------------------------------------------- +} // end namespace #endif //#define CLITKIMAGEARITHMGENERICFILTER_TXX diff --git a/filters/clitkImageResampleGenericFilter.cxx b/filters/clitkImageResampleGenericFilter.cxx index 7302cbe..ac9d0c5 100644 --- a/filters/clitkImageResampleGenericFilter.cxx +++ b/filters/clitkImageResampleGenericFilter.cxx @@ -45,6 +45,7 @@ clitk::ImageResampleGenericFilter::ImageResampleGenericFilter(): template void clitk::ImageResampleGenericFilter::InitializeImageTypeWithDim() { ADD_IMAGE_TYPE(Dim, char); + ADD_IMAGE_TYPE(Dim, unsigned char); ADD_IMAGE_TYPE(Dim, short); ADD_IMAGE_TYPE(Dim, int); ADD_IMAGE_TYPE(Dim, float); diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index e4f561f..bd7eb8a 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -24,9 +24,6 @@ TARGET_LINK_LIBRARIES(clitkImageResample clitkCommon ITKIO clitkFilters) ADD_EXECUTABLE(clitkVFResample clitkVFResample.cxx clitkImageResample_ggo.c) TARGET_LINK_LIBRARIES(clitkVFResample clitkCommon ITKIO clitkFilters) -ADD_EXECUTABLE(clitkImageArithm clitkImageArithm.cxx clitkImageArithm_ggo.c) -TARGET_LINK_LIBRARIES(clitkImageArithm clitkCommon ITKIO ITKStatistics clitkFilters) - ADD_EXECUTABLE(clitkImageCreate clitkImageCreate.cxx clitkImageCreate_ggo.c) TARGET_LINK_LIBRARIES(clitkImageCreate clitkCommon ITKStatistics ITKIO) @@ -77,5 +74,8 @@ ADD_EXECUTABLE(clitkGuerreroVentilation clitkGuerreroVentilation.cxx TARGET_LINK_LIBRARIES(clitkGuerreroVentilation clitkCommon ITKIO ITKBasicFilters clitkFilters) +ADD_EXECUTABLE(clitkImageArithm clitkImageArithm.cxx) +TARGET_LINK_LIBRARIES(clitkImageArithm clitkCommon ITKIO ITKStatistics clitkFilters) + ADD_EXECUTABLE(clitkBinarizeImage clitkBinarizeImage.cxx) TARGET_LINK_LIBRARIES(clitkBinarizeImage clitkCommon ITKIO clitkFilters) diff --git a/tools/clitkBinarizeImage.cxx b/tools/clitkBinarizeImage.cxx index ce10a07..114bf83 100644 --- a/tools/clitkBinarizeImage.cxx +++ b/tools/clitkBinarizeImage.cxx @@ -31,8 +31,8 @@ int main(int argc, char * argv[]) { CLITK_INIT; // Filter - clitk::BinarizeImageGenericFilter::Pointer filter = - clitk::BinarizeImageGenericFilter::New(); + typedef clitk::BinarizeImageGenericFilter FilterType; + FilterType::Pointer filter = FilterType::New(); filter->SetArgsInfo(args_info); filter->Update(); diff --git a/tools/clitkImageArithm.cxx b/tools/clitkImageArithm.cxx index 0b7b36e..24e3748 100644 --- a/tools/clitkImageArithm.cxx +++ b/tools/clitkImageArithm.cxx @@ -23,88 +23,23 @@ // clitk include #include "clitkImageArithm_ggo.h" #include "clitkImageArithmGenericFilter.h" -#include "clitkIO.h" //-------------------------------------------------------------------- int main(int argc, char * argv[]) { // Init command line GGO(clitkImageArithm, args_info); - CLITK_INIT; - // Check that we have either the 2nd image or the scalar - if ((args_info.input2_given) && (args_info.scalar_given)) { - std::cerr << "ERROR : you cannot provide both --scalar and --input2 option" << std::endl; - exit(-1); - } - if ((!args_info.input2_given) && (!args_info.scalar_given)) { - if (args_info.operation_arg < 5) { - std::cerr << "Such operation need the --scalar option." << std::endl; - exit(-1); - } - } - - // Read input image header1 to check image dimension - itk::ImageIOBase::Pointer header1 = clitk::readImageHeader(args_info.input1_arg); - unsigned int dim1 = header1->GetNumberOfDimensions(); - std::string pixelTypeName = header1->GetComponentTypeAsString(header1->GetComponentType()); - - // Options for arithm operation between 2 images - if (args_info.input2_given) { - - itk::ImageIOBase::Pointer header2 = clitk::readImageHeader(args_info.input2_arg); - unsigned int dim2 = header2->GetNumberOfDimensions(); - std::string pixelTypeName2 = header2->GetComponentTypeAsString(header1->GetComponentType()); - - // Check dimension - if (dim1 != dim2) { - std::cerr << "Images should have the same dimension : " <GetDimensions(1)<< std::endl; - std::cerr << "Dimensions X and Y of input2: = " << header2->GetDimensions(0) <<" "<< header2->GetDimensions(1)<< std::endl; - exit(-1); - } - }//end for - if (dim1 == 3) { - if (header1->GetDimensions(2) < header2->GetDimensions(2)) { - std::cerr << "ERROR: Z size in input1 is greater than in input2. " << std::endl; - std::cerr << "Size input1 : " << header1->GetDimensions(0) << " " << header1->GetDimensions(1)<< " " << header1->GetDimensions(2) << std::endl; - std::cerr << "Size input2 : " << header2->GetDimensions(0) << " " << header2->GetDimensions(1)<< " " << header2->GetDimensions(2) << std::endl; - } - } - } //end if operation between 2 images - // Creation of a generic filter - clitk::ImageArithmGenericFilter::Pointer filter = clitk::ImageArithmGenericFilter::New(); - filter->AddInputFilename(args_info.input1_arg); - if (args_info.input2_given) filter->AddInputFilename(args_info.input2_arg); - else filter->SetScalar(args_info.scalar_arg); - //if (args_info.binary_given) filter->SetBinaryMaskFilename(args_info.binary_arg); - filter->SetTypeOfOperation(args_info.operation_arg); - filter->SetDefaultPixelValue(args_info.pixelValue_arg); - filter->SetOutputFilename(args_info.output_arg); + typedef clitk::ImageArithmGenericFilter FilterType; + FilterType::Pointer filter = FilterType::New(); - // Go ! + // Go ! + filter->SetArgsInfo(args_info); filter->Update(); - + // this is the end my friend - return 0; + return EXIT_SUCCESS; } // end main #endif //define CLITKIMAGEARITHM_CXX diff --git a/vv/CMakeLists.txt b/vv/CMakeLists.txt index b50d889..9d9c89f 100644 --- a/vv/CMakeLists.txt +++ b/vv/CMakeLists.txt @@ -110,6 +110,7 @@ SET(vv_SRCS vvToolSimpleInputSelectorWidget.cxx vvToolInputSelectorWidget.cxx vvImageContour.cxx + vvToolImageArithm.cxx ) QT4_WRAP_CPP(vv_SRCS @@ -139,6 +140,7 @@ QT4_WRAP_CPP(vv_SRCS vvToolInputSelectorWidget.h vvToolWidgetBase.h vvToolCropImage.h + vvToolImageArithm.h ) QT4_WRAP_UI(vv_UI_CXX @@ -158,12 +160,13 @@ QT4_WRAP_UI(vv_UI_CXX qt_ui/vvStructSelector.ui qt_ui/vvDummyWindow.ui #For testing qt_ui/vvIntensityValueSlider.ui + qt_ui/vvToolSimpleInputSelectorWidget.ui + qt_ui/vvToolInputSelectorWidget.ui qt_ui/vvToolWidgetBase.ui # qt_ui/vvToolFoo.ui qt_ui/vvToolCropImage.ui qt_ui/vvToolBinarize.ui - qt_ui/vvToolSimpleInputSelectorWidget.ui - qt_ui/vvToolInputSelectorWidget.ui + qt_ui/vvToolImageArithm.ui ) SET(vvUI_RCCS vvIcons.qrc) diff --git a/vv/qt_ui/vvToolSimpleInputSelectorWidget.ui b/vv/qt_ui/vvToolSimpleInputSelectorWidget.ui index 449c9de..8fafb50 100644 --- a/vv/qt_ui/vvToolSimpleInputSelectorWidget.ui +++ b/vv/qt_ui/vvToolSimpleInputSelectorWidget.ui @@ -6,8 +6,8 @@ 0 0 - 573 - 125 + 407 + 82 @@ -18,7 +18,7 @@ 0 - + 75 @@ -47,104 +47,22 @@ - - - - 50 - false - - - - Already open - - - - 1 - - - - - - 11 - 50 - false - - - - - Bidon image number 1 - - - - - - - - - - - - 50 - false - - - - OR - - - false - - - - - + - false + true + 11 50 false - - Open a new file - - - - 3 - - - 3 - - - 3 - - - 1 + + + Bidon image number 1 - - - - Or open a new one - - - - - - - ... - - - - - - - /home/toto/truc.mhd - - - - + @@ -173,7 +91,7 @@ QFrame::NoFrame - 3D image Pixel type short bla bla + No selected image @@ -201,38 +119,5 @@ - - - mRadioButtonLowerThan - toggled(bool) - groupBox_3 - setEnabled(bool) - - - 296 - 102 - - - 528 - 122 - - - - - mRadioButtonLowerThan - toggled(bool) - mInputSequenceBox - setDisabled(bool) - - - 269 - 93 - - - 214 - 93 - - - - + diff --git a/vv/qt_ui/vvToolWidgetBase.ui b/vv/qt_ui/vvToolWidgetBase.ui index 567b595..7cfdbed 100644 --- a/vv/qt_ui/vvToolWidgetBase.ui +++ b/vv/qt_ui/vvToolWidgetBase.ui @@ -6,8 +6,8 @@ 0 0 - 615 - 372 + 178 + 61 diff --git a/vv/vvMainWindow.cxx b/vv/vvMainWindow.cxx index 1dbd8e4..36b7db0 100644 --- a/vv/vvMainWindow.cxx +++ b/vv/vvMainWindow.cxx @@ -3,8 +3,8 @@ Program: vv Module: $RCSfile: vvMainWindow.cxx,v $ Language: C++ - Date: $Date: 2010/03/10 15:36:26 $ - Version: $Revision: 1.16 $ + Date: $Date: 2010/03/24 10:48:18 $ + Version: $Revision: 1.17 $ Author : Pierre Seroul (pierre.seroul@gmail.com) Copyright (C) 200COLUMN_IMAGE_NAME @@ -439,7 +439,7 @@ void vvMainWindow::OpenDCStructContour() { if (mSlicerManagers.size() > 0) { - QString Extensions = "Dicom Files ( *.dcm)"; + QString Extensions = "Dicom Files ( *.dcm; RS*)"; Extensions += ";;All Files (*)"; QString file = QFileDialog::getOpenFileName(this,tr("Merge Images"),mInputPathName,Extensions); if (file.isNull()) diff --git a/vv/vvToolBinarize.cxx b/vv/vvToolBinarize.cxx index 343350c..42154e3 100644 --- a/vv/vvToolBinarize.cxx +++ b/vv/vvToolBinarize.cxx @@ -3,8 +3,8 @@ Program: vv Module: $RCSfile: vvToolBinarize.cxx,v $ Language: C++ - Date: $Date: 2010/03/17 11:22:18 $ - Version: $Revision: 1.12 $ + Date: $Date: 2010/03/24 10:48:18 $ + Version: $Revision: 1.13 $ Author : David Sarrut (david.sarrut@creatis.insa-lyon.fr) Copyright (C) 2008 @@ -79,7 +79,7 @@ vvToolBinarize::vvToolBinarize(vvMainWindowBase * parent, Qt::WindowFlags f) mFilter = new clitk::BinarizeImageGenericFilter; // Set how many inputs are needed for this tool - AddInputSelector(mFilter); + AddInputSelector("Select one image", mFilter); } //------------------------------------------------------------------------------ @@ -131,7 +131,7 @@ bool vvToolBinarize::close() { //------------------------------------------------------------------------------ void vvToolBinarize::reject() { - DD("vvToolBinarize::reject"); + // DD("vvToolBinarize::reject"); RemoveVTKObjects(); return vvToolWidgetBase::reject(); } @@ -295,8 +295,9 @@ void vvToolBinarize::apply() { // Main filter clitk::BinarizeImageGenericFilter::Pointer filter = clitk::BinarizeImageGenericFilter::New(); - filter->SetArgsInfo(mArgsInfo); filter->SetInputVVImage(mCurrentImage); + filter->SetArgsInfo(mArgsInfo); + filter->EnableReadOnDisk(false); filter->Update(); // Output diff --git a/vv/vvToolBinarize.h b/vv/vvToolBinarize.h index fbc5a24..e6abdfe 100644 --- a/vv/vvToolBinarize.h +++ b/vv/vvToolBinarize.h @@ -3,8 +3,8 @@ Program: vv Module: $RCSfile: vvToolBinarize.h,v $ Language: C++ - Date: $Date: 2010/03/17 11:22:18 $ - Version: $Revision: 1.9 $ + Date: $Date: 2010/03/24 10:48:18 $ + Version: $Revision: 1.10 $ Author : David Sarrut (david.sarrut@creatis.insa-lyon.fr) Copyright (C) 2010 @@ -49,10 +49,8 @@ class vvToolBinarize: //----------------------------------------------------- static void Initialize(); - void InputIsSet(bool b); void GetArgsInfoFromGUI(); virtual void InputIsSelected(vvSlicerManager * m); - // virtual void InputIsSelected(std::vector & m); //----------------------------------------------------- public slots: diff --git a/vv/vvToolCropImage.cxx b/vv/vvToolCropImage.cxx index b50e332..c9a0c0d 100644 --- a/vv/vvToolCropImage.cxx +++ b/vv/vvToolCropImage.cxx @@ -3,8 +3,8 @@ Program: vv Module: $RCSfile: vvToolCropImage.cxx,v $ Language: C++ - Date: $Date: 2010/03/17 11:22:18 $ - Version: $Revision: 1.4 $ + Date: $Date: 2010/03/24 10:48:18 $ + Version: $Revision: 1.5 $ Author : David Sarrut (david.sarrut@creatis.insa-lyon.fr) Copyright (C) 2008 @@ -52,7 +52,7 @@ vvToolCropImage::vvToolCropImage(vvMainWindowBase * parent, Qt::WindowFlags f): Ui_vvToolCropImage::setupUi(mToolWidget); // Set how many inputs are needed for this tool - AddInputSelector(); + AddInputSelector("Select one image"); } //------------------------------------------------------------------------------ diff --git a/vv/vvToolFooWithWidgetBase.cxx b/vv/vvToolFooWithWidgetBase.cxx index 638ca0a..23adc9d 100644 --- a/vv/vvToolFooWithWidgetBase.cxx +++ b/vv/vvToolFooWithWidgetBase.cxx @@ -3,8 +3,8 @@ Program: vv Module: $RCSfile: vvToolFooWithWidgetBase.cxx,v $ Language: C++ - Date: $Date: 2010/03/01 08:37:19 $ - Version: $Revision: 1.1 $ + Date: $Date: 2010/03/24 10:48:18 $ + Version: $Revision: 1.2 $ Author : David Sarrut (david.sarrut@creatis.insa-lyon.fr) Copyright (C) 2010 @@ -62,7 +62,7 @@ void vvToolFooWithWidgetBase::Initialize() { //------------------------------------------------------------------------------ void vvToolFooWithWidgetBase::InputIsSelected(vvSlicerManager *m) { - mButton->setText(m->GetFileName().c_str()); + } //------------------------------------------------------------------------------ diff --git a/vv/vvToolFooWithWidgetBase.h b/vv/vvToolFooWithWidgetBase.h index e549e9b..77340de 100644 --- a/vv/vvToolFooWithWidgetBase.h +++ b/vv/vvToolFooWithWidgetBase.h @@ -3,8 +3,8 @@ Program: vv Module: $RCSfile: vvToolFooWithWidgetBase.h,v $ Language: C++ - Date: $Date: 2010/03/01 08:37:19 $ - Version: $Revision: 1.1 $ + Date: $Date: 2010/03/24 10:48:18 $ + Version: $Revision: 1.2 $ Author : David Sarrut (david.sarrut@creatis.insa-lyon.fr) Copyright (C) 2010 @@ -29,7 +29,6 @@ #define VVTOOLFOO_H #include -#include #include "vvToolBase.h" #include "vvToolWidgetBase.h" @@ -48,6 +47,7 @@ class vvToolFooWithWidgetBase: static void Initialize(); virtual void InputIsSelected(vvSlicerManager *m); + // OR ===> virtual void InputIsSelected(std::vector & m); public slots: virtual void apply(); diff --git a/vv/vvToolInputSelectorWidget.cxx b/vv/vvToolInputSelectorWidget.cxx index 2579660..1542c4b 100644 --- a/vv/vvToolInputSelectorWidget.cxx +++ b/vv/vvToolInputSelectorWidget.cxx @@ -3,8 +3,8 @@ Program: vv Module: $RCSfile: vvToolInputSelectorWidget.cxx,v $ Language: C++ - Date: $Date: 2010/03/17 11:22:18 $ - Version: $Revision: 1.4 $ + Date: $Date: 2010/03/24 10:48:18 $ + Version: $Revision: 1.5 $ Author : David Sarrut (david.sarrut@creatis.insa-lyon.fr) Copyright (C) 2010 @@ -49,12 +49,19 @@ int vvToolInputSelectorWidget::GetNumberOfInput() { //------------------------------------------------------------------------------ -void vvToolInputSelectorWidget::AddInputSelector(const std::vector & l, int index) { - DD("ICICICICICICICIC AddInputSelector ADD layout"); - DD(index); - DD(l.size()); +void vvToolInputSelectorWidget::AddInputSelector(QString & s, + const std::vector & l, + int index, + bool allowSkip) { + // DD("ICICICICICICICIC AddInputSelector ADD layout"); + // DD(index); + //DD(l.size()); vvToolSimpleInputSelectorWidget * input = new vvToolSimpleInputSelectorWidget; mListOfSimpleInputWidget.push_back(input); + mSkipInput.push_back(false); + + input->SetText(s); + input->EnableAllowSkip(allowSkip); // copy list std::vector * ll = new std::vector; @@ -69,11 +76,12 @@ void vvToolInputSelectorWidget::AddInputSelector(const std::vectorsetEnabled(true); else input->setEnabled(false); - DD(GetNumberOfInput()); + //DD(GetNumberOfInput()); // Connect signals & slots connect(input, SIGNAL(accepted()), this, SLOT(accept())); connect(input, SIGNAL(rejected()), this, SLOT(reject())); + connect(input, SIGNAL(sigskip()), this, SLOT(skip())); } //------------------------------------------------------------------------------ @@ -88,19 +96,19 @@ void vvToolInputSelectorWidget::Initialize() { //------------------------------------------------------------------------------ void vvToolInputSelectorWidget::accept() { - DD("vvToolInputSelectorWidget::accept"); - DD(mNumberOfAcceptedInputs); + // DD("vvToolInputSelectorWidget::accept"); + //DD(mNumberOfAcceptedInputs); mNumberOfAcceptedInputs++; if (mNumberOfAcceptedInputs == GetNumberOfInput()) { setEnabled(false); emit accepted(); } else { - DD("accepted"); + //DD("accepted"); // for(unsigned int i=mNumberOfAcceptedInputs; iInitialize(); - mListOfSimpleInputWidget[mNumberOfAcceptedInputs]->setEnabled(true); - //} + // mListOfSimpleInputWidget[i]->Initialize(); + mListOfSimpleInputWidget[mNumberOfAcceptedInputs]->setEnabled(true); + //} } } //------------------------------------------------------------------------------ @@ -108,11 +116,11 @@ void vvToolInputSelectorWidget::accept() { //------------------------------------------------------------------------------ void vvToolInputSelectorWidget::reject() { - DD("vvToolInputSelectorWidget::reject"); + // DD("vvToolInputSelectorWidget::reject"); if (mNumberOfAcceptedInputs != 0) { // for(unsigned int i=mNumberOfAcceptedInputs; iInitialize(); - DD(mNumberOfAcceptedInputs); + // DD(mNumberOfAcceptedInputs); mListOfSimpleInputWidget[mNumberOfAcceptedInputs]->setEnabled(false); mListOfSimpleInputWidget[mNumberOfAcceptedInputs-1]->setEnabled(true); mNumberOfAcceptedInputs--; @@ -125,11 +133,22 @@ void vvToolInputSelectorWidget::reject() { //------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ +void vvToolInputSelectorWidget::skip() { + DD("SKIP"); + mSkipInput[mNumberOfAcceptedInputs] = true; + accept();//mNumberOfAcceptedInputs++; +} +//------------------------------------------------------------------------------ + + //------------------------------------------------------------------------------ std::vector & vvToolInputSelectorWidget::GetSelectedInputs() { std::vector * l = new std::vector; - for(unsigned int i=0; ipush_back(mListOfSimpleInputWidget[i]->GetSelectedInput()); + for(unsigned int i=0; ipush_back(mListOfSimpleInputWidget[i]->GetSelectedInput()); + } return *l; } //------------------------------------------------------------------------------ @@ -137,7 +156,7 @@ std::vector & vvToolInputSelectorWidget::GetSelectedInputs() { //------------------------------------------------------------------------------ void vvToolInputSelectorWidget::AnImageIsBeingClosed(vvSlicerManager * m) { - DD("TODO : verify that the image still exist !!"); + // DD("TODO : verify that the image still exist !!"); // for(int i=0; i< } //------------------------------------------------------------------------------ diff --git a/vv/vvToolInputSelectorWidget.h b/vv/vvToolInputSelectorWidget.h index 8aef39d..f9f5a0b 100644 --- a/vv/vvToolInputSelectorWidget.h +++ b/vv/vvToolInputSelectorWidget.h @@ -3,8 +3,8 @@ Program: vv Module: $RCSfile: vvToolInputSelectorWidget.h,v $ Language: C++ - Date: $Date: 2010/03/17 11:22:18 $ - Version: $Revision: 1.5 $ + Date: $Date: 2010/03/24 10:48:18 $ + Version: $Revision: 1.6 $ Author : David Sarrut (david.sarrut@creatis.insa-lyon.fr) Copyright (C) 2010 @@ -43,7 +43,7 @@ class vvToolInputSelectorWidget: public QWidget, private Ui::vvToolInputSelector vvToolInputSelectorWidget(QWidget * parent=0, Qt::WindowFlags f=0); ~vvToolInputSelectorWidget() {} - void AddInputSelector(const std::vector & l, int index); + void AddInputSelector(QString & s, const std::vector & l, int index, bool allowSkip=false); void Initialize(); std::vector & GetSelectedInputs(); void AnImageIsBeingClosed(vvSlicerManager * m); @@ -52,6 +52,7 @@ class vvToolInputSelectorWidget: public QWidget, private Ui::vvToolInputSelector public slots: void accept(); // to change ! in something like acceptOneMoreInput void reject(); + void skip(); signals: void accepted(); @@ -66,6 +67,7 @@ class vvToolInputSelectorWidget: public QWidget, private Ui::vvToolInputSelector vvSlicerManager * mCurrentSliceManager; int mNumberOfAcceptedInputs; std::vector mListOfSimpleInputWidget; + std::vector mSkipInput; }; // end class vvToolInputSelectorWidget //------------------------------------------------------------------------------ diff --git a/vv/vvToolSimpleInputSelectorWidget.cxx b/vv/vvToolSimpleInputSelectorWidget.cxx index 70700fc..fcc1361 100644 --- a/vv/vvToolSimpleInputSelectorWidget.cxx +++ b/vv/vvToolSimpleInputSelectorWidget.cxx @@ -3,8 +3,8 @@ Program: vv Module: $RCSfile: vvToolSimpleInputSelectorWidget.cxx,v $ Language: C++ - Date: $Date: 2010/03/17 11:23:46 $ - Version: $Revision: 1.1 $ + Date: $Date: 2010/03/24 10:48:18 $ + Version: $Revision: 1.2 $ Author : David Sarrut (david.sarrut@creatis.insa-lyon.fr) Copyright (C) 2010 @@ -30,6 +30,7 @@ #include "vvToolSimpleInputSelectorWidget.h" #include "vvSlicerManager.h" +#include //------------------------------------------------------------------------------ vvToolSimpleInputSelectorWidget::vvToolSimpleInputSelectorWidget(QWidget * parent, Qt::WindowFlags f): @@ -47,20 +48,36 @@ void vvToolSimpleInputSelectorWidget::Initialize() { connect(mInputSelectionButtonBox, SIGNAL(accepted()), this, SLOT(accept())); connect(mInputSelectionButtonBox, SIGNAL(rejected()), this, SLOT(reject())); connect(mInputSequenceBox, SIGNAL(currentIndexChanged(int)), this, SLOT(changeInput(int))); - DD("vvToolSimpleInputSelectorWidget::Initialize"); - DD(mSlicerManagerList.size()); + changeInput(0); if (mSlicerManagerList.size() == 1) { - DD("Initialize::accept"); - accept(); + if (!mAllowSkip) accept(); } } //------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ +void vvToolSimpleInputSelectorWidget::SetText(QString & s) { + mGroupBox->setTitle(s); +} +//------------------------------------------------------------------------------ + + +//------------------------------------------------------------------------------ +void vvToolSimpleInputSelectorWidget::EnableAllowSkip(bool b) { + mAllowSkip = b; + if (mAllowSkip) { + mInputSelectionButtonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok|QDialogButtonBox::Discard); + connect(mInputSelectionButtonBox, SIGNAL(clicked(QAbstractButton*)), this, SLOT(skip(QAbstractButton*))); + } + else + mInputSelectionButtonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok); +} +//------------------------------------------------------------------------------ + + //------------------------------------------------------------------------------ void vvToolSimpleInputSelectorWidget::SetInputList(const std::vector & l, int index) { - DD("vvToolSimpleInputSelectorWidget::SetInputList"); - DD(index); mInputSequenceBox->clear(); for(unsigned int i=0; itext() == "Discard") emit sigskip(); +} +//------------------------------------------------------------------------------ + + //------------------------------------------------------------------------------ void vvToolSimpleInputSelectorWidget::changeInput(int index) { - DD("changeInput"); - DD(index); if (index<0) return; mCurrentIndex = index; vvImage * mCurrentImage = mSlicerManagerList[index]->GetImage(); diff --git a/vv/vvToolSimpleInputSelectorWidget.h b/vv/vvToolSimpleInputSelectorWidget.h index 4410b0d..bde29c8 100644 --- a/vv/vvToolSimpleInputSelectorWidget.h +++ b/vv/vvToolSimpleInputSelectorWidget.h @@ -3,8 +3,8 @@ Program: vv Module: $RCSfile: vvToolSimpleInputSelectorWidget.h,v $ Language: C++ - Date: $Date: 2010/03/17 11:23:45 $ - Version: $Revision: 1.1 $ + Date: $Date: 2010/03/24 10:48:18 $ + Version: $Revision: 1.2 $ Author : David Sarrut (david.sarrut@creatis.insa-lyon.fr) Copyright (C) 2010 @@ -46,15 +46,19 @@ class vvToolSimpleInputSelectorWidget: public QWidget, private Ui::vvToolSimpleI void Initialize(); int GetSelectedInputIndex() { return mCurrentIndex; } vvSlicerManager * GetSelectedInput(); + void SetText(QString & s); + void EnableAllowSkip(bool b); public slots: void accept(); void reject(); void setEnabled(bool b); + void skip(QAbstractButton*); signals: void accepted(); void rejected(); + void sigskip(); protected slots: void changeInput(int i); @@ -64,6 +68,7 @@ class vvToolSimpleInputSelectorWidget: public QWidget, private Ui::vvToolSimpleI std::vector mSlicerManagerList; int mCurrentIndex; vvSlicerManager * mCurrentSliceManager; + bool mAllowSkip; }; // end class vvToolSimpleInputSelectorWidget //------------------------------------------------------------------------------ diff --git a/vv/vvToolWidgetBase.cxx b/vv/vvToolWidgetBase.cxx index e08d54f..28270dc 100644 --- a/vv/vvToolWidgetBase.cxx +++ b/vv/vvToolWidgetBase.cxx @@ -3,8 +3,8 @@ Program: vv Module: $RCSfile: vvToolWidgetBase.cxx,v $ Language: C++ - Date: $Date: 2010/03/17 11:22:18 $ - Version: $Revision: 1.3 $ + Date: $Date: 2010/03/24 10:48:18 $ + Version: $Revision: 1.4 $ Author : David Sarrut (david.sarrut@creatis.insa-lyon.fr) Copyright (C) 2008 @@ -28,6 +28,7 @@ #include "vvToolWidgetBase.h" #include "vvMainWindowBase.h" #include "vvSlicerManager.h" +#include //------------------------------------------------------------------------------ vvToolWidgetBase::vvToolWidgetBase(vvMainWindowBase * parent, Qt::WindowFlags f) @@ -77,15 +78,15 @@ vvToolWidgetBase::~vvToolWidgetBase() { //------------------------------------------------------------------------------ -void vvToolWidgetBase::AddInputSelector(clitk::ImageToImageGenericFilterBase * f) { - DD("AddInputSelector with filter"); - DD(mMainWindowBase->GetSlicerManagers().size()); +void vvToolWidgetBase::AddInputSelector(QString s, clitk::ImageToImageGenericFilterBase * f, bool allowSkip) { + // DD("AddInputSelector with filter"); + // DD(mMainWindowBase->GetSlicerManagers().size()); int j=0; mFilter = f; mSlicerManagersCompatible.clear(); // mToolInputSelectionWidget->setToolTip(QString("%1").arg(mFilter->GetAvailableImageTypes().c_str())); for(unsigned int i=0; iGetSlicerManagers().size(); i++) { - DD(i); + // DD(i); vvImage * s = mMainWindowBase->GetSlicerManagers()[i]->GetImage(); if (mFilter->CheckImageType(s->GetNumberOfDimensions(), s->GetNumberOfScalarComponents(), @@ -95,40 +96,50 @@ void vvToolWidgetBase::AddInputSelector(clitk::ImageToImageGenericFilterBase * f j++; } } - mToolInputSelectionWidget->AddInputSelector(mSlicerManagersCompatible, mCurrentCompatibleIndex); + if (mSlicerManagersCompatible.size() == 0) { + QMessageBox::information(this, "No image","Sorry, could not perform operation. No compatible opened image type."); + close(); + return; + } + mToolInputSelectionWidget->AddInputSelector(s, mSlicerManagersCompatible, mCurrentCompatibleIndex, allowSkip); } //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ -void vvToolWidgetBase::AddInputSelector() { - DD("AddInput without filter"); - DD(mMainWindowBase->GetSlicerManagers().size()); +void vvToolWidgetBase::AddInputSelector(QString s, bool allowSkip) { + // DD("AddInput without filter"); + // DD(mMainWindowBase->GetSlicerManagers().size()); mSlicerManagersCompatible.clear(); for(unsigned int i=0; iGetSlicerManagers().size(); i++) { mSlicerManagersCompatible.push_back(mMainWindowBase->GetSlicerManagers()[i]); } - mToolInputSelectionWidget->AddInputSelector(mMainWindowBase->GetSlicerManagers(), - mMainWindowBase->GetSlicerManagerCurrentIndex()); + if (mMainWindowBase->GetSlicerManagers().size() == 0) { + QMessageBox::information(this, "No image","Sorry, could not perform operation. No opened image type."); + close(); + return; + } + mToolInputSelectionWidget->AddInputSelector(s, mMainWindowBase->GetSlicerManagers(), + mMainWindowBase->GetSlicerManagerCurrentIndex(), allowSkip); } //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ void vvToolWidgetBase::show() { - if (!mIsInitialized) { - DD("show -> init"); - mToolInputSelectionWidget->Initialize(); - mIsInitialized = true; - } - QDialog::show(); + if (!mIsInitialized) { + // DD("show -> init"); + mToolInputSelectionWidget->Initialize(); + mIsInitialized = true; + } + QDialog::show(); } //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ bool vvToolWidgetBase::close() { - DD("vvToolWidgetBase::close()"); + // DD("vvToolWidgetBase::close()"); return QDialog::close(); } //------------------------------------------------------------------------------ @@ -136,7 +147,7 @@ bool vvToolWidgetBase::close() { //------------------------------------------------------------------------------ void vvToolWidgetBase::AnImageIsBeingClosed(vvSlicerManager * m) { - mToolInputSelectionWidget->AnImageIsBeingClosed(m); + mToolInputSelectionWidget->AnImageIsBeingClosed(m); if (m == mCurrentSlicerManager) { close(); } @@ -147,27 +158,27 @@ void vvToolWidgetBase::AnImageIsBeingClosed(vvSlicerManager * m) { //------------------------------------------------------------------------------ void vvToolWidgetBase::InitializeInputs() { /* - if (mFilter) { + if (mFilter) { int j=0; mToolInputSelectionWidget->setToolTip(QString("%1").arg(mFilter->GetAvailableImageTypes().c_str())); for(unsigned int i=0; iGetSlicerManagers().size(); i++) { - vvImage * s = mMainWindowBase->GetSlicerManagers()[i]->GetImage(); - if (mFilter->CheckImageType(s->GetNumberOfDimensions(), - s->GetNumberOfScalarComponents(), - s->GetScalarTypeAsString())) { - mSlicerManagersCompatible.push_back(mMainWindowBase->GetSlicerManagers()[i]); - if ((int)i == mMainWindowBase->GetSlicerManagerCurrentIndex()) mCurrentCompatibleIndex = j; - j++; - } + vvImage * s = mMainWindowBase->GetSlicerManagers()[i]->GetImage(); + if (mFilter->CheckImageType(s->GetNumberOfDimensions(), + s->GetNumberOfScalarComponents(), + s->GetScalarTypeAsString())) { + mSlicerManagersCompatible.push_back(mMainWindowBase->GetSlicerManagers()[i]); + if ((int)i == mMainWindowBase->GetSlicerManagerCurrentIndex()) mCurrentCompatibleIndex = j; + j++; } - } - else { + } + } + else { mSlicerManagersCompatible = mMainWindowBase->GetSlicerManagers(); mCurrentCompatibleIndex = mMainWindowBase->GetSlicerManagerCurrentIndex(); - } - mToolInputSelectionWidget->Initialize(mSlicerManagersCompatible, - mCurrentCompatibleIndex); - mIsInitialized = true; + } + mToolInputSelectionWidget->Initialize(mSlicerManagersCompatible, + mCurrentCompatibleIndex); + mIsInitialized = true; */ } //------------------------------------------------------------------------------ @@ -183,7 +194,7 @@ void vvToolWidgetBase::InitializeInputs() { //------------------------------------------------------------------------------ void vvToolWidgetBase::InputIsSelected() { - DD("InputIsSelected"); + // DD("InputIsSelected"); buttonBox->setEnabled(true); std::vector & l = mToolInputSelectionWidget->GetSelectedInputs(); mCurrentSlicerManager = l[0]; @@ -207,12 +218,12 @@ void vvToolWidgetBase::InputIsSelected(vvSlicerManager * m) { //------------------------------------------------------------------------------ void vvToolWidgetBase::InputIsSelected(std::vector & l) { buttonBox->setEnabled(true); - DD("InputIsSelected(vector)"); - DD(l.size()); + // DD("InputIsSelected(vector)"); + // DD(l.size()); if (l.size() == 1) InputIsSelected(l[0]); else { - std::cerr << "You MUST overwrite this method vvToolWidgetBase::InputIsSelected(vector m) if you use several input" << std::endl; - exit(0); + std::cerr << "You MUST overwrite this method vvToolWidgetBase::InputIsSelected(vector m) if you use several input" << std::endl; + exit(0); } } //------------------------------------------------------------------------------ diff --git a/vv/vvToolWidgetBase.h b/vv/vvToolWidgetBase.h index 6f8e23f..f5aff73 100644 --- a/vv/vvToolWidgetBase.h +++ b/vv/vvToolWidgetBase.h @@ -3,8 +3,8 @@ Program: vv Module: $RCSfile: vvToolWidgetBase.h,v $ Language: C++ - Date: $Date: 2010/03/17 11:22:18 $ - Version: $Revision: 1.3 $ + Date: $Date: 2010/03/24 10:48:18 $ + Version: $Revision: 1.4 $ Author : David Sarrut (david.sarrut@creatis.insa-lyon.fr) Copyright (C) 2010 @@ -46,8 +46,8 @@ class vvToolWidgetBase: virtual void InputIsSelected(vvSlicerManager *m); virtual void InputIsSelected(std::vector & l); - void AddInputSelector(clitk::ImageToImageGenericFilterBase * f); - void AddInputSelector(); + void AddInputSelector(QString s, clitk::ImageToImageGenericFilterBase * f, bool allowSkip=false); + void AddInputSelector(QString s, bool allowSkip=false); public slots: virtual void apply() = 0; -- 2.47.1