ITK  5.0.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 >
77 class ITK_TEMPLATE_EXPORT ScalarToRGBColormapImageFilter:
78  public ImageToImageFilter< TInputImage, TOutputImage >
79 {
80 public:
81  ITK_DISALLOW_COPY_AND_ASSIGN(ScalarToRGBColormapImageFilter);
82 
88 
90  itkNewMacro(Self);
91 
94 
96  using InputImageType = TInputImage;
97  using InputImagePointer = typename InputImageType::ConstPointer;
99  using InputImagePixelType = typename InputImageType::PixelType;
100  using OutputImageType = TOutputImage;
101  using OutputImagePointer = typename OutputImageType::Pointer;
103  using OutputImagePixelType = typename OutputImageType::PixelType;
104 
107 
109  itkSetObjectMacro(Colormap, ColormapType);
110  itkGetModifiableObjectMacro(Colormap, ColormapType);
112 
114  typedef enum { Red, Green, Blue, Grey, Hot, Cool, Spring, Summer,
115  Autumn, Winter, Copper, Jet, HSV, OverUnder } ColormapEnumType;
116 
117  void SetColormap(ColormapEnumType);
118 
122  itkSetMacro(UseInputImageExtremaForScaling, bool);
123  itkGetConstMacro(UseInputImageExtremaForScaling, bool);
124  itkBooleanMacro(UseInputImageExtremaForScaling);
126 
127 protected:
129  ~ScalarToRGBColormapImageFilter() override = default;
130 
131  void PrintSelf(std::ostream & os, Indent indent) const override;
132 
136  {
137  Superclass::GenerateOutputInformation();
138  OutputImageType* output = this->GetOutput();
140 
141  if ( !output )
142  {
143  return;
144  }
145  if ( output->GetNumberOfComponentsPerPixel() != 3 )
146  {
147  output->SetNumberOfComponentsPerPixel( 3 );
148  }
149  }
150 
163  void DynamicThreadedGenerateData(const OutputImageRegionType & outputRegionForThread) override;
164 
166  void BeforeThreadedGenerateData() override;
167 
168 private:
169 private:
171 
173 };
174 } // end namespace itk
175 
176 #ifndef ITK_MANUAL_INSTANTIATION
177 #include "itkScalarToRGBColormapImageFilter.hxx"
178 #endif
179 
180 #endif
typename OutputImageType::Pointer OutputImagePointer
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Base class for all process objects that output image data.
typename OutputImageType::PixelType OutputImagePixelType
Function object which maps a scalar value into an RGB colormap value.
typename InputImageType::PixelType InputImagePixelType
Implements pixel-wise intensity-&gt;rgb mapping operation on one image.
typename InputImageType::Pointer InputImagePointer
typename OutputImageType::RegionType OutputImageRegionType
TOutputImage OutputImageType
typename InputImageType::RegionType InputImageRegionType
Base class for filters that take an image as input and produce an image as output.
Control indentation during Print() invocation.
Definition: itkIndent.h:49