Medical Imaging Interaction Toolkit  2024.06.99-60d9b802
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 mitkMaterial_h
14 #define mitkMaterial_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 
61  static Pointer New()
62  {
63  Pointer smartPtr = new Material();
64  smartPtr->UnRegister();
65  return smartPtr;
66  }
67 
76  static Pointer New(Color color, double opacity = 1.0f)
77  {
78  Pointer smartPtr = new Material(color, opacity);
79  smartPtr->UnRegister();
80  return smartPtr;
81  }
82 
92  static Pointer New(double red, double green, double blue, double opacity = 1.0f)
93  {
94  Pointer smartPtr = new Material(red, green, blue, opacity);
95  smartPtr->UnRegister();
96  return smartPtr;
97  }
98 
114  static Pointer New(double red,
115  double green,
116  double blue,
117  double colorCoefficient,
118  double specularCoefficient,
119  double specularPower,
120  double opacity)
121  {
122  Pointer smartPtr = new Material(red, green, blue, colorCoefficient, specularCoefficient, specularPower, opacity);
123  smartPtr->UnRegister();
124  return smartPtr;
125  }
126 
142  static Pointer New(
143  Color color, double colorCoefficient, double specularCoefficient, double specularPower, double opacity)
144  {
145  Pointer smartPtr = new Material(color, colorCoefficient, specularCoefficient, specularPower, opacity);
146  smartPtr->UnRegister();
147  return smartPtr;
148  }
149 
154 
159  static Pointer New(
160  const Material &property, double red, double green, double blue, double opacity = 1.0, std::string name = "")
161  {
162  Pointer smartPtr = new Material(property, red, green, blue, opacity, name);
163  smartPtr->UnRegister();
164  return smartPtr;
165  }
166 
167  virtual bool Assignable(const Material &other) const;
168  virtual Material &operator=(const Material &other);
169 
170  /* Sets the materials color in RGB space. The rgb components have to be
171  * in the range [0..1]
172  * @param color the new color of the material
173  */
174  virtual void SetColor(Color color);
175 
183  virtual void SetColor(double red, double green, double blue);
184 
190  virtual void SetColorCoefficient(double coefficient);
191 
197  virtual void SetSpecularColor(Color color);
198 
205  virtual void SetSpecularColor(double red, double green, double blue);
206 
213  virtual void SetSpecularCoefficient(double specularCoefficient);
214 
221  virtual void SetSpecularPower(double specularPower);
222 
229  virtual void SetOpacity(double opacity);
230 
238  virtual void SetInterpolation(InterpolationType interpolation);
239 
247  virtual void SetRepresentation(RepresentationType representation);
248 
252  virtual void SetLineWidth(float lineWidth);
253 
257  virtual Color GetColor() const;
258 
262  virtual double GetColorCoefficient() const;
263 
268  virtual Color GetSpecularColor() const;
269 
273  virtual double GetSpecularCoefficient() const;
274 
278  virtual double GetSpecularPower() const;
279 
283  virtual double GetOpacity() const;
284 
288  virtual InterpolationType GetInterpolation() const;
289 
293  virtual RepresentationType GetRepresentation() const;
294 
299  virtual int GetVtkInterpolation() const;
300 
305  virtual int GetVtkRepresentation() const;
306 
310  virtual float GetLineWidth() const;
311 
318  virtual void Initialize(const Material &property);
319 
324  virtual bool operator==(const Material &property) const;
325 
329  void PrintSelf(std::ostream &os, itk::Indent) const override;
330 
336  itkSetMacro(Name, std::string);
337 
341  itkGetConstMacro(Name, std::string);
342 
343  protected:
350  Material();
351 
360  Material(Color color, double opacity = 1.0f);
361 
371  Material(double red, double green, double blue, double opacity = 1.0f);
372 
388  Material(double red,
389  double green,
390  double blue,
391  double colorCoefficient,
392  double specularCoefficient,
393  double specularPower,
394  double opacity);
395 
411  Material(Color color, double colorCoefficient, double specularCoefficient, double specularPower, double opacity);
412 
416  Material(const Material &property);
417 
422  Material(
423  const Material &property, double red, double green, double blue, double opacity = 1.0, std::string name = "");
424 
425  virtual void InitializeStandardValues();
426 
427  virtual void Update();
428 
429  std::string m_Name;
430 
432 
434 
436 
438 
440 
441  double m_Opacity;
442 
443  float m_LineWidth;
444 
446 
448  };
449 
450  typedef itk::VectorContainer<unsigned int, Material::Pointer> MaterialVectorContainer;
451 }
452 
453 #endif
mitk::Material::Flat
@ Flat
Definition: mitkMaterial.h:43
mitk::Material::m_Color
Color m_Color
Definition: mitkMaterial.h:431
mitk::Material::InterpolationType
InterpolationType
Definition: mitkMaterial.h:41
mitk::Material::m_Representation
RepresentationType m_Representation
Definition: mitkMaterial.h:447
mitk::Material::New
static Pointer New(Color color, double opacity=1.0f)
Definition: mitkMaterial.h:76
mitkNewMacro1Param
#define mitkNewMacro1Param(classname, type)
Definition: mitkCommon.h:68
mitk::Material::New
static Pointer New(double red, double green, double blue, double opacity=1.0f)
Definition: mitkMaterial.h:92
mitk::Color
itk::RGBPixel< float > Color
Color Standard RGB color typedef (float)
Definition: mitkColorProperty.h:38
itk::SmartPointer< Self >
mitk::Material::RepresentationType
RepresentationType
Definition: mitkMaterial.h:48
mitk::Material::m_Name
std::string m_Name
Definition: mitkMaterial.h:429
mitk::Surface
Class for storing surfaces (vtkPolyData).
Definition: mitkSurface.h:28
mitk::Material::Color
itk::RGBPixel< double > Color
Definition: mitkMaterial.h:37
mitk::Material::Wireframe
@ Wireframe
Definition: mitkMaterial.h:51
mitkClassMacroItkParent
#define mitkClassMacroItkParent(className, SuperClassName)
Definition: mitkCommon.h:45
mitk
Find image slices visible on a given plane.
Definition: RenderingTests.dox:1
mitk::Material::m_ColorCoefficient
double m_ColorCoefficient
Definition: mitkMaterial.h:435
mitk::Material::m_Opacity
double m_Opacity
Definition: mitkMaterial.h:441
mitk::operator==
MITKCORE_EXPORT bool operator==(const InteractionEvent &a, const InteractionEvent &b)
mitk::MaterialVectorContainer
itk::VectorContainer< unsigned int, Material::Pointer > MaterialVectorContainer
Definition: mitkMaterial.h:450
MitkCoreExports.h
mitk::Material::New
static Pointer New(double red, double green, double blue, double colorCoefficient, double specularCoefficient, double specularPower, double opacity)
Definition: mitkMaterial.h:114
mitkCommon.h
mitk::Material
Definition: mitkMaterial.h:34
mitk::Material::New
static Pointer New()
Definition: mitkMaterial.h:61
mitk::Material::m_LineWidth
float m_LineWidth
Definition: mitkMaterial.h:443
mitk::Material::m_Interpolation
InterpolationType m_Interpolation
Definition: mitkMaterial.h:445
mitk::Material::m_SpecularCoefficient
double m_SpecularCoefficient
Definition: mitkMaterial.h:437
mitk::Material::m_SpecularPower
double m_SpecularPower
Definition: mitkMaterial.h:439
mitk::Material::m_SpecularColor
Color m_SpecularColor
Definition: mitkMaterial.h:433
mitk::Material::New
static Pointer New(const Material &property, double red, double green, double blue, double opacity=1.0, std::string name="")
Definition: mitkMaterial.h:159
mitk::Material::Gouraud
@ Gouraud
Definition: mitkMaterial.h:44
MITKCORE_EXPORT
#define MITKCORE_EXPORT
Definition: MitkCoreExports.h:15
mitk::Material::New
static Pointer New(Color color, double colorCoefficient, double specularCoefficient, double specularPower, double opacity)
Definition: mitkMaterial.h:142
mitk::Material::Points
@ Points
Definition: mitkMaterial.h:50