From f68e31d5cd757b71d9c0740f8699d7a3a5586403 Mon Sep 17 00:00:00 2001 From: David Sarrut Date: Wed, 19 Oct 2011 15:12:12 +0200 Subject: [PATCH] Remove ResizeImageLike (put in CropLikeImageFilter) and BoundingBox (put in clitkBoundingBoxUtils) --- itk/clitkSegmentationUtils.h | 26 --------- itk/clitkSegmentationUtils.txx | 103 +-------------------------------- 2 files changed, 1 insertion(+), 128 deletions(-) diff --git a/itk/clitkSegmentationUtils.h b/itk/clitkSegmentationUtils.h index 70388fe..cd1612a 100644 --- a/itk/clitkSegmentationUtils.h +++ b/itk/clitkSegmentationUtils.h @@ -38,25 +38,6 @@ namespace clitk { //-------------------------------------------------------------------- - template - void ComputeBBFromImageRegion(const ImageType * image, - typename ImageType::RegionType region, - typename itk::BoundingBox::Pointer bb); - - //-------------------------------------------------------------------- - template - void ComputeBBIntersection(typename itk::BoundingBox::Pointer bbo, - typename itk::BoundingBox::Pointer bbi1, - typename itk::BoundingBox::Pointer bbi2); - - //-------------------------------------------------------------------- - template - void ComputeRegionFromBB(const ImageType * image, - const typename itk::BoundingBox::Pointer bb, - typename ImageType::RegionType & region); - //-------------------------------------------------------------------- template typename TInternalImageType::Pointer SetBackground(const TInternalImageType * input, @@ -136,13 +117,6 @@ namespace clitk { int minimalComponentSize, LabelizeParameters * param); - //-------------------------------------------------------------------- - template - typename ImageType::Pointer - ResizeImageLike(const ImageType * input, - const itk::ImageBase * like, - typename ImageType::PixelType BG); - //-------------------------------------------------------------------- template diff --git a/itk/clitkSegmentationUtils.txx b/itk/clitkSegmentationUtils.txx index 2f0d935..3022ad2 100644 --- a/itk/clitkSegmentationUtils.txx +++ b/itk/clitkSegmentationUtils.txx @@ -38,89 +38,6 @@ namespace clitk { - //-------------------------------------------------------------------- - template - void ComputeBBFromImageRegion(const ImageType * image, - typename ImageType::RegionType region, - typename itk::BoundingBox::Pointer bb) { - typedef typename ImageType::IndexType IndexType; - IndexType firstIndex; - IndexType lastIndex; - for(unsigned int i=0; iGetImageDimension(); i++) { - firstIndex[i] = region.GetIndex()[i]; - lastIndex[i] = firstIndex[i]+region.GetSize()[i]; - } - - typedef itk::BoundingBox BBType; - typedef typename BBType::PointType PointType; - PointType lastPoint; - PointType firstPoint; - image->TransformIndexToPhysicalPoint(firstIndex, firstPoint); - image->TransformIndexToPhysicalPoint(lastIndex, lastPoint); - - bb->SetMaximum(lastPoint); - bb->SetMinimum(firstPoint); - } - //-------------------------------------------------------------------- - - - //-------------------------------------------------------------------- - template - void ComputeBBIntersection(typename itk::BoundingBox::Pointer bbo, - typename itk::BoundingBox::Pointer bbi1, - typename itk::BoundingBox::Pointer bbi2) { - - typedef itk::BoundingBox BBType; - typedef typename BBType::PointType PointType; - PointType lastPoint; - PointType firstPoint; - - for(unsigned int i=0; iGetMinimum()[i], - bbi2->GetMinimum()[i]); - lastPoint[i] = std::min(bbi1->GetMaximum()[i], - bbi2->GetMaximum()[i]); - } - - bbo->SetMaximum(lastPoint); - bbo->SetMinimum(firstPoint); - } - //-------------------------------------------------------------------- - - - //-------------------------------------------------------------------- - template - void ComputeRegionFromBB(const ImageType * image, - const typename itk::BoundingBox::Pointer bb, - typename ImageType::RegionType & region) { - // Types - typedef typename ImageType::IndexType IndexType; - typedef typename ImageType::PointType PointType; - typedef typename ImageType::RegionType RegionType; - typedef typename ImageType::SizeType SizeType; - - // Region starting point - IndexType regionStart; - PointType start = bb->GetMinimum(); - image->TransformPhysicalPointToIndex(start, regionStart); - - // Region size - SizeType regionSize; - PointType maxs = bb->GetMaximum(); - PointType mins = bb->GetMinimum(); - for(unsigned int i=0; iGetSpacing()[i]); - } - - // Create region - region.SetIndex(regionStart); - region.SetSize(regionSize); - } - //-------------------------------------------------------------------- - //-------------------------------------------------------------------- template typename ImageType::Pointer @@ -312,24 +229,6 @@ namespace clitk { //-------------------------------------------------------------------- - //-------------------------------------------------------------------- - template - typename ImageType::Pointer - ResizeImageLike(const ImageType * input, - const itk::ImageBase * like, - typename ImageType::PixelType backgroundValue) - { - typedef CropLikeImageFilter CropFilterType; - typename CropFilterType::Pointer cropFilter = CropFilterType::New(); - cropFilter->SetInput(input); - cropFilter->SetCropLikeImage(like); - cropFilter->SetBackgroundValue(backgroundValue); - cropFilter->Update(); - return cropFilter->GetOutput(); - } - //-------------------------------------------------------------------- - - //-------------------------------------------------------------------- template typename MaskImageType::Pointer @@ -343,7 +242,7 @@ namespace clitk { bool autocropFlag, bool singleObjectCCL) { - typedef SliceBySliceRelativePositionFilter SliceRelPosFilterType; + typedef clitk::SliceBySliceRelativePositionFilter SliceRelPosFilterType; typename SliceRelPosFilterType::Pointer sliceRelPosFilter = SliceRelPosFilterType::New(); sliceRelPosFilter->VerboseStepFlagOff(); sliceRelPosFilter->WriteStepFlagOff(); -- 2.45.1