From 8d4aeabfafe155775a520eeb1aabf330e3a9d886 Mon Sep 17 00:00:00 2001 From: David Sarrut Date: Mon, 24 Oct 2011 08:29:29 +0200 Subject: [PATCH] Add SliceBySliceRelativePosition with angles --- itk/clitkSegmentationUtils.h | 12 +++++++++++ itk/clitkSegmentationUtils.txx | 38 ++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) diff --git a/itk/clitkSegmentationUtils.h b/itk/clitkSegmentationUtils.h index cd1612a..6972d15 100644 --- a/itk/clitkSegmentationUtils.h +++ b/itk/clitkSegmentationUtils.h @@ -130,6 +130,18 @@ namespace clitk { double spacing=-1, bool autocropflag=true, bool singleObjectCCL=true); + template + typename MaskImageType::Pointer + SliceBySliceRelativePosition(const MaskImageType * input, + const MaskImageType * object, + int direction, + double threshold, + double angle, + bool inverseflag, + bool uniqueConnectedComponent=false, + double spacing=-1, + bool autocropflag=true, + bool singleObjectCCL=true); //-------------------------------------------------------------------- // In a binary image, search for the point belonging to the FG that diff --git a/itk/clitkSegmentationUtils.txx b/itk/clitkSegmentationUtils.txx index 3022ad2..8fe69a0 100644 --- a/itk/clitkSegmentationUtils.txx +++ b/itk/clitkSegmentationUtils.txx @@ -265,6 +265,44 @@ namespace clitk { //-------------------------------------------------------------------- + //-------------------------------------------------------------------- + template + typename MaskImageType::Pointer + SliceBySliceRelativePosition(const MaskImageType * input, + const MaskImageType * object, + int direction, + double threshold, + double angle, + bool inverseflag, + bool uniqueConnectedComponent, + double spacing, + bool autocropFlag, + bool singleObjectCCL) + { + typedef clitk::SliceBySliceRelativePositionFilter SliceRelPosFilterType; + typename SliceRelPosFilterType::Pointer sliceRelPosFilter = SliceRelPosFilterType::New(); + sliceRelPosFilter->VerboseStepFlagOff(); + sliceRelPosFilter->WriteStepFlagOff(); + sliceRelPosFilter->SetInput(input); + sliceRelPosFilter->SetInputObject(object); + sliceRelPosFilter->SetDirection(direction); + sliceRelPosFilter->SetFuzzyThreshold(threshold); + // sliceRelPosFilter->AddOrientationTypeString(orientation); + sliceRelPosFilter->AddAngles(angle, 0.0); + sliceRelPosFilter->SetIntermediateSpacingFlag((spacing != -1)); + sliceRelPosFilter->SetIntermediateSpacing(spacing); + sliceRelPosFilter->SetUniqueConnectedComponentBySliceFlag(uniqueConnectedComponent); + sliceRelPosFilter->ObjectCCLSelectionFlagOff(); + sliceRelPosFilter->SetUseTheLargestObjectCCLFlag(singleObjectCCL); + sliceRelPosFilter->SetInverseOrientationFlag(inverseflag); + sliceRelPosFilter->SetAutoCropFlag(autocropFlag); + sliceRelPosFilter->IgnoreEmptySliceObjectFlagOn(); + sliceRelPosFilter->Update(); + return sliceRelPosFilter->GetOutput(); + } + //-------------------------------------------------------------------- + + //-------------------------------------------------------------------- template bool -- 2.47.1