ITK  4.8.0
Insight Segmentation and Registration Toolkit
itkScalarToRGBColormapImageFilter.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 itkScalarToRGBColormapImageFilter_h
19 #define itkScalarToRGBColormapImageFilter_h
20 
21 #include "itkImageToImageFilter.h"
22 
23 #include "itkColormapFunction.h"
24 
25 namespace itk
26 {
76 template< typename TInputImage, typename TOutputImage >
78  public ImageToImageFilter< TInputImage, TOutputImage >
79 {
80 public:
86 
88  itkNewMacro(Self);
89 
92 
94  typedef TInputImage InputImageType;
95  typedef typename InputImageType::ConstPointer InputImagePointer;
96  typedef typename InputImageType::RegionType InputImageRegionType;
97  typedef typename InputImageType::PixelType InputImagePixelType;
98  typedef TOutputImage OutputImageType;
99  typedef typename OutputImageType::Pointer OutputImagePointer;
100  typedef typename OutputImageType::RegionType OutputImageRegionType;
101  typedef typename OutputImageType::PixelType OutputImagePixelType;
102 
105 
109  itkSetObjectMacro(Colormap, ColormapType);
110  itkGetModifiableObjectMacro(Colormap, ColormapType);
112 
116  typedef enum { Red, Green, Blue, Grey, Hot, Cool, Spring, Summer,
118 
120 
126  itkSetMacro(UseInputImageExtremaForScaling, bool);
127  itkGetConstMacro(UseInputImageExtremaForScaling, bool);
128  itkBooleanMacro(UseInputImageExtremaForScaling);
130 
131 protected:
134 
135  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
136 
137  virtual void GenerateOutputInformation() ITK_OVERRIDE
138  {
139  // this methods is overloaded so that if the output image is a
140  // VectorImage then the correct number of components are set.
141 
143  OutputImageType* output = this->GetOutput();
144 
145  if ( !output )
146  {
147  return;
148  }
149  if ( output->GetNumberOfComponentsPerPixel() != 3 )
150  {
151  output->SetNumberOfComponentsPerPixel( 3 );
152  }
153  }
154 
166  void ThreadedGenerateData(const OutputImageRegionType & outputRegionForThread,
167  ThreadIdType threadId) ITK_OVERRIDE;
168 
170  void BeforeThreadedGenerateData() ITK_OVERRIDE;
171 
172 private:
173  ScalarToRGBColormapImageFilter(const Self &); //purposely not implemented
174  void operator=(const Self &); //purposely not implemented
175 
177 
179 };
180 } // end namespace itk
181 
182 #ifndef ITK_MANUAL_INSTANTIATION
183 #include "itkScalarToRGBColormapImageFilter.hxx"
184 #endif
185 
186 #endif
virtual void SetColormap(ColormapType *_arg)
void ThreadedGenerateData(const OutputImageRegionType &outputRegionForThread, ThreadIdType threadId) override
Base class for all process objects that output image data.
Function object which maps a scalar value into an RGB colormap value.
ImageToImageFilter< TInputImage, TOutputImage > Superclass
Implements pixel-wise intensity-&gt;rgb mapping operation on one image.
OutputImageType::PixelType OutputImagePixelType
unsigned int ThreadIdType
Definition: itkIntTypes.h:159
Function::ColormapFunction< InputImagePixelType, OutputImagePixelType > ColormapType
void BeforeThreadedGenerateData() override
virtual void GenerateOutputInformation()
Base class for filters that take an image as input and produce an image as output.
OutputImageType * GetOutput()
Control indentation during Print() invocation.
Definition: itkIndent.h:49
TOutputImage OutputImageType
void PrintSelf(std::ostream &os, Indent indent) const override