ITK  4.9.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 
21 #include "itkMath.h"
23 
24 namespace itk
25 {
26 // This functor class applies a scaling transformation A.x
27 // to input values.
28 namespace Functor
29 {
30 template< typename TInput, typename TOutput >
32 {
33 public:
37  void SetFactor(RealType a) { m_Factor = a; }
38  itkStaticConstMacro(VectorDimension, unsigned int, TInput::Dimension);
39  bool operator!=(const VectorMagnitudeLinearTransform & other) const
40  {
42  {
43  return true;
44  }
45  return false;
46  }
47 
48  bool operator==(const VectorMagnitudeLinearTransform & other) const
49  {
50  return !( *this != other );
51  }
52 
53  inline TOutput operator()(const TInput & x) const
54  {
55  TOutput result;
56 
57  for ( unsigned int i = 0; i < VectorDimension; i++ )
58  {
59  const RealType scaledComponent = static_cast< RealType >( x[i] ) * m_Factor;
60  result[i] = static_cast< typename TOutput::ValueType >( scaledComponent );
61  }
62  return result;
63  }
64 
65 private:
67 };
68 } // end namespace functor
69 
92 template< typename TInputImage, typename TOutputImage = TInputImage >
94  public
95  UnaryFunctorImageFilter< TInputImage, TOutputImage,
96  Functor::VectorMagnitudeLinearTransform<
97  typename TInputImage::PixelType,
98  typename TOutputImage::PixelType > >
99 {
100 public:
103  typedef UnaryFunctorImageFilter<
104  TInputImage, TOutputImage,
106  typename TInputImage::PixelType,
107  typename TOutputImage::PixelType > > Superclass;
108 
111 
112  typedef typename TOutputImage::PixelType OutputPixelType;
113  typedef typename TInputImage::PixelType InputPixelType;
114  typedef typename InputPixelType::ValueType InputValueType;
115  typedef typename OutputPixelType::ValueType OutputValueType;
118 
121 
124 
126  itkNewMacro(Self);
127 
128  itkSetMacro(OutputMaximumMagnitude, OutputRealType);
129  itkGetConstReferenceMacro(OutputMaximumMagnitude, OutputRealType);
130 
134  itkGetConstReferenceMacro(Scale, InputRealType);
135  itkGetConstReferenceMacro(Shift, InputRealType);
137 
140  itkGetConstReferenceMacro(InputMaximumMagnitude, InputRealType);
141 
143  void BeforeThreadedGenerateData() ITK_OVERRIDE;
144 
146  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
147 
148 #ifdef ITK_USE_CONCEPT_CHECKING
149  // Begin concept checking
150  itkConceptMacro( InputHasNumericTraitsCheck,
152  itkConceptMacro( OutputHasNumericTraitsCheck,
154  // End concept checking
155 #endif
156 
157 protected:
160 
161 private:
162  VectorRescaleIntensityImageFilter(const Self &) ITK_DELETE_FUNCTION;
163  void operator=(const Self &) ITK_DELETE_FUNCTION;
164 
167 
170 };
171 } // end namespace itk
172 
173 #ifndef ITK_MANUAL_INSTANTIATION
174 #include "itkVectorRescaleIntensityImageFilter.hxx"
175 #endif
176 
177 #endif
InputImageType::ConstPointer InputImagePointer
NumericTraits< typename TInput::ValueType >::RealType RealType
UnaryFunctorImageFilter< TInputImage, TOutputImage, Functor::VectorMagnitudeLinearTransform< typename TInputImage::PixelType, typename TOutputImage::PixelType > > Superclass
NumericTraits< OutputValueType >::RealType OutputRealType
Base class for all process objects that output image data.
bool operator==(const VectorMagnitudeLinearTransform &other) const
void PrintSelf(std::ostream &os, Indent indent) const override
bool NotExactlyEquals(const TInput1 &x1, const TInput2 &x2)
Definition: itkMath.h:676
Implements pixel-wise generic operation on one image.
bool operator!=(const VectorMagnitudeLinearTransform &other) const
Control indentation during Print() invocation.
Definition: itkIndent.h:49
NumericTraits< InputValueType >::RealType InputRealType
Applies a linear transformation to the magnitude of pixel vectors in a vector Image.
Define additional traits for native types such as int or float.
#define itkConceptMacro(name, concept)