ITK  4.6.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 
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  // Begin concept checking
149  itkConceptMacro( InputHasNumericTraitsCheck,
151  itkConceptMacro( OutputHasNumericTraitsCheck,
153  // End concept checking
154 #endif
155 
156 protected:
159 
160 private:
161  VectorRescaleIntensityImageFilter(const Self &); //purposely not implemented
162  void operator=(const Self &); //purposely not implemented
163 
166 
169 };
170 } // end namespace itk
171 
172 #ifndef ITK_MANUAL_INSTANTIATION
173 #include "itkVectorRescaleIntensityImageFilter.hxx"
174 #endif
175 
176 #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
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)
void PrintSelf(std::ostream &os, Indent indent) const