From f103c94b7b7e91450ac5cd0420713c8bbb8852bb Mon Sep 17 00:00:00 2001 From: srit Date: Mon, 28 Mar 2011 07:37:25 +0000 Subject: [PATCH] Fix for bug #274: move JoinSlices definition in .h --- itk/clitkSegmentationUtils.h | 23 +++++++++++++++++----- itk/clitkSegmentationUtils.txx | 21 -------------------- segmentation/clitkExtractPatientFilter.txx | 1 + 3 files changed, 19 insertions(+), 26 deletions(-) diff --git a/itk/clitkSegmentationUtils.h b/itk/clitkSegmentationUtils.h index 6f4deb4..468f9d8 100644 --- a/itk/clitkSegmentationUtils.h +++ b/itk/clitkSegmentationUtils.h @@ -26,6 +26,7 @@ // itk #include +#include /* According to @@ -221,11 +222,23 @@ namespace clitk { //-------------------------------------------------------------------- - //template - //typename ImageType::Pointer - //JoinSlices(std::vector::Pointer > & slices, - // const ImageType * input, int dim); + template + typename ImageType::Pointer + JoinSlices(std::vector::Pointer > & slices, + const ImageType * input, + int direction) { + typedef typename itk::Image SliceType; + typedef itk::JoinSeriesImageFilter JoinSeriesFilterType; + typename JoinSeriesFilterType::Pointer joinFilter = JoinSeriesFilterType::New(); + joinFilter->SetOrigin(input->GetOrigin()[direction]); + joinFilter->SetSpacing(input->GetSpacing()[direction]); + for(unsigned int i=0; iPushBackInput(slices[i]); + } + joinFilter->Update(); + return joinFilter->GetOutput(); + } //-------------------------------------------------------------------- diff --git a/itk/clitkSegmentationUtils.txx b/itk/clitkSegmentationUtils.txx index 3da1802..2b5f685 100644 --- a/itk/clitkSegmentationUtils.txx +++ b/itk/clitkSegmentationUtils.txx @@ -535,27 +535,6 @@ namespace clitk { //-------------------------------------------------------------------- - //-------------------------------------------------------------------- - template - typename ImageType::Pointer - JoinSlices(std::vector::Pointer > & slices, - const ImageType * input, - int direction) { - typedef typename itk::Image SliceType; - typedef itk::JoinSeriesImageFilter JoinSeriesFilterType; - typename JoinSeriesFilterType::Pointer joinFilter = JoinSeriesFilterType::New(); - joinFilter->SetOrigin(input->GetOrigin()[direction]); - joinFilter->SetSpacing(input->GetSpacing()[direction]); - for(unsigned int i=0; iPushBackInput(slices[i]); - } - joinFilter->Update(); - return joinFilter->GetOutput(); - } - //-------------------------------------------------------------------- - - //-------------------------------------------------------------------- template void diff --git a/segmentation/clitkExtractPatientFilter.txx b/segmentation/clitkExtractPatientFilter.txx index 61de51d..54d741f 100644 --- a/segmentation/clitkExtractPatientFilter.txx +++ b/segmentation/clitkExtractPatientFilter.txx @@ -25,6 +25,7 @@ #include "clitkDecomposeAndReconstructImageFilter.h" #include "clitkAutoCropFilter.h" #include "clitkMemoryUsage.h" +#include "clitkSegmentationUtils.h" // itk #include "itkBinaryThresholdImageFilter.h" -- 2.47.1