SimpleITK  2.0.0
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 
26 namespace itk {
27 
28  namespace simple {
29 
37  public ProcessObject
38  {
39  public:
40  using Self = ImageFilter;
41 
42  //
43  // Type List Setup
44  //
45 
46  //
47  // Filter Setup
48  //
49 
54  ImageFilter();
55 
59  virtual ~ImageFilter() = 0;
60 
61  protected:
62 
63  // Simple ITK must use a zero based index
64  template< class TImageType>
65  static void FixNonZeroIndex( TImageType * img )
66  {
67  assert( img );
68 
69  typename TImageType::RegionType r = img->GetLargestPossibleRegion();
70  typename TImageType::IndexType idx = r.GetIndex();
71 
72  for( unsigned int i = 0; i < TImageType::ImageDimension; ++i )
73  {
74 
75  if ( idx[i] != 0 )
76  {
77  // if any of the indcies are non-zero, then just fix it
78  typename TImageType::PointType o;
79  img->TransformIndexToPhysicalPoint( idx, o );
80  img->SetOrigin( o );
81 
82  idx.Fill( 0 );
83  r.SetIndex( idx );
84 
85  // Need to set the buffered region to match largest
86  img->SetRegions( r );
87 
88  return;
89  }
90  }
91 
92  }
93 
97  void CheckImageMatchingDimension(const Image &image1, const Image& image2, const std::string &image2Name );
98 
102  void CheckImageMatchingPixelType(const Image &image1, const Image& image2, const std::string &image2Name );
103 
107  void CheckImageMatchingSize(const Image &image1, const Image& image2, const std::string &image2Name );
108  };
109  }
110 }
111 #endif
itk::simple::Image
The Image class for SimpleITK.
Definition: sitkImage.h:75
sitkBasicFilters.h
SITKBasicFilters0_EXPORT
#define SITKBasicFilters0_EXPORT
Definition: sitkBasicFilters.h:40
sitkMemberFunctionFactory.h
sitkProcessObject.h
sitkMacro.h
itk::simple::ImageFilter::FixNonZeroIndex
static void FixNonZeroIndex(TImageType *img)
Definition: sitkImageFilter.h:65
itk
itk::simple::ImageFilter
The base interface for SimpleITK filters that take one input image.
Definition: sitkImageFilter.h:36
itk::simple::ProcessObject
Base class for SimpleITK classes based on ProcessObject.
Definition: sitkProcessObject.h:51