ITK  4.4.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  itkGetModifiableObjectMacro(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);
130 
131 protected:
134 
135  void PrintSelf(std::ostream & os, Indent indent) const;
136 
137  virtual void GenerateOutputInformation()
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 
142  Superclass::GenerateOutputInformation();
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);
168 
170  void BeforeThreadedGenerateData();
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
187