From: dsarrut Date: Wed, 7 Jul 2010 06:58:37 +0000 (+0000) Subject: add "havesamespacing" utility X-Git-Tag: v1.2.0~567 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=6ba3ae42db97a5367507312b4d086e006081d8ed;p=clitk.git add "havesamespacing" utility --- diff --git a/common/clitkImageCommon.h b/common/clitkImageCommon.h index 294c19a..e734d21 100644 --- a/common/clitkImageCommon.h +++ b/common/clitkImageCommon.h @@ -96,13 +96,22 @@ namespace clitk { //-------------------------------------------------------------------- template - bool HasSameSizeAndSpacing(typename ImageType1::ConstPointer A, + bool HaveSameSizeAndSpacing(typename ImageType1::ConstPointer A, typename ImageType2::ConstPointer B); template - bool HasSameSizeAndSpacing(typename ImageType1::Pointer A, + bool HaveSameSizeAndSpacing(typename ImageType1::Pointer A, typename ImageType2::Pointer B); + //-------------------------------------------------------------------- + template + bool HaveSameSpacing(typename ImageType1::ConstPointer A, + typename ImageType2::ConstPointer B); + + template + bool HaveSameSpacing(typename ImageType1::Pointer A, + typename ImageType2::Pointer B); + #include "clitkImageCommon.txx" } // end namespace diff --git a/common/clitkImageCommon.txx b/common/clitkImageCommon.txx index 7b6badf..ca8206e 100644 --- a/common/clitkImageCommon.txx +++ b/common/clitkImageCommon.txx @@ -319,7 +319,7 @@ void ComputeWeightsOfEachClasses(const typename InputImageType::Pointer & input, //-------------------------------------------------------------------- template -bool HasSameSizeAndSpacing(typename ImageType1::ConstPointer A, +bool HaveSameSizeAndSpacing(typename ImageType1::ConstPointer A, typename ImageType2::ConstPointer B) { if (A->GetImageDimension() != B->GetImageDimension()) return false; @@ -333,7 +333,7 @@ bool HasSameSizeAndSpacing(typename ImageType1::ConstPointer A, //-------------------------------------------------------------------- template -bool HasSameSizeAndSpacing(typename ImageType1::Pointer A, +bool HaveSameSizeAndSpacing(typename ImageType1::Pointer A, typename ImageType2::Pointer B) { if (A->GetImageDimension() != B->GetImageDimension()) return false; @@ -345,5 +345,31 @@ bool HasSameSizeAndSpacing(typename ImageType1::Pointer A, } //-------------------------------------------------------------------- +//-------------------------------------------------------------------- +template +bool HaveSameSpacing(typename ImageType1::ConstPointer A, + typename ImageType2::ConstPointer B) +{ + if (A->GetImageDimension() != B->GetImageDimension()) return false; + for(unsigned int i=0; iGetImageDimension(); i++) { + if (A->GetSpacing()[i] != B->GetSpacing()[i]) return false; + } + return true; +} +//-------------------------------------------------------------------- + +//-------------------------------------------------------------------- +template +bool HaveSameSpacing(typename ImageType1::Pointer A, + typename ImageType2::Pointer B) +{ + if (A->GetImageDimension() != B->GetImageDimension()) return false; + for(unsigned int i=0; iGetImageDimension(); i++) { + if (A->GetSpacing()[i] != B->GetSpacing()[i]) return false; + } + return true; +} +//-------------------------------------------------------------------- + #endif /* end #define CLITKIMAGECOMMON_TXX */