ITK  4.0.0
Insight Segmentation and Registration Toolkit
itkShiftScaleInPlaceImageFilter.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 __itkShiftScaleInPlaceImageFilter_h
00019 #define __itkShiftScaleInPlaceImageFilter_h
00020 
00021 #include "itkInPlaceImageFilter.h"
00022 #include "itkArray.h"
00023 
00024 namespace itk
00025 {
00045 template< class TInputImage >
00046 class ITK_EXPORT ShiftScaleInPlaceImageFilter:
00047   public InPlaceImageFilter< TInputImage >
00048 {
00049 public:
00051   typedef ShiftScaleInPlaceImageFilter      Self;
00052   typedef InPlaceImageFilter< TInputImage > Superclass;
00053   typedef SmartPointer< Self >              Pointer;
00054   typedef SmartPointer< const Self >        ConstPointer;
00055 
00057   itkNewMacro(Self);
00058 
00060   typedef typename TInputImage::RegionType InputImageRegionType;
00061   typedef typename TInputImage::RegionType OutputImageRegionType;
00062 
00064   typedef typename TInputImage::Pointer InputImagePointer;
00065   typedef typename TInputImage::Pointer OutputImagePointer;
00066 
00068   typedef typename TInputImage::PixelType InputImagePixelType;
00069   typedef typename TInputImage::PixelType OutputImagePixelType;
00070 
00072   typedef typename TInputImage::IndexType  InputImageIndexType;
00073   typedef typename TInputImage::SizeType   InputImageSizeType;
00074   typedef typename TInputImage::OffsetType InputImageOffsetType;
00075   typedef typename TInputImage::IndexType  OutputImageIndexType;
00076   typedef typename TInputImage::SizeType   OutputImageSizeType;
00077   typedef typename TInputImage::OffsetType OutputImageOffsetType;
00078 
00080   typedef typename NumericTraits< OutputImagePixelType >::RealType RealType;
00081 
00083   itkStaticConstMacro(ImageDimension, unsigned int,
00084                       TInputImage::ImageDimension);
00085 
00087   itkTypeMacro(ShiftScaleInPlaceImageFilter, InPlaceImageFilter);
00088 
00091   itkSetMacro(Shift, RealType);
00092   itkGetConstMacro(Shift, RealType);
00094 
00097   itkSetMacro(Scale, RealType);
00098   itkGetConstMacro(Scale, RealType);
00100 
00102   itkGetConstMacro(UnderflowCount, long);
00103   itkGetConstMacro(OverflowCount, long);
00105 
00106 #ifdef ITK_USE_CONCEPT_CHECKING
00107 
00108   itkConceptMacro( InputHasNumericTraitsCheck,
00109                    ( Concept::HasNumericTraits< InputImagePixelType > ) );
00110   itkConceptMacro( InputPlusRealTypeCheck,
00111                    ( Concept::AdditiveOperators< InputImagePixelType, RealType, RealType > ) );
00112   itkConceptMacro( RealTypeMultiplyOperatorCheck,
00113                    ( Concept::MultiplyOperator< RealType > ) );
00114 
00116 #endif
00117 protected:
00118   ShiftScaleInPlaceImageFilter();
00119   ~ShiftScaleInPlaceImageFilter();
00120   void PrintSelf(std::ostream & os, Indent indent) const;
00122 
00124   void BeforeThreadedGenerateData();
00125 
00127   void AfterThreadedGenerateData();
00128 
00130   void  ThreadedGenerateData(const OutputImageRegionType &
00131                              outputRegionForThread,
00132                              ThreadIdType threadId);
00133 
00134 private:
00135   ShiftScaleInPlaceImageFilter(const Self &); //purposely not implemented
00136   void operator=(const Self &);               //purposely not implemented
00137 
00138   RealType m_Shift;
00139   RealType m_Scale;
00140 
00141   long m_UnderflowCount;
00142   long m_OverflowCount;
00143 
00144   Array< long > m_ThreadUnderflow;
00145   Array< long > m_ThreadOverflow;
00146 };
00147 } // end namespace itk
00148 
00149 #ifndef ITK_MANUAL_INSTANTIATION
00150 #include "itkShiftScaleInPlaceImageFilter.hxx"
00151 #endif
00152 
00153 #endif
00154