From 893334d62f784e9c7153eadaf23e987ea3a38a7b Mon Sep 17 00:00:00 2001 From: schaerer Date: Wed, 3 Feb 2010 13:08:52 +0000 Subject: [PATCH] minor fixes --- common/clitkImageToImageGenericFilter.cxx | 59 +++++++++-------------- common/clitkImageToImageGenericFilter.h | 9 ++-- vv/vvToolBinarize.cxx | 6 +-- 3 files changed, 30 insertions(+), 44 deletions(-) diff --git a/common/clitkImageToImageGenericFilter.cxx b/common/clitkImageToImageGenericFilter.cxx index 105afe0..0465b9b 100644 --- a/common/clitkImageToImageGenericFilter.cxx +++ b/common/clitkImageToImageGenericFilter.cxx @@ -5,8 +5,8 @@ clitk::ImageToImageGenericFilterBase::ImageToImageGenericFilterBase(std::string n) :mIOVerbose(false) { mFilterName = n; - mListOfAllowedDimension.clear(); - mListOfAllowedPixelType.clear(); + mListOfAllowedDimensions.clear(); + mListOfAllowedPixelTypes.clear(); mFailOnImageTypeError = true; } //-------------------------------------------------------------------- @@ -14,24 +14,16 @@ clitk::ImageToImageGenericFilterBase::ImageToImageGenericFilterBase(std::string //-------------------------------------------------------------------- void clitk::ImageToImageGenericFilterBase::AddImageType(unsigned int d, std::string p) { - // Search for dimension (to not duplicate) - std::vector::const_iterator it = - std::find (mListOfAllowedDimension.begin(), - mListOfAllowedDimension.end(), d); - if (it == mListOfAllowedDimension.end()) mListOfAllowedDimension.push_back(d); - // Search for PixelType (to not duplicate) - std::vector::const_iterator itt = - std::find (mListOfAllowedPixelType.begin(), - mListOfAllowedPixelType.end(), p); - if (itt == mListOfAllowedPixelType.end()) mListOfAllowedPixelType.push_back(p); + + mListOfAllowedDimensions.insert(d); + mListOfAllowedPixelTypes.insert(p); } //-------------------------------------------------------------------- //-------------------------------------------------------------------- void clitk::ImageToImageGenericFilterBase::SetInputFilenames(const std::vector & filenames) { - mInputFilenames.resize(filenames.size()); - std::copy(filenames.begin(), filenames.end(), mInputFilenames.begin()); + mInputFilenames=filenames; } //-------------------------------------------------------------------- @@ -71,7 +63,8 @@ void clitk::ImageToImageGenericFilterBase::AddOutputFilename(const std::string & //-------------------------------------------------------------------- void clitk::ImageToImageGenericFilterBase::SetOutputFilenames(const std::vector & filenames) { - std::copy(filenames.begin(), filenames.end(), mOutputFilenames.begin()); + mOutputFilenames.clear(); + std::copy(filenames.begin(),filenames.end(),mOutputFilenames.begin()); } //-------------------------------------------------------------------- @@ -163,26 +156,14 @@ bool clitk::ImageToImageGenericFilterBase::CheckImageType() { //-------------------------------------------------------------------- bool clitk::ImageToImageGenericFilterBase::CheckDimension(unsigned int d) { - bool b = false; - unsigned int i=0; - while ((!b) && (i manages "; - for(unsigned int i=0; i::const_iterator i=mListOfAllowedDimensions.begin(); + i!=mListOfAllowedDimensions.end(); i++) { + oss << *i << "D "; } oss << "images, with pixel types: "; - for(unsigned int i=0; i::const_iterator i=mListOfAllowedPixelTypes.begin(); + i!=mListOfAllowedPixelTypes.end(); i++) { + oss << *i << " "; } oss << std::endl; return oss.str(); @@ -232,12 +215,14 @@ void clitk::ImageToImageGenericFilterBase::ImageTypeError() { << mDim << "D images with pixel=" << mPixelTypeName << "." << std::endl; std::cerr << "**Error** Allowed image dim: \t"; - for(unsigned int i=0; i::const_iterator i=mListOfAllowedDimensions.begin(); + i!=mListOfAllowedDimensions.end(); i++) { + std::cerr << *i << "D "; } std::cerr << std::endl << "**Error** Allowed pixel types: \t"; - for(unsigned int i=0; i::const_iterator i=mListOfAllowedPixelTypes.begin(); + i!=mListOfAllowedPixelTypes.end(); i++) { + std::cerr << *i << " "; } std::cerr << std::endl; exit(0); diff --git a/common/clitkImageToImageGenericFilter.h b/common/clitkImageToImageGenericFilter.h index 645fe9b..90869c5 100644 --- a/common/clitkImageToImageGenericFilter.h +++ b/common/clitkImageToImageGenericFilter.h @@ -3,8 +3,8 @@ Program: clitk Module: $RCSfile: clitkImageToImageGenericFilter.h,v $ Language: C++ - Date: $Date: 2010/01/29 13:53:15 $ - Version: $Revision: 1.3 $ + Date: $Date: 2010/02/03 13:08:52 $ + Version: $Revision: 1.4 $ Author : Joel Schaerer David Sarrut @@ -40,6 +40,7 @@ #include #include #include +#include namespace clitk { @@ -115,8 +116,8 @@ namespace clitk { std::vector mInputVVImages; std::vector mOutputVVImages; - std::vector mListOfAllowedPixelType; - std::vector mListOfAllowedDimension; + std::set mListOfAllowedPixelTypes; + std::set mListOfAllowedDimensions; bool CheckImageType(); bool CheckDimension(); bool CheckPixelType(); diff --git a/vv/vvToolBinarize.cxx b/vv/vvToolBinarize.cxx index 22b356d..251c0d6 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/02/03 10:54:08 $ - Version: $Revision: 1.3 $ + Date: $Date: 2010/02/03 13:08:55 $ + Version: $Revision: 1.4 $ Author : David Sarrut (david.sarrut@creatis.insa-lyon.fr) Copyright (C) 2008 @@ -161,7 +161,7 @@ void vvToolBinarize::UpdateSlice(int slicer,int slices) { int slice = mCurrentSliceManager->GetSlicer(0)->GetSlice(); - int tslice = mCurrentSliceManager->GetSlicer(0)->GetTSlice(); + //int tslice = mCurrentSliceManager->GetSlicer(0)->GetTSlice(); mClipper->SetInput(mCurrentSliceManager->GetSlicer(0)->GetInput()); int* extent = mCurrentSliceManager->GetSlicer(0)->GetImageActor()->GetDisplayExtent(); mClipper->SetOutputWholeExtent(extent[0],extent[1],extent[2],extent[3],extent[4],extent[5]); -- 2.47.1