SimpleITK  
sitkImageFilter.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright NumFOCUS
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0.txt
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 *=========================================================================*/
18#ifndef sitkImageFilter_h
19#define sitkImageFilter_h
20
21#include "sitkMacro.h"
23#include "sitkBasicFilters.h"
24#include "sitkProcessObject.h"
25
26namespace itk::simple
27{
28
36{
37public:
39
40 //
41 // Type List Setup
42 //
43
44 //
45 // Filter Setup
46 //
47
53
57 virtual ~ImageFilter() = 0;
58
59protected:
60 // Simple ITK must use a zero based index
61 template <class TImageType>
62 static void
63 FixNonZeroIndex(TImageType * img)
64 {
65 assert(img);
66
67 typename TImageType::RegionType r = img->GetLargestPossibleRegion();
68 typename TImageType::IndexType idx = r.GetIndex();
69
70 for (unsigned int i = 0; i < TImageType::ImageDimension; ++i)
71 {
72
73 if (idx[i] != 0)
74 {
75 // if any of the indicies are non-zero, then just fix it
76 typename TImageType::PointType o;
77 img->TransformIndexToPhysicalPoint(idx, o);
78 img->SetOrigin(o);
79
80 idx.Fill(0);
81 r.SetIndex(idx);
82
83 // Need to set the buffered region to match largest
84 img->SetRegions(r);
85
86 return;
87 }
88 }
89 }
90
94 void
95 CheckImageMatchingDimension(const Image & image1, const Image & image2, const std::string & image2Name);
96
100 void
101 CheckImageMatchingPixelType(const Image & image1, const Image & image2, const std::string & image2Name);
102
106 void
107 CheckImageMatchingSize(const Image & image1, const Image & image2, const std::string & image2Name);
108};
109} // namespace itk::simple
110#endif
static void FixNonZeroIndex(TImageType *img)
void CheckImageMatchingDimension(const Image &image1, const Image &image2, const std::string &image2Name)
void CheckImageMatchingSize(const Image &image1, const Image &image2, const std::string &image2Name)
void CheckImageMatchingPixelType(const Image &image1, const Image &image2, const std::string &image2Name)
The Image class for SimpleITK.
Definition sitkImage.h:77
#define SITKBasicFilters0_EXPORT