1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
|
#ifndef LOOKUPTABLEINTENSITYMAPPINGFILTER_H
#define LOOKUPTABLEINTENSITYMAPPINGFILTER_H
#include "SNAPCommon.h"
#include <itkImageToImageFilter.h>
#include <itkSimpleDataObjectDecorator.h>
/**
This ITK filter uses a lookup table to map image intensities. The input
image should be of an integral type.
*/
template<class TInputImage, class TOutputImage>
class LookupTableIntensityMappingFilter :
public itk::ImageToImageFilter<TInputImage, TOutputImage>
{
public:
typedef LookupTableIntensityMappingFilter<TInputImage, TOutputImage> Self;
typedef itk::ImageToImageFilter<TInputImage, TOutputImage> Superclass;
typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<const Self> ConstPointer;
typedef TInputImage InputImageType;
typedef typename InputImageType::PixelType InputPixelType;
typedef TOutputImage OutputImageType;
typedef typename OutputImageType::PixelType OutputPixelType;
typedef itk::Image<OutputPixelType, 1> LookupTableType;
typedef typename Superclass::OutputImageRegionType OutputImageRegionType;
typedef itk::SimpleDataObjectDecorator<InputPixelType> InputPixelObject;
itkTypeMacro(LookupTableIntensityMappingFilter, ImageToImageFilter)
itkNewMacro(Self)
/** Set the intensity remapping curve - for contrast adjustment */
void SetLookupTable(LookupTableType *lut);
/**
* Set the range of the input image (these outputs are generated by the
* MaximumMinimumImageFilter)
*/
void SetImageMinInput(InputPixelObject *input);
void SetImageMaxInput(InputPixelObject *input);
/** The actual work */
void ThreadedGenerateData(const OutputImageRegionType ®ion,
itk::ThreadIdType threadId);
/** Process a single pixel */
OutputPixelType MapPixel(const InputPixelType &pixel);
protected:
LookupTableIntensityMappingFilter();
virtual ~LookupTableIntensityMappingFilter() {}
SmartPtr<InputPixelObject> m_InputMin, m_InputMax;
SmartPtr<LookupTableType> m_LookupTable;
};
#endif // LOOKUPTABLEINTENSITYMAPPINGFILTER_H
|