ITK  4.4.0
Insight Segmentation and Registration Toolkit
itkShiftScaleInPlaceImageFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
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 __itkShiftScaleInPlaceImageFilter_h
19 #define __itkShiftScaleInPlaceImageFilter_h
20 #if !defined( ITK_LEGACY_REMOVE )
21 
22 #include "itkInPlaceImageFilter.h"
23 #include "itkArray.h"
24 
25 namespace itk
26 {
47 template< class TInputImage >
48 class ITK_EXPORT ShiftScaleInPlaceImageFilter:
49  public InPlaceImageFilter< TInputImage >
50 {
51 public:
53  typedef ShiftScaleInPlaceImageFilter Self;
54  typedef InPlaceImageFilter< TInputImage > Superclass;
55  typedef SmartPointer< Self > Pointer;
56  typedef SmartPointer< const Self > ConstPointer;
57 
59  itkNewMacro(Self);
60 
62  typedef typename TInputImage::RegionType InputImageRegionType;
63  typedef typename TInputImage::RegionType OutputImageRegionType;
64 
66  typedef typename TInputImage::Pointer InputImagePointer;
67  typedef typename TInputImage::Pointer OutputImagePointer;
68 
70  typedef typename TInputImage::PixelType InputImagePixelType;
71  typedef typename TInputImage::PixelType OutputImagePixelType;
72 
74  typedef typename TInputImage::IndexType InputImageIndexType;
75  typedef typename TInputImage::SizeType InputImageSizeType;
76  typedef typename TInputImage::OffsetType InputImageOffsetType;
77  typedef typename TInputImage::IndexType OutputImageIndexType;
78  typedef typename TInputImage::SizeType OutputImageSizeType;
79  typedef typename TInputImage::OffsetType OutputImageOffsetType;
80 
82  typedef typename NumericTraits< OutputImagePixelType >::RealType RealType;
83 
85  itkStaticConstMacro(ImageDimension, unsigned int,
86  TInputImage::ImageDimension);
87 
89  itkTypeMacro(ShiftScaleInPlaceImageFilter, InPlaceImageFilter);
90 
93  itkSetMacro(Shift, RealType);
94  itkGetConstMacro(Shift, RealType);
96 
99  itkSetMacro(Scale, RealType);
100  itkGetConstMacro(Scale, RealType);
102 
104  itkGetConstMacro(UnderflowCount, long);
105  itkGetConstMacro(OverflowCount, long);
107 
108 #ifdef ITK_USE_CONCEPT_CHECKING
109 
110  itkConceptMacro( InputHasNumericTraitsCheck,
111  ( Concept::HasNumericTraits< InputImagePixelType > ) );
112  itkConceptMacro( InputPlusRealTypeCheck,
113  ( Concept::AdditiveOperators< InputImagePixelType, RealType, RealType > ) );
114  itkConceptMacro( RealTypeMultiplyOperatorCheck,
115  ( Concept::MultiplyOperator< RealType > ) );
116 
118 #endif
119 
120 protected:
121  ShiftScaleInPlaceImageFilter();
122  ~ShiftScaleInPlaceImageFilter();
123  void PrintSelf(std::ostream & os, Indent indent) const;
124 
126  void BeforeThreadedGenerateData();
127 
129  void AfterThreadedGenerateData();
130 
132  void ThreadedGenerateData(const OutputImageRegionType &
133  outputRegionForThread,
134  ThreadIdType threadId);
135 
136 private:
137  ShiftScaleInPlaceImageFilter(const Self &); //purposely not implemented
138  void operator=(const Self &); //purposely not implemented
139 
140  RealType m_Shift;
141  RealType m_Scale;
142 
143  long m_UnderflowCount;
144  long m_OverflowCount;
145 
146  Array< long > m_ThreadUnderflow;
147  Array< long > m_ThreadOverflow;
148 };
149 } // end namespace itk
150 
151 #ifndef ITK_MANUAL_INSTANTIATION
152 #include "itkShiftScaleInPlaceImageFilter.hxx"
153 #endif
154 
155 #endif //#if !defined( ITK_LEGACY_REMOVE )
156 #endif
157