ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkShiftScaleImageFilter.h
Go to the documentation of this file.
00001 /*=========================================================================
00002  *
00003  *  Copyright Insight Software Consortium
00004  *
00005  *  Licensed under the Apache License, Version 2.0 (the "License");
00006  *  you may not use this file except in compliance with the License.
00007  *  You may obtain a copy of the License at
00008  *
00009  *         http://www.apache.org/licenses/LICENSE-2.0.txt
00010  *
00011  *  Unless required by applicable law or agreed to in writing, software
00012  *  distributed under the License is distributed on an "AS IS" BASIS,
00013  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  *  See the License for the specific language governing permissions and
00015  *  limitations under the License.
00016  *
00017  *=========================================================================*/
00018 #ifndef __itkShiftScaleImageFilter_h
00019 #define __itkShiftScaleImageFilter_h
00020 
00021 #include "itkImageToImageFilter.h"
00022 #include "itkArray.h"
00023 
00024 namespace itk
00025 {
00038 template< class TInputImage, class TOutputImage >
00039 class ITK_EXPORT ShiftScaleImageFilter:
00040   public ImageToImageFilter< TInputImage, TOutputImage >
00041 {
00042 public:
00044   typedef ShiftScaleImageFilter                           Self;
00045   typedef ImageToImageFilter< TInputImage, TOutputImage > Superclass;
00046   typedef SmartPointer< Self >                            Pointer;
00047   typedef SmartPointer< const Self >                      ConstPointer;
00048 
00050   itkNewMacro(Self);
00051 
00053   typedef typename TInputImage::RegionType  InputImageRegionType;
00054   typedef typename TOutputImage::RegionType OutputImageRegionType;
00055 
00057   typedef typename TInputImage::Pointer  InputImagePointer;
00058   typedef typename TOutputImage::Pointer OutputImagePointer;
00059 
00061   typedef typename TInputImage::PixelType  InputImagePixelType;
00062   typedef typename TOutputImage::PixelType OutputImagePixelType;
00063 
00065   typedef typename TInputImage::IndexType   InputImageIndexType;
00066   typedef typename TInputImage::SizeType    InputImageSizeType;
00067   typedef typename TInputImage::OffsetType  InputImageOffsetType;
00068   typedef typename TOutputImage::IndexType  OutputImageIndexType;
00069   typedef typename TOutputImage::SizeType   OutputImageSizeType;
00070   typedef typename TOutputImage::OffsetType OutputImageOffsetType;
00071 
00073   typedef typename NumericTraits< OutputImagePixelType >::RealType RealType;
00074 
00076   itkStaticConstMacro(ImageDimension, unsigned int,
00077                       TInputImage::ImageDimension);
00078 
00080   itkTypeMacro(ShiftScaleImageFilter, ImageToImageFilter);
00081 
00084   itkSetMacro(Shift, RealType);
00085   itkGetConstMacro(Shift, RealType);
00087 
00090   itkSetMacro(Scale, RealType);
00091   itkGetConstMacro(Scale, RealType);
00093 
00095   itkGetConstMacro(UnderflowCount, long);
00096   itkGetConstMacro(OverflowCount, long);
00098 
00099 #ifdef ITK_USE_CONCEPT_CHECKING
00100 
00101   itkConceptMacro( OutputHasNumericTraitsCheck,
00102                    ( Concept::HasNumericTraits< OutputImagePixelType > ) );
00103   itkConceptMacro( InputPlusRealTypeCheck,
00104                    ( Concept::AdditiveOperators< InputImagePixelType, RealType, RealType > ) );
00105   itkConceptMacro( RealTypeMultiplyOperatorCheck,
00106                    ( Concept::MultiplyOperator< RealType > ) );
00107 
00109 #endif
00110 protected:
00111   ShiftScaleImageFilter();
00112   ~ShiftScaleImageFilter();
00113   void PrintSelf(std::ostream & os, Indent indent) const;
00115 
00117   void BeforeThreadedGenerateData();
00118 
00120   void AfterThreadedGenerateData();
00121 
00123   void  ThreadedGenerateData(const OutputImageRegionType &
00124                              outputRegionForThread,
00125                              ThreadIdType threadId);
00126 
00127 private:
00128   ShiftScaleImageFilter(const Self &); //purposely not implemented
00129   void operator=(const Self &);        //purposely not implemented
00130 
00131   RealType m_Shift;
00132   RealType m_Scale;
00133 
00134   long m_UnderflowCount;
00135   long m_OverflowCount;
00136 
00137   Array< long > m_ThreadUnderflow;
00138   Array< long > m_ThreadOverflow;
00139 };
00140 } // end namespace itk
00141 
00142 #ifndef ITK_MANUAL_INSTANTIATION
00143 #include "itkShiftScaleImageFilter.hxx"
00144 #endif
00145 
00146 #endif
00147