Medical Imaging Interaction Toolkit  2018.4.99-12ad79a3
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 (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef _MITK_MATERIAL_H_
14 #define _MITK_MATERIAL_H_
15 
16 #include <MitkCoreExports.h>
17 #include <itkObject.h>
18 #include <itkRGBPixel.h>
19 #include <itkVectorContainer.h>
20 #include <mitkCommon.h>
21 #include <string>
22 #include <vtkSystemIncludes.h>
23 
24 namespace mitk
25 {
34  class MITKCORE_EXPORT Material : public itk::Object
35  {
36  public:
38 
39  typedef itk::RGBPixel<double> Color;
40 
42  {
45  Phong
46  };
47 
49  {
53  };
54 
64  static Pointer New()
65  {
66  Pointer smartPtr = new Material();
67  smartPtr->UnRegister();
68  return smartPtr;
69  }
70 
82  static Pointer New(Color color, double opacity = 1.0f)
83  {
84  Pointer smartPtr = new Material(color, opacity);
85  smartPtr->UnRegister();
86  return smartPtr;
87  }
88 
101  static Pointer New(double red, double green, double blue, double opacity = 1.0f)
102  {
103  Pointer smartPtr = new Material(red, green, blue, opacity);
104  smartPtr->UnRegister();
105  return smartPtr;
106  }
107 
126  static Pointer New(double red,
127  double green,
128  double blue,
129  double colorCoefficient,
130  double specularCoefficient,
131  double specularPower,
132  double opacity)
133  {
134  Pointer smartPtr = new Material(red, green, blue, colorCoefficient, specularCoefficient, specularPower, opacity);
135  smartPtr->UnRegister();
136  return smartPtr;
137  }
138 
157  static Pointer New(
158  Color color, double colorCoefficient, double specularCoefficient, double specularPower, double opacity)
159  {
160  Pointer smartPtr = new Material(color, colorCoefficient, specularCoefficient, specularPower, opacity);
161  smartPtr->UnRegister();
162  return smartPtr;
163  }
164 
169 
174  static Pointer New(
175  const Material &property, double red, double green, double blue, double opacity = 1.0, std::string name = "")
176  {
177  Pointer smartPtr = new Material(property, red, green, blue, opacity, name);
178  smartPtr->UnRegister();
179  return smartPtr;
180  }
181 
182  virtual bool Assignable(const Material &other) const;
183  virtual Material &operator=(const Material &other);
184 
185  /* Sets the materials color in RGB space. The rgb components have to be
186  * in the range [0..1]
187  * @param color the new color of the material
188  */
189  virtual void SetColor(Color color);
190 
198  virtual void SetColor(double red, double green, double blue);
199 
205  virtual void SetColorCoefficient(double coefficient);
206 
212  virtual void SetSpecularColor(Color color);
213 
220  virtual void SetSpecularColor(double red, double green, double blue);
221 
228  virtual void SetSpecularCoefficient(double specularCoefficient);
229 
236  virtual void SetSpecularPower(double specularPower);
237 
244  virtual void SetOpacity(double opacity);
245 
253  virtual void SetInterpolation(InterpolationType interpolation);
254 
262  virtual void SetRepresentation(RepresentationType representation);
263 
267  virtual void SetLineWidth(float lineWidth);
268 
272  virtual Color GetColor() const;
273 
277  virtual double GetColorCoefficient() const;
278 
283  virtual Color GetSpecularColor() const;
284 
288  virtual double GetSpecularCoefficient() const;
289 
293  virtual double GetSpecularPower() const;
294 
298  virtual double GetOpacity() const;
299 
303  virtual InterpolationType GetInterpolation() const;
304 
308  virtual RepresentationType GetRepresentation() const;
309 
314  virtual int GetVtkInterpolation() const;
315 
320  virtual int GetVtkRepresentation() const;
321 
325  virtual float GetLineWidth() const;
326 
333  virtual void Initialize(const Material &property);
334 
339  virtual bool operator==(const Material &property) const;
340 
344  void PrintSelf(std::ostream &os, itk::Indent) const override;
345 
351  itkSetMacro(Name, std::string);
352 
356  itkGetConstMacro(Name, std::string);
357 
358  protected:
368  Material();
369 
381  Material(Color color, double opacity = 1.0f);
382 
395  Material(double red, double green, double blue, double opacity = 1.0f);
396 
415  Material(double red,
416  double green,
417  double blue,
418  double colorCoefficient,
419  double specularCoefficient,
420  double specularPower,
421  double opacity);
422 
441  Material(Color color, double colorCoefficient, double specularCoefficient, double specularPower, double opacity);
442 
446  Material(const Material &property);
447 
452  Material(
453  const Material &property, double red, double green, double blue, double opacity = 1.0, std::string name = "");
454 
455  virtual void InitializeStandardValues();
456 
457  virtual void Update();
458 
459  std::string m_Name;
460 
461  Color m_Color;
462 
464 
466 
468 
470 
471  double m_Opacity;
472 
473  float m_LineWidth;
474 
476 
478  };
479 
480  typedef itk::VectorContainer<unsigned int, Material::Pointer> MaterialVectorContainer;
481 }
482 
483 #endif
Class for storing surfaces (vtkPolyData).
Definition: mitkSurface.h:28
double m_ColorCoefficient
Definition: mitkMaterial.h:465
double m_SpecularPower
Definition: mitkMaterial.h:469
#define MITKCORE_EXPORT
#define mitkNewMacro1Param(classname, type)
Definition: mitkCommon.h:72
InterpolationType m_Interpolation
Definition: mitkMaterial.h:475
Color m_SpecularColor
Definition: mitkMaterial.h:463
static Pointer New()
Definition: mitkMaterial.h:64
static void Update(vtkPolyData *)
Definition: mitkSurface.cpp:31
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:174
double m_SpecularCoefficient
Definition: mitkMaterial.h:467
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:157
#define mitkClassMacroItkParent(className, SuperClassName)
Definition: mitkCommon.h:49
itk::VectorContainer< unsigned int, Material::Pointer > MaterialVectorContainer
Definition: mitkMaterial.h:480
static Pointer New(Color color, double opacity=1.0f)
Definition: mitkMaterial.h:82
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:101
RepresentationType m_Representation
Definition: mitkMaterial.h:477
std::string m_Name
Definition: mitkMaterial.h:459
static Pointer New(double red, double green, double blue, double colorCoefficient, double specularCoefficient, double specularPower, double opacity)
Definition: mitkMaterial.h:126