From 855ed0b05cfa18a1839baffdea01a49b024dbf2d Mon Sep 17 00:00:00 2001 From: David Sarrut Date: Mon, 26 Sep 2011 09:00:50 +0200 Subject: [PATCH] Add VerboseImageSize flag --- common/clitkFilterBase.cxx | 1 + common/clitkFilterBase.h | 8 +++++++- common/clitkFilterBase.txx | 15 ++++++++++++++- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/common/clitkFilterBase.cxx b/common/clitkFilterBase.cxx index 482a82c..32dd9b4 100644 --- a/common/clitkFilterBase.cxx +++ b/common/clitkFilterBase.cxx @@ -29,6 +29,7 @@ clitk::FilterBase::FilterBase() VerboseWarningFlagOn(); VerboseWarningFlagOff(); VerboseMemoryFlagOff(); + VerboseImageSizeFlagOff(); SetWarning(""); VerboseWarningFlagOn(); m_IsCancelled = false; diff --git a/common/clitkFilterBase.h b/common/clitkFilterBase.h index 25cfc4c..29caaf0 100644 --- a/common/clitkFilterBase.h +++ b/common/clitkFilterBase.h @@ -69,6 +69,11 @@ namespace clitk { itkGetConstMacro(VerboseMemoryFlag, bool); itkBooleanMacro(VerboseMemoryFlag); + // Verbose ImageSize + itkSetMacro(VerboseImageSizeFlag, bool); + itkGetConstMacro(VerboseImageSizeFlag, bool); + itkBooleanMacro(VerboseImageSizeFlag); + // Steps management itkSetMacro(NumberOfSteps, int); itkGetConstMacro(NumberOfSteps, int); @@ -115,13 +120,14 @@ namespace clitk { virtual ~FilterBase() {} void StartNewStep(std::string s); template - void StopCurrentStep(typename TInternalImageType::Pointer p); + void StopCurrentStep(typename TInternalImageType::Pointer p, std::string txt=""); void StopCurrentStep(); bool m_VerboseFlag; bool m_VerboseOptionFlag; bool m_VerboseStepFlag; bool m_VerboseMemoryFlag; + bool m_VerboseImageSizeFlag; bool m_WriteStepFlag; int m_CurrentStepNumber; int m_NumberOfSteps; diff --git a/common/clitkFilterBase.txx b/common/clitkFilterBase.txx index 81568ed7..d6c028e 100644 --- a/common/clitkFilterBase.txx +++ b/common/clitkFilterBase.txx @@ -59,7 +59,7 @@ void clitk::FilterBase::VerboseOptionV(std::string name, int nb, OptionType * va //-------------------------------------------------------------------- template -void clitk::FilterBase::StopCurrentStep(typename TInternalImageType::Pointer p) +void clitk::FilterBase::StopCurrentStep(typename TInternalImageType::Pointer p, std::string txt) { StopCurrentStep(); if (m_WriteStepFlag) { @@ -68,6 +68,19 @@ void clitk::FilterBase::StopCurrentStep(typename TInternalImageType::Pointer p) clitk::writeImage(p, name.str()); } clitk::PrintMemory(GetVerboseMemoryFlag(), "End of step"); + if (GetVerboseImageSizeFlag()) { + std::ostream & os = std::cout; + int dim = p->GetImageDimension(); + int nb = 1; + os << txt << " size = "; + for(unsigned int i=0; iGetLargestPossibleRegion().GetSize()[i] << "x"; + nb *= p->GetLargestPossibleRegion().GetSize()[i]; + } + os << p->GetLargestPossibleRegion().GetSize()[dim-1] << " "; + nb *= p->GetLargestPossibleRegion().GetSize()[dim-1]; + os << " pixels = " << nb << std::endl; + } } //-------------------------------------------------------------------- -- 2.47.1