ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkTestingStretchIntensityImageFilter.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 __itkTestingStretchIntensityImageFilter_h
00019   #define __itkTestingStretchIntensityImageFilter_h
00020 
00021   #include "itkUnaryFunctorImageFilter.h"
00022 
00023   namespace itk
00024   {
00025   namespace Testing
00026   {
00027 
00040 template< typename  TInputImage, typename  TOutputImage = TInputImage >
00041 class ITK_EXPORT StretchIntensityImageFilter: public ImageSource< TOutputImage >
00042 {
00043 public:
00045   typedef StretchIntensityImageFilter     Self;
00046   typedef ImageSource< TOutputImage >     Superclass;
00047   typedef SmartPointer< Self >            Pointer;
00048   typedef SmartPointer< const Self >      ConstPointer;
00049 
00050   typedef typename TOutputImage::PixelType                   OutputPixelType;
00051   typedef typename TInputImage::PixelType                    InputPixelType;
00052   typedef typename NumericTraits< InputPixelType >::RealType RealType;
00053 
00055   itkNewMacro(Self);
00056 
00058   itkTypeMacro(StretchIntensityImageFilter, ImageSource);
00059 
00060   itkSetMacro(OutputMinimum, OutputPixelType);
00061   itkSetMacro(OutputMaximum, OutputPixelType);
00062   itkGetConstReferenceMacro(OutputMinimum, OutputPixelType);
00063   itkGetConstReferenceMacro(OutputMaximum, OutputPixelType);
00064 
00068   itkGetConstReferenceMacro(Scale, RealType);
00069   itkGetConstReferenceMacro(Shift, RealType);
00071 
00074   itkGetConstReferenceMacro(InputMinimum, InputPixelType);
00075   itkGetConstReferenceMacro(InputMaximum, InputPixelType);
00077 
00079   using Superclass::SetInput;
00080   virtual void SetInput(const TInputImage *image);
00081   const TInputImage * GetInput(void) const;
00083 
00084 #ifdef ITK_USE_CONCEPT_CHECKING
00085 
00086   itkConceptMacro( InputHasNumericTraitsCheck,
00087                    ( Concept::HasNumericTraits< InputPixelType > ) );
00088   itkConceptMacro( OutputHasNumericTraitsCheck,
00089                    ( Concept::HasNumericTraits< OutputPixelType > ) );
00090   itkConceptMacro( RealTypeMultiplyOperatorCheck,
00091                    ( Concept::MultiplyOperator< RealType > ) );
00092   itkConceptMacro( RealTypeAdditiveOperatorsCheck,
00093                    ( Concept::AdditiveOperators< RealType > ) );
00094 
00096 #endif
00097 
00098 protected:
00099   StretchIntensityImageFilter();
00100   virtual ~StretchIntensityImageFilter() {}
00101 
00103   void BeforeThreadedGenerateData(void);
00104 
00106   void PrintSelf(std::ostream & os, Indent indent) const;
00107 
00108   typedef typename Superclass::OutputImageRegionType    OutputImageRegionType;
00109   typedef typename TInputImage::RegionType              InputImageRegionType;
00110 
00119   void ThreadedGenerateData(const OutputImageRegionType & outputRegionForThread, ThreadIdType threadId);
00120 
00121 private:
00122   StretchIntensityImageFilter(const Self &); //purposely not implemented
00123   void operator=(const Self &);              //purposely not implemented
00124 
00125   RealType m_Scale;
00126   RealType m_Shift;
00127 
00128   InputPixelType m_InputMinimum;
00129   InputPixelType m_InputMaximum;
00130 
00131   OutputPixelType m_OutputMinimum;
00132   OutputPixelType m_OutputMaximum;
00133 };
00134 } // end namespace Testing
00135 } // end namespace itk
00136 
00137 #ifndef ITK_MANUAL_INSTANTIATION
00138 #include "itkTestingStretchIntensityImageFilter.hxx"
00139 #endif
00140 
00141 #endif
00142