From 9c64ad6eccd14a92727f024653066986aa3af5a9 Mon Sep 17 00:00:00 2001 From: David Sarrut Date: Thu, 7 Jun 2012 15:48:52 +0200 Subject: [PATCH] Add VerboseSlicesFlag --- itk/clitkSliceBySliceRelativePositionFilter.h | 5 +++++ itk/clitkSliceBySliceRelativePositionFilter.txx | 13 +++++++++++++ 2 files changed, 18 insertions(+) diff --git a/itk/clitkSliceBySliceRelativePositionFilter.h b/itk/clitkSliceBySliceRelativePositionFilter.h index 90a1b25..ba59467 100644 --- a/itk/clitkSliceBySliceRelativePositionFilter.h +++ b/itk/clitkSliceBySliceRelativePositionFilter.h @@ -98,6 +98,10 @@ namespace clitk { itkSetMacro(ObjectCCLSelectionIgnoreSingleCCLFlag, bool); itkBooleanMacro(ObjectCCLSelectionIgnoreSingleCCLFlag); + itkGetConstMacro(VerboseSlicesFlag, bool); + itkSetMacro(VerboseSlicesFlag, bool); + itkBooleanMacro(VerboseSlicesFlag); + protected: SliceBySliceRelativePositionFilter(); virtual ~SliceBySliceRelativePositionFilter() {} @@ -118,6 +122,7 @@ namespace clitk { int m_ObjectCCLSelectionDimension; int m_ObjectCCLSelectionDirection; bool m_ObjectCCLSelectionIgnoreSingleCCLFlag; + bool m_VerboseSlicesFlag; private: SliceBySliceRelativePositionFilter(const Self&); //purposely not implemented diff --git a/itk/clitkSliceBySliceRelativePositionFilter.txx b/itk/clitkSliceBySliceRelativePositionFilter.txx index eff331d..6fceb9b 100644 --- a/itk/clitkSliceBySliceRelativePositionFilter.txx +++ b/itk/clitkSliceBySliceRelativePositionFilter.txx @@ -42,6 +42,7 @@ SliceBySliceRelativePositionFilter(): SetObjectCCLSelectionDimension(0); SetObjectCCLSelectionDirection(1); ObjectCCLSelectionIgnoreSingleCCLFlagOff(); + VerboseSlicesFlagOff(); } //-------------------------------------------------------------------- @@ -158,6 +159,9 @@ GenerateOutputInformation() this->template StopCurrentStep(m_working_object); */ + DD(input->GetLargestPossibleRegion()); + DD(m_working_object->GetLargestPossibleRegion()); + // Compute union of bounding boxes in X and Y static const unsigned int dim = ImageType::ImageDimension; typedef itk::BoundingBox BBType; @@ -182,6 +186,11 @@ GenerateOutputInformation() m_working_input, this->GetObjectBackgroundValue()); + // Index can be negative in some cases, and lead to problem with + // some filter. So we correct it. + m_working_input = clitk::RemoveNegativeIndexFromRegion(m_working_input); + m_working_object = clitk::RemoveNegativeIndexFromRegion(m_working_object); + // End this->template StopCurrentStep(m_working_input); } @@ -286,6 +295,10 @@ GenerateOutputInformation() typedef clitk::AddRelativePositionConstraintToLabelImageFilter RelPosFilterType; typename RelPosFilterType::Pointer relPosFilter = RelPosFilterType::New(); relPosFilter->VerboseStepFlagOff(); + if (GetVerboseSlicesFlag()) { + std::cout << "Slice " << i << std::endl; + relPosFilter->VerboseStepFlagOn(); + } relPosFilter->WriteStepFlagOff(); // relPosFilter->VerboseMemoryFlagOn(); relPosFilter->SetCurrentStepBaseId(this->GetCurrentStepId()+"-"+toString(i)); -- 2.47.1