forked from InsightSoftwareConsortium/ITKWikiExamples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathImageFilterY.hxx
56 lines (41 loc) · 1.37 KB
/
ImageFilterY.hxx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#ifndef __ImageFilterY_hxx
#define __ImageFilterY_hxx
#include "ImageFilterY.h"
#include "itkObjectFactory.h"
#include "itkImageRegionIterator.h"
namespace itk
{
template< class TImage>
ImageFilter< TImage>
::ImageFilter()
{
}
template< class TImage>
void ImageFilter< TImage>
::GenerateData()
{
InternalGaussianFilterPointer smoothingFilters[ImageDimension];
// Instantiate all filters
for ( unsigned int i = 0; i < ImageDimension; i++ )
{
smoothingFilters[i] = InternalGaussianFilterType::New();
smoothingFilters[i]->SetOrder(InternalGaussianFilterType::ZeroOrder);
smoothingFilters[i]->SetDirection(i);
}
// Connect all filters (start at 1 because 0th filter is connected to the input
for ( unsigned int i = 1; i < ImageDimension; i++ )
{
smoothingFilters[i]->SetInput(
smoothingFilters[i - 1]->GetOutput() );
}
const typename TImage::ConstPointer inputImage( this->GetInput() );
const typename TImage::RegionType region = inputImage->GetRequestedRegion();
const typename TImage::SizeType size = region.GetSize();
smoothingFilters[0]->SetInput(inputImage);
smoothingFilters[ImageDimension-1]->Update();
// Copy the output from the last filter
//this->GraftOutput( m_SmoothingFilters[ImageDimension-1]->GetOutput() );
this->GetOutput()->Graft(smoothingFilters[ImageDimension-1]->GetOutput() );
}
}// end namespace
#endif