ITK  4.4.0
Insight Segmentation and Registration Toolkit
itkVectorRescaleIntensityImageFilter.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 __itkVectorRescaleIntensityImageFilter_h
19 #define __itkVectorRescaleIntensityImageFilter_h
20 
22 
23 namespace itk
24 {
25 // This functor class applies a scaling transformation A.x
26 // to input values.
27 namespace Functor
28 {
29 template< typename TInput, typename TOutput >
31 {
32 public:
36  void SetFactor(RealType a) { m_Factor = a; }
37  itkStaticConstMacro(VectorDimension, unsigned int, TInput::Dimension);
38  bool operator!=(const VectorMagnitudeLinearTransform & other) const
39  {
40  if ( m_Factor != other.m_Factor )
41  {
42  return true;
43  }
44  return false;
45  }
46 
47  bool operator==(const VectorMagnitudeLinearTransform & other) const
48  {
49  return !( *this != other );
50  }
51 
52  inline TOutput operator()(const TInput & x) const
53  {
54  TOutput result;
55 
56  for ( unsigned int i = 0; i < VectorDimension; i++ )
57  {
58  const RealType scaledComponent = static_cast< RealType >( x[i] ) * m_Factor;
59  result[i] = static_cast< typename TOutput::ValueType >( scaledComponent );
60  }
61  return result;
62  }
63 
64 private:
66 };
67 } // end namespace functor
68 
91 template< typename TInputImage, typename TOutputImage = TInputImage >
93  public
94  UnaryFunctorImageFilter< TInputImage, TOutputImage,
95  Functor::VectorMagnitudeLinearTransform<
96  typename TInputImage::PixelType,
97  typename TOutputImage::PixelType > >
98 {
99 public:
102  typedef UnaryFunctorImageFilter<
103  TInputImage, TOutputImage,
105  typename TInputImage::PixelType,
106  typename TOutputImage::PixelType > > Superclass;
107 
110 
111  typedef typename TOutputImage::PixelType OutputPixelType;
112  typedef typename TInputImage::PixelType InputPixelType;
113  typedef typename InputPixelType::ValueType InputValueType;
114  typedef typename OutputPixelType::ValueType OutputValueType;
117 
118  typedef typename Superclass::InputImageType InputImageType;
119  typedef typename Superclass::InputImagePointer InputImagePointer;
120 
123 
125  itkNewMacro(Self);
126 
127  itkSetMacro(OutputMaximumMagnitude, OutputRealType);
128  itkGetConstReferenceMacro(OutputMaximumMagnitude, OutputRealType);
129 
133  itkGetConstReferenceMacro(Scale, InputRealType);
134  itkGetConstReferenceMacro(Shift, InputRealType);
136 
139  itkGetConstReferenceMacro(InputMaximumMagnitude, InputRealType);
140 
142  void BeforeThreadedGenerateData(void);
143 
145  void PrintSelf(std::ostream & os, Indent indent) const;
146 
147 #ifdef ITK_USE_CONCEPT_CHECKING
148 
149  itkConceptMacro( InputHasNumericTraitsCheck,
151  itkConceptMacro( OutputHasNumericTraitsCheck,
153 
155 #endif
156 
157 protected:
160 
161 private:
162  VectorRescaleIntensityImageFilter(const Self &); //purposely not implemented
163  void operator=(const Self &); //purposely not implemented
164 
167 
170 };
171 } // end namespace itk
172 
173 #ifndef ITK_MANUAL_INSTANTIATION
174 #include "itkVectorRescaleIntensityImageFilter.hxx"
175 #endif
176 
177 #endif
178