17 #include <vtkObjectFactory.h> 18 #include <vtkRenderingOpenGL2ObjectFactory.h> 19 #include <vtkRenderingVolumeOpenGL2ObjectFactory.h> 20 #include <vtkColorTransferFunction.h> 21 #include <vtkPiecewiseFunction.h> 81 if (image.IsNotNull() && image->IsInitialized())
83 if ((overwrite) || (node->
GetProperty(
"TransferFunction", renderer) ==
nullptr))
88 tfInit->SetTransferFunctionMode(0);
93 Superclass::SetDefaultProperties(node, renderer, overwrite);
129 vtkSmartPointer<vtkPiecewiseFunction> opacityTransferFunction;
130 vtkSmartPointer<vtkPiecewiseFunction> gradientTransferFunction;
131 vtkSmartPointer<vtkColorTransferFunction> colorTransferFunction;
133 bool isBinary =
false;
139 colorTransferFunction = vtkSmartPointer<vtkColorTransferFunction>::New();
143 rgb[0] = rgb[1] = rgb[2] = 1;
144 colorTransferFunction->AddRGBPoint(0, rgb[0], rgb[1], rgb[2]);
145 colorTransferFunction->Modified();
147 opacityTransferFunction = vtkSmartPointer<vtkPiecewiseFunction>::New();
148 gradientTransferFunction = vtkSmartPointer<vtkPiecewiseFunction>::New();
152 auto *transferFunctionProp =
155 if (transferFunctionProp)
157 opacityTransferFunction = transferFunctionProp->
GetValue()->GetScalarOpacityFunction();
158 gradientTransferFunction = transferFunctionProp->GetValue()->GetGradientOpacityFunction();
159 colorTransferFunction = transferFunctionProp->GetValue()->GetColorTransferFunction();
163 opacityTransferFunction = vtkSmartPointer<vtkPiecewiseFunction>::New();
164 gradientTransferFunction = vtkSmartPointer<vtkPiecewiseFunction>::New();
165 colorTransferFunction = vtkSmartPointer<vtkColorTransferFunction>::New();
192 if (this->
GetDataNode()->GetIntProperty(
"volumerendering.blendmode", blendMode))
203 if (this->
GetDataNode()->GetFloatProperty(
"volumerendering.gpu.diffuse", value, renderer))
205 if (this->
GetDataNode()->GetFloatProperty(
"volumerendering.gpu.specular", value, renderer))
207 if (this->
GetDataNode()->GetFloatProperty(
"volumerendering.gpu.specular.power", value, renderer))
213 if (this->
GetDataNode()->GetFloatProperty(
"volumerendering.cpu.ambient", value, renderer))
215 if (this->
GetDataNode()->GetFloatProperty(
"volumerendering.cpu.diffuse", value, renderer))
217 if (this->
GetDataNode()->GetFloatProperty(
"volumerendering.cpu.specular", value, renderer))
219 if (this->
GetDataNode()->GetFloatProperty(
"volumerendering.cpu.specular.power", value, renderer))
236 m_Volume = vtkSmartPointer<vtkVolume>::New();
mitk::BaseProperty * GetProperty(const char *propertyKey, const mitk::BaseRenderer *renderer=nullptr, bool fallBackOnDataProperties=true) const
Get the property (instance of BaseProperty) with key propertyKey from the PropertyList of the rendere...
The TransferFunctionProperty class Property class for the mitk::TransferFunction. ...
void createMapper(vtkImageData *)
virtual DataNode * GetDataNode() const
Get the DataNode containing the data to map. Method only returns valid DataNode Pointer if the mapper...
vtkSmartPointer< vtkSmartVolumeMapper > m_SmartVolumeMapper
bool GetFloatProperty(const char *propertyKey, float &floatValue, const mitk::BaseRenderer *renderer=nullptr) const
Convenience access method for float properties (instances of FloatProperty)
Organizes the rendering process.
vtkSmartPointer< vtkVolume > m_Volume
virtual vtkImageData * GetVtkImageData(int t=0, int n=0)
Get a volume at a specific time t of channel n as a vtkImageData.
vtkSmartPointer< vtkRenderingVolumeOpenGL2ObjectFactory > m_RenderingVolumeOpenGL2ObjectFactory
vtkProp * GetVtkProp(mitk::BaseRenderer *renderer) override
virtual mitk::TransferFunction::Pointer GetValue() const
bool GetBoolProperty(const char *propertyKey, bool &boolValue, const mitk::BaseRenderer *renderer=nullptr) const
Convenience access method for bool properties (instances of BoolProperty)
void ApplyProperties(vtkActor *actor, mitk::BaseRenderer *renderer) override
Apply color and opacity properties read from the PropertyList.
void FillVector3D(Tout &out, mitk::ScalarType x, mitk::ScalarType y, mitk::ScalarType z)
void SetProperty(const std::string &propertyKey, BaseProperty *property, const std::string &contextName="", bool fallBackOnDefaultContext=false) override
Add new or change existent property.
BaseData * GetData() const
Get the data object (instance of BaseData, e.g., an Image) managed by this DataNode.
void AddProperty(const char *propertyKey, BaseProperty *property, const mitk::BaseRenderer *renderer=nullptr, bool overwrite=false)
Add the property (instance of BaseProperty) if it does not exist (or always ifoverwrite istrue) with ...
static void SetDefaultProperties(mitk::DataNode *node, mitk::BaseRenderer *renderer=nullptr, bool overwrite=false)
vtkSmartPointer< vtkImageChangeInformation > m_ImageChangeInformation
vtkImageData * GetInputImage()
vtkSmartPointer< vtkVolumeProperty > m_VolumeProperty
~VolumeMapperVtkSmart3D() override
virtual bool GetColor(float rgb[3], BaseRenderer *renderer, const char *name="color") const
Convenience access method for color properties (instances of ColorProperty)
Image class for storing images.
void UpdateTransferFunctions(mitk::BaseRenderer *renderer)
vtkSmartPointer< vtkRenderingOpenGL2ObjectFactory > m_RenderingOpenGL2ObjectFactory
mitk::Image::Pointer image
void createVolumeProperty()
void GenerateDataForRenderer(mitk::BaseRenderer *renderer) override
Generate the data needed for rendering into renderer.
void UpdateRenderMode(mitk::BaseRenderer *renderer)
int GetTimestep() const
Returns the current time step as calculated from the renderer.
Class for nodes of the DataTree.