Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkMaterial.h
Go to the documentation of this file.
1 /*===================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 #ifndef _MITK_MATERIAL_H_
18 #define _MITK_MATERIAL_H_
19 
20 #include <MitkCoreExports.h>
21 #include <itkObject.h>
22 #include <itkRGBPixel.h>
23 #include <itkVectorContainer.h>
24 #include <mitkCommon.h>
25 #include <string>
26 #include <vtkSystemIncludes.h>
27 
28 namespace mitk
29 {
38  class MITKCORE_EXPORT Material : public itk::Object
39  {
40  public:
42 
43  typedef itk::RGBPixel<double> Color;
44 
46  {
49  Phong
50  };
51 
53  {
57  };
58 
68  static Pointer New()
69  {
70  Pointer smartPtr = new Material();
71  smartPtr->UnRegister();
72  return smartPtr;
73  }
74 
86  static Pointer New(Color color, double opacity = 1.0f)
87  {
88  Pointer smartPtr = new Material(color, opacity);
89  smartPtr->UnRegister();
90  return smartPtr;
91  }
92 
105  static Pointer New(double red, double green, double blue, double opacity = 1.0f)
106  {
107  Pointer smartPtr = new Material(red, green, blue, opacity);
108  smartPtr->UnRegister();
109  return smartPtr;
110  }
111 
130  static Pointer New(double red,
131  double green,
132  double blue,
133  double colorCoefficient,
134  double specularCoefficient,
135  double specularPower,
136  double opacity)
137  {
138  Pointer smartPtr = new Material(red, green, blue, colorCoefficient, specularCoefficient, specularPower, opacity);
139  smartPtr->UnRegister();
140  return smartPtr;
141  }
142 
161  static Pointer New(
162  Color color, double colorCoefficient, double specularCoefficient, double specularPower, double opacity)
163  {
164  Pointer smartPtr = new Material(color, colorCoefficient, specularCoefficient, specularPower, opacity);
165  smartPtr->UnRegister();
166  return smartPtr;
167  }
168 
173 
178  static Pointer New(
179  const Material &property, double red, double green, double blue, double opacity = 1.0, std::string name = "")
180  {
181  Pointer smartPtr = new Material(property, red, green, blue, opacity, name);
182  smartPtr->UnRegister();
183  return smartPtr;
184  }
185 
186  virtual bool Assignable(const Material &other) const;
187  virtual Material &operator=(const Material &other);
188 
189  /* Sets the materials color in RGB space. The rgb components have to be
190  * in the range [0..1]
191  * @param color the new color of the material
192  */
193  virtual void SetColor(Color color);
194 
202  virtual void SetColor(double red, double green, double blue);
203 
209  virtual void SetColorCoefficient(double coefficient);
210 
216  virtual void SetSpecularColor(Color color);
217 
224  virtual void SetSpecularColor(double red, double green, double blue);
225 
232  virtual void SetSpecularCoefficient(double specularCoefficient);
233 
240  virtual void SetSpecularPower(double specularPower);
241 
248  virtual void SetOpacity(double opacity);
249 
257  virtual void SetInterpolation(InterpolationType interpolation);
258 
266  virtual void SetRepresentation(RepresentationType representation);
267 
271  virtual void SetLineWidth(float lineWidth);
272 
276  virtual Color GetColor() const;
277 
281  virtual double GetColorCoefficient() const;
282 
287  virtual Color GetSpecularColor() const;
288 
292  virtual double GetSpecularCoefficient() const;
293 
297  virtual double GetSpecularPower() const;
298 
302  virtual double GetOpacity() const;
303 
307  virtual InterpolationType GetInterpolation() const;
308 
312  virtual RepresentationType GetRepresentation() const;
313 
318  virtual int GetVtkInterpolation() const;
319 
324  virtual int GetVtkRepresentation() const;
325 
329  virtual float GetLineWidth() const;
330 
337  virtual void Initialize(const Material &property);
338 
343  virtual bool operator==(const Material &property) const;
344 
348  void PrintSelf(std::ostream &os, itk::Indent) const override;
349 
355  itkSetMacro(Name, std::string);
356 
360  itkGetConstMacro(Name, std::string);
361 
362  protected:
372  Material();
373 
385  Material(Color color, double opacity = 1.0f);
386 
399  Material(double red, double green, double blue, double opacity = 1.0f);
400 
419  Material(double red,
420  double green,
421  double blue,
422  double colorCoefficient,
423  double specularCoefficient,
424  double specularPower,
425  double opacity);
426 
445  Material(Color color, double colorCoefficient, double specularCoefficient, double specularPower, double opacity);
446 
450  Material(const Material &property);
451 
456  Material(
457  const Material &property, double red, double green, double blue, double opacity = 1.0, std::string name = "");
458 
459  virtual void InitializeStandardValues();
460 
461  virtual void Update();
462 
463  std::string m_Name;
464 
465  Color m_Color;
466 
468 
470 
472 
474 
475  double m_Opacity;
476 
477  float m_LineWidth;
478 
480 
482  };
483 
484  typedef itk::VectorContainer<unsigned int, Material::Pointer> MaterialVectorContainer;
485 }
486 
487 #endif
Class for storing surfaces (vtkPolyData).
Definition: mitkSurface.h:32
double m_ColorCoefficient
Definition: mitkMaterial.h:469
double m_SpecularPower
Definition: mitkMaterial.h:473
#define MITKCORE_EXPORT
#define mitkNewMacro1Param(classname, type)
Definition: mitkCommon.h:76
InterpolationType m_Interpolation
Definition: mitkMaterial.h:479
Color m_SpecularColor
Definition: mitkMaterial.h:467
static Pointer New()
Definition: mitkMaterial.h:68
static void Update(vtkPolyData *)
Definition: mitkSurface.cpp:35
DataCollection - Class to facilitate loading/accessing structured data.
static Pointer New(const Material &property, double red, double green, double blue, double opacity=1.0, std::string name="")
Definition: mitkMaterial.h:178
double m_SpecularCoefficient
Definition: mitkMaterial.h:471
MITKCORE_EXPORT bool operator==(const InteractionEvent &a, const InteractionEvent &b)
static Pointer New(Color color, double colorCoefficient, double specularCoefficient, double specularPower, double opacity)
Definition: mitkMaterial.h:161
#define mitkClassMacroItkParent(className, SuperClassName)
Definition: mitkCommon.h:53
itk::VectorContainer< unsigned int, Material::Pointer > MaterialVectorContainer
Definition: mitkMaterial.h:484
static Pointer New(Color color, double opacity=1.0f)
Definition: mitkMaterial.h:86
itk::RGBPixel< float > Color
Color Standard RGB color typedef (float)
static Pointer New(double red, double green, double blue, double opacity=1.0f)
Definition: mitkMaterial.h:105
RepresentationType m_Representation
Definition: mitkMaterial.h:481
std::string m_Name
Definition: mitkMaterial.h:463
static Pointer New(double red, double green, double blue, double colorCoefficient, double specularCoefficient, double specularPower, double opacity)
Definition: mitkMaterial.h:130