SCIRun  5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ColorMap.h
Go to the documentation of this file.
1 /*
2  For more information, please see: http://software.sci.utah.edu
3 
4  The MIT License
5 
6  Copyright (c) 2009 Scientific Computing and Imaging Institute,
7  University of Utah.
8 
9 
10  Permission is hereby granted, free of charge, to any person obtaining a
11  copy of this software and associated documentation files (the "Software"),
12  to deal in the Software without restriction, including without limitation
13  the rights to use, copy, modify, merge, publish, distribute, sublicense,
14  and/or sell copies of the Software, and to permit persons to whom the
15  Software is furnished to do so, subject to the following conditions:
16 
17  The above copyright notice and this permission notice shall be included
18  in all copies or substantial portions of the Software.
19 
20  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
26  DEALINGS IN THE SOFTWARE.
27 */
28 
29 
30 
31 ///
32 ///@file ColorMap.h
33 ///@brief ColorMap definitions
34 ///
35 ///@author
36 /// Steven G. Parker
37 /// Department of Computer Science
38 /// University of Utah
39 ///@date November 1994
40 ///
41 
42 #ifndef CORE_DATATYPES_COLORMAP_H
43 #define CORE_DATATYPES_COLORMAP_H 1
44 
45 #include <vector>
46 
47 #include <Core/Containers/LockingHandle.h>
48 #include <Core/Datatypes/PropertyManager.h>
49 #include <Core/Datatypes/Material.h>
50 
51 #include <slivr/ColorMap.h>
52 
53 #include <Core/Datatypes/share.h>
54 
55 namespace SCIRun {
56 
57 class SCISHARE ColorMap : public SLIVR::ColorMap, public PropertyManager
58 {
59 public:
60  ColorMap(const ColorMap&);
61  ColorMap(const SLIVR::ColorMap&);
62  ColorMap(const float *);
63  ColorMap(const std::vector<Color>& rgb,
64  const std::vector<float>& rgbT,
65  const std::vector<float>& alphas,
66  const std::vector<float>& alphaT,
67  unsigned int resolution = 256);
68  virtual ~ColorMap();
69  virtual ColorMap* clone();
70 
71  // Lookup which color value would be associated with in the colormap.
72  const MaterialHandle& lookup(double value) const;
73 
74  // Lookup a color in the colormap by a value that has already been fitted
75  // to the min/max of the colormap (value should be between 1 and ncolors).
76  const MaterialHandle& lookup2(double value) const;
77 
78  // Persistent representation.
79  virtual void io(Piostream&);
81 
82  virtual std::string dynamic_type_name() const;
83 
84 private:
85  ColorMap();
86  static Persistent * maker();
87  void build_materials_from_rgba();
88 
89  std::vector<MaterialHandle> materials_;
90 };
91 
92 
93 typedef LockingHandle<ColorMap> ColorMapHandle;
94 
95 
96 } // End namespace SCIRun
97 
98 
99 #endif
Definition: Persistent.h:89
Definition: Persistent.h:187
#define SCISHARE
Definition: share.h:39
LockingHandle< Material > MaterialHandle
Definition: Material.h:65
Definition: ColorMap.h:57
LockingHandle< ColorMap > ColorMapHandle
Definition: ColorMap.h:93
static PersistentTypeID type_id
Definition: ColorMap.h:80
Definition: Persistent.h:64
Definition: PropertyManager.h:193