1 /*=========================================================================
3 Program: Visualization Toolkit
4 Module: $RCSfile: vtkImageMapToColors.h,v $
6 Date: $Date: 2002/12/11 14:26:22 $
7 Version: $Revision: 1.19 $
9 Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen
11 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
13 This software is distributed WITHOUT ANY WARRANTY; without even
14 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 PURPOSE. See the above copyright notice for more information.
17 =========================================================================*/
18 // .NAME vtkImageMapToColors - map the input image through a lookup table
19 // .SECTION Description
20 // The vtkImageMapToColors filter will take an input image of any valid
21 // scalar type, and map the first component of the image through a
22 // lookup table. The result is an image of type VTK_UNSIGNED_CHAR.
23 // If the lookup table is not set, or is set to NULL, then the input
24 // data will be passed through if it is already of type UNSIGNED_CHAR.
27 // vtkLookupTable vtkScalarsToColors
29 #ifndef __vtkImageMapToColors_h
30 #define __vtkImageMapToColors_h
33 #include "vtkImageToImageFilter.h"
35 class vtkScalarsToColors;
37 class VTK_IMAGING_EXPORT vtkImageMapToColors : public vtkImageToImageFilter
40 static vtkImageMapToColors *New();
41 vtkTypeRevisionMacro(vtkImageMapToColors,vtkImageToImageFilter);
42 void PrintSelf(ostream& os, vtkIndent indent);
45 // Set the lookup table.
46 virtual void SetLookupTable(vtkScalarsToColors*);
47 vtkGetObjectMacro(LookupTable,vtkScalarsToColors);
50 // Set the output format, the default is RGBA.
51 vtkSetMacro(OutputFormat,int);
52 vtkGetMacro(OutputFormat,int);
53 void SetOutputFormatToRGBA() { this->OutputFormat = VTK_RGBA; };
54 void SetOutputFormatToRGB() { this->OutputFormat = VTK_RGB; };
55 void SetOutputFormatToLuminanceAlpha() { this->OutputFormat = VTK_LUMINANCE_ALPHA; };
56 void SetOutputFormatToLuminance() { this->OutputFormat = VTK_LUMINANCE; };
59 // Set the component to map for multi-component images (default: 0)
60 vtkSetMacro(ActiveComponent,int);
61 vtkGetMacro(ActiveComponent,int);
64 // Use the alpha component of the input when computing the alpha component
65 // of the output (useful when converting monochrome+alpha data to RGBA)
66 vtkSetMacro(PassAlphaToOutput,int);
67 vtkBooleanMacro(PassAlphaToOutput,int);
68 vtkGetMacro(PassAlphaToOutput,int);
71 // We need to check the modified time of the lookup table too.
72 unsigned long GetMTime();
75 vtkImageMapToColors();
76 ~vtkImageMapToColors();
78 void ExecuteInformation(vtkImageData *inData, vtkImageData *outData);
79 void ExecuteInformation() {
80 this->vtkImageToImageFilter::ExecuteInformation(); };
81 void ThreadedExecute(vtkImageData *inData, vtkImageData *outData,
82 int extent[6], int id);
84 void ExecuteData(vtkDataObject *output);
86 vtkScalarsToColors *LookupTable;
90 int PassAlphaToOutput;
94 vtkImageMapToColors(const vtkImageMapToColors&); // Not implemented.
95 void operator=(const vtkImageMapToColors&); // Not implemented.