Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
mitkDoseNodeHelper.cpp
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 
18 #include "mitkDoseNodeHelper.h"
19 
20 #include <mitkRTConstants.h>
25 #include <mitkIsoLevelsGenerator.h>
26 
27 #include <vtkSmartPointer.h>
28 #include <vtkMath.h>
29 #include <mitkTransferFunction.h>
32 
34 {
35  if (node)
36  {
37  //set some specific colorwash and isoline properties
40 
42 
45 
47 
51 
53 
54  //Generating the Colorwash
55  vtkSmartPointer<vtkColorTransferFunction> transferFunction = vtkSmartPointer<vtkColorTransferFunction>::New();
56 
57  for (mitk::IsoDoseLevelSet::ConstIterator itIsoDoseLevel = isoDoseLevelPreset->Begin(); itIsoDoseLevel != isoDoseLevelPreset->End(); ++itIsoDoseLevel)
58  {
59  float *hsv = new float[3];
60  //used for transfer rgb to hsv
61  vtkSmartPointer<vtkMath> cCalc = vtkSmartPointer<vtkMath>::New();
62  if (itIsoDoseLevel->GetVisibleColorWash())
63  {
64  cCalc->RGBToHSV(itIsoDoseLevel->GetColor()[0], itIsoDoseLevel->GetColor()[1], itIsoDoseLevel->GetColor()[2], &hsv[0], &hsv[1], &hsv[2]);
65  transferFunction->AddHSVPoint(itIsoDoseLevel->GetDoseValue()*referenceDose, hsv[0], hsv[1], hsv[2], 1.0, 1.0);
66  }
67  }
68 
71  mitkTransFunc->SetColorTransferFunction(transferFunction);
72  mitkTransFuncProp->SetValue(mitkTransFunc);
73  node->SetProperty("Image Rendering.Transfer Function", mitkTransFuncProp);
74 
75 
77 
78  node->SetProperty("Image Rendering.Mode", renderingModeProp);
79  node->SetProperty("opacity", mitk::FloatProperty::New(0.5));
80  }
81 };
itk::SmartPointer< Self > Pointer
static const std::string REFERENCE_DOSE_PROPERTY_NAME
static const std::string DOSE_FREE_ISO_VALUES_PROPERTY_NAME
static const std::string DOSE_ISO_LEVELS_PROPERTY_NAME
void SetFloatProperty(const char *propertyKey, float floatValue, const mitk::BaseRenderer *renderer=nullptr)
Convenience method for setting float properties (instances of FloatProperty)
static Pointer New()
static Pointer New()
void SetBoolProperty(const char *propertyKey, bool boolValue, const mitk::BaseRenderer *renderer=nullptr)
Convenience method for setting boolean properties (instances of BoolProperty)
IsoDoseLevelSet::Pointer MITKDICOMRT_EXPORT GeneratIsoLevels_Virtuos()
static const std::string DOSE_SHOW_COLORWASH_PROPERTY_NAME
void SetProperty(const char *propertyKey, BaseProperty *property, const mitk::BaseRenderer *renderer=nullptr)
Set the property (instance of BaseProperty) with key propertyKey in the PropertyList of the renderer ...
static const std::string DOSE_SHOW_ISOLINES_PROPERTY_NAME
double DoseValueAbs
Represents absolute dose values (in Gy).
void MITKDICOMRT_EXPORT ConfigureNodeAsDoseNode(mitk::DataNode *node, mitk::DoseValueAbs referenceDose)
Class for nodes of the DataTree.
Definition: mitkDataNode.h:66
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.