ITK  4.2.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< class TInputImage, class 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  itkGetObjectMacro(Colormap, ColormapType);
112 
116  typedef enum { Red, Green, Blue, Grey, Hot, Cool, Spring, Summer,
117  Autumn, Winter, Copper, Jet, HSV, OverUnder } ColormapEnumType;
118 
119  void SetColormap(ColormapEnumType);
120 
126  itkSetMacro(UseInputImageExtremaForScaling, bool);
127  itkGetConstMacro(UseInputImageExtremaForScaling, bool);
128  itkBooleanMacro(UseInputImageExtremaForScaling);
129 protected:
133 
134  void PrintSelf(std::ostream & os, Indent indent) const;
135 
136  virtual void GenerateOutputInformation()
137  {
138  // this methods is overloaded so that if the output image is a
139  // VectorImage then the correct number of components are set.
140 
141  Superclass::GenerateOutputInformation();
142  OutputImageType* output = this->GetOutput();
143 
144  if ( !output )
145  {
146  return;
147  }
148  if ( output->GetNumberOfComponentsPerPixel() != 3 )
149  {
150  output->SetNumberOfComponentsPerPixel( 3 );
151  }
152  }
153 
165  void ThreadedGenerateData(const OutputImageRegionType & outputRegionForThread,
166  ThreadIdType threadId);
167 
169  void BeforeThreadedGenerateData();
170 
171 private:
172  ScalarToRGBColormapImageFilter(const Self &); //purposely not implemented
173  void operator=(const Self &); //purposely not implemented
174 
176 
178 };
179 } // end namespace itk
180 
181 #ifndef ITK_MANUAL_INSTANTIATION
182 #include "itkScalarToRGBColormapImageFilter.hxx"
183 #endif
184 
185 #endif
186