forked from InsightSoftwareConsortium/ITKWikiExamples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMyInPlaceImageFilter.txx
38 lines (28 loc) · 928 Bytes
/
MyInPlaceImageFilter.txx
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
#ifndef __itkMyInPlaceImageFilter_hxx
#define __itkMyInPlaceImageFilter_hxx
#include "MyInPlaceImageFilter.h"
#include "itkObjectFactory.h"
#include "itkImageRegionIterator.h"
#include "itkImageRegionConstIterator.h"
namespace itk
{
template< class TImage>
void MyInPlaceImageFilter< TImage>
::GenerateData()
{
typename TImage::ConstPointer input = this->GetInput();
typename TImage::Pointer output = this->GetOutput();
// This call must come before the GetRunningInPlace() call or the
// GetRunningInPlace() will return an incorrect result.
this->AllocateOutputs();
if (!this->GetRunningInPlace())
{
std::cerr << "The idea of this example is to run inplace, something is wrong!" << std::endl;
return;
}
itk::Index<2> cornerPixel = input->GetLargestPossibleRegion().GetIndex();
typename TImage::PixelType newValue = 3;
output->SetPixel( cornerPixel, newValue);
}
}// end namespace
#endif