Slicer
4.8
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
|
#include <Modules/Loadable/VolumeRendering/Logic/vtkSlicerVolumeRenderingLogic.h>
Public Types | |
typedef vtkSlicerModuleLogic | Superclass |
Public Types inherited from vtkSlicerModuleLogic | |
typedef vtkMRMLAbstractLogic | Superclass |
Public Types inherited from vtkMRMLAbstractLogic | |
typedef vtkObject | Superclass |
typedef void(vtkMRMLAbstractLogic::* | TaskFunctionPointer) (void *clientdata) |
Public Member Functions | |
void | AddAllVolumeRenderingDisplayNodes () |
void | AddPreset (vtkMRMLVolumePropertyNode *preset, vtkImageData *icon=NULL) |
vtkMRMLVolumePropertyNode * | AddVolumePropertyFromFile (const char *filename) |
void | AddVolumeRenderingDisplayNode (vtkMRMLVolumeRenderingDisplayNode *node) |
void | CopyDisplayToVolumeRenderingDisplayNode (vtkMRMLVolumeRenderingDisplayNode *node, vtkMRMLVolumeDisplayNode *displayNode=0) |
void | CopyLabelMapDisplayToVolumeRenderingDisplayNode (vtkMRMLVolumeRenderingDisplayNode *volumeRenderingDisplayNode, vtkMRMLLabelMapVolumeDisplayNode *labelMapDisplayNode=0) |
void | CopyScalarDisplayToVolumeRenderingDisplayNode (vtkMRMLVolumeRenderingDisplayNode *volumeRenderingDisplayNode, vtkMRMLScalarVolumeDisplayNode *scalarDisplayNode=0) |
vtkMRMLVolumeRenderingScenarioNode * | CreateScenarioNode () |
vtkMRMLVolumeRenderingDisplayNode * | CreateVolumeRenderingDisplayNode (const char *renderingClassName=0) |
void | FitROIToVolume (vtkMRMLVolumeRenderingDisplayNode *vspNode) |
virtual const char * | GetClassName () |
virtual char * | GetDefaultRenderingMethod () |
vtkMRMLVolumeRenderingDisplayNode * | GetFirstVolumeRenderingDisplayNode (vtkMRMLVolumeNode *volumeNode) |
Find first volume rendering display node. More... | |
vtkMRMLVolumeRenderingDisplayNode * | GetFirstVolumeRenderingDisplayNodeByROINode (vtkMRMLAnnotationROINode *roiNode) |
Find the first volume rendering display node that uses the ROI. More... | |
vtkMRMLVolumePropertyNode * | GetPresetByName (const char *presetName) |
vtkMRMLScene * | GetPresetsScene () |
std::map< std::string, std::string > | GetRenderingMethods () |
virtual bool | GetUseLinearRamp () |
vtkMRMLVolumeRenderingDisplayNode * | GetVolumeRenderingDisplayNodeByID (vtkMRMLVolumeNode *volumeNode, char *displayNodeID) |
Find volume rendering display node reference in the volume. More... | |
vtkMRMLVolumeRenderingDisplayNode * | GetVolumeRenderingDisplayNodeForViewNode (vtkMRMLVolumeNode *volumeNode, vtkMRMLViewNode *viewNode) |
Find volume rendering display node referencing the view node and volume node. More... | |
vtkMRMLVolumeRenderingDisplayNode * | GetVolumeRenderingDisplayNodeForViewNode (vtkMRMLViewNode *viewNode) |
Find volume rendering display node referencing the view node in the scene. More... | |
virtual int | IsA (const char *type) |
bool | IsDifferentFunction (vtkPiecewiseFunction *function1, vtkPiecewiseFunction *function2) const |
bool | IsDifferentFunction (vtkColorTransferFunction *function1, vtkColorTransferFunction *function2) const |
void | PrintSelf (ostream &os, vtkIndent indent) VTK_OVERRIDE |
void | RegisterRenderingMethod (const char *methodName, const char *displayNodeClassName) |
void | RemoveAllVolumeRenderingDisplayNodes () |
void | RemovePreset (vtkMRMLVolumePropertyNode *preset) |
void | RemoveViewFromVolumeDisplayNodes (vtkMRMLVolumeNode *volumeNode, vtkMRMLViewNode *viewNode) |
Remove ViewNode from VolumeRenderingDisplayNode for a VolumeNode,. More... | |
void | RemoveVolumeRenderingDisplayNode (vtkMRMLVolumeRenderingDisplayNode *node) |
virtual void | SetDefaultRenderingMethod (const char *) |
void | SetGradientOpacityToVolumeProp (double scalarRange[2], vtkVolumeProperty *node) |
void | SetLabelMapToVolumeProp (vtkScalarsToColors *lut, vtkVolumeProperty *node) |
void | SetThresholdToVolumeProp (double scalarRange[2], double threshold[2], vtkVolumeProperty *node, bool linearRamp=false, bool stayUpAtUpperLimit=false) |
virtual void | SetUseLinearRamp (bool) |
void | SetWindowLevelToVolumeProp (double scalarRange[2], double windowLevel[2], vtkLookupTable *lut, vtkVolumeProperty *node) |
void | UpdateDisplayNodeFromVolumeNode (vtkMRMLVolumeRenderingDisplayNode *displayNode, vtkMRMLVolumeNode *volumeNode, vtkMRMLVolumePropertyNode *propNode=NULL, vtkMRMLAnnotationROINode *roiNode=NULL) |
void | UpdateTranferFunctionRangeFromImage (vtkMRMLVolumeRenderingDisplayNode *vspNode) |
Public Member Functions inherited from vtkSlicerModuleLogic | |
virtual vtkSlicerApplicationLogic * | GetApplicationLogic () |
Get access to overall application state. More... | |
std::string | GetModuleShareDirectory () const |
void | PrintSelf (ostream &os, vtkIndent indent) VTK_OVERRIDE |
void | SetModuleShareDirectory (const std::string &shareDirectory) |
Public Member Functions inherited from vtkMRMLAbstractLogic | |
virtual vtkMRMLApplicationLogic * | GetMRMLApplicationLogic () const |
Get access to overall application state. More... | |
vtkMRMLScene * | GetMRMLScene () const |
Return a reference to the current MRML scene. More... | |
void | PrintSelf (ostream &os, vtkIndent indent) VTK_OVERRIDE |
virtual void | SetMRMLApplicationLogic (vtkMRMLApplicationLogic *logic) |
void | SetMRMLScene (vtkMRMLScene *newScene) |
Set and observe the MRMLScene. More... | |
Static Public Member Functions | |
static const char * | GetIconVolumeReferenceRole () |
static int | IsTypeOf (const char *type) |
static vtkSlicerVolumeRenderingLogic * | New () |
static vtkSlicerVolumeRenderingLogic * | SafeDownCast (vtkObject *o) |
Static Public Member Functions inherited from vtkSlicerModuleLogic | |
static int | IsTypeOf (const char *type) |
static vtkSlicerModuleLogic * | New () |
The Usual vtk class functions. More... | |
static vtkSlicerModuleLogic * | SafeDownCast (vtkObject *o) |
Static Public Member Functions inherited from vtkMRMLAbstractLogic | |
static int | IsTypeOf (const char *type) |
static vtkMRMLAbstractLogic * | New () |
static vtkMRMLAbstractLogic * | SafeDownCast (vtkObject *o) |
Protected Types | |
typedef std::vector< vtkMRMLNode * > | DisplayNodesType |
Protected Attributes | |
char * | DefaultRenderingMethod |
DisplayNodesType | DisplayNodes |
vtkMRMLScene * | PresetsScene |
std::map< std::string, std::string > | RenderingMethods |
bool | UseLinearRamp |
Additional Inherited Members | |
Static Protected Member Functions inherited from vtkMRMLAbstractLogic | |
static void | MRMLLogicsCallback (vtkObject *caller, unsigned long eid, void *clientData, void *callData) |
MRMLLogicCallback is a static function to relay modified events from the logics. More... | |
static void | MRMLNodesCallback (vtkObject *caller, unsigned long eid, void *clientData, void *callData) |
MRMLNodesCallback is a static function to relay modified events from the nodes. More... | |
static void | MRMLSceneCallback (vtkObject *caller, unsigned long eid, void *clientData, void *callData) |
Collection of utility methods to control the Volume Rendering nodes. The fastest to volume render of vtkMRMLVolumeNode is to use CreateVolumeRenderingDisplayNode() and UpdateDisplayNodeFromVolumeNode():
Definition at line 60 of file vtkSlicerVolumeRenderingLogic.h.
|
protected |
Definition at line 334 of file vtkSlicerVolumeRenderingLogic.h.
Definition at line 66 of file vtkSlicerVolumeRenderingLogic.h.
|
protected |
|
protectedvirtual |
void vtkSlicerVolumeRenderingLogic::AddAllVolumeRenderingDisplayNodes | ( | ) |
Observe all the volume rendering display nodes of the scene.
void vtkSlicerVolumeRenderingLogic::AddPreset | ( | vtkMRMLVolumePropertyNode * | preset, |
vtkImageData * | icon = NULL |
||
) |
Add a preset to the preset scene. If the optional icon image is specified then that will be used to in preset selector widgets. The icon is stored as a volume node in the preset scene.
vtkMRMLVolumePropertyNode* vtkSlicerVolumeRenderingLogic::AddVolumePropertyFromFile | ( | const char * | filename | ) |
Load from file and add into the scene a transfer function.
void vtkSlicerVolumeRenderingLogic::AddVolumeRenderingDisplayNode | ( | vtkMRMLVolumeRenderingDisplayNode * | node | ) |
Observe the volume rendering display node to copy the volume display node if needed. This function is called automatically when a display node is added into the scene. You shouldn't have to call it.
void vtkSlicerVolumeRenderingLogic::CopyDisplayToVolumeRenderingDisplayNode | ( | vtkMRMLVolumeRenderingDisplayNode * | node, |
vtkMRMLVolumeDisplayNode * | displayNode = 0 |
||
) |
Applies the properties (window level, threshold and color function) of a volume display node to the volume rendering displaynode. If displayNode is 0, it uses the first display node. It's a utility method that internally calls CopyScalarDisplayToVolumeRenderingDisplayNode() or CopyLabelMapDisplayToVolumeRenderingDisplayNode() based on the type of displayNode.
void vtkSlicerVolumeRenderingLogic::CopyLabelMapDisplayToVolumeRenderingDisplayNode | ( | vtkMRMLVolumeRenderingDisplayNode * | volumeRenderingDisplayNode, |
vtkMRMLLabelMapVolumeDisplayNode * | labelMapDisplayNode = 0 |
||
) |
Applies the properties (threshold ) of the labelmap display node to the volume rendering displaynode. If labelMapDisplayNode is 0, it uses the first displaynode.
void vtkSlicerVolumeRenderingLogic::CopyScalarDisplayToVolumeRenderingDisplayNode | ( | vtkMRMLVolumeRenderingDisplayNode * | volumeRenderingDisplayNode, |
vtkMRMLScalarVolumeDisplayNode * | scalarDisplayNode = 0 |
||
) |
Applies the properties (window level, threshold and color function) of the scalar display node to the volume rendering displaynode. If scalarDisplayNode is 0, it uses the first display node.
vtkMRMLVolumeRenderingScenarioNode* vtkSlicerVolumeRenderingLogic::CreateScenarioNode | ( | ) |
vtkMRMLVolumeRenderingDisplayNode* vtkSlicerVolumeRenderingLogic::CreateVolumeRenderingDisplayNode | ( | const char * | renderingClassName = 0 | ) |
Create a volume rendering display node. The node to instantiate will be of type renderingType if not null, DefaultRenderingMethod if not null or vtkMRMLCPURayCastVolumeRenderingDisplayNode in that order. Return the created node or 0 if there is no scene or the class name doesn't exist. If renderingClassName is 0, the returned node has a name generated using "VolumeRendering" as base name. You are responsible for deleting the node (read more about it in the section Get, New, Create, CreateAndAdd).
void vtkSlicerVolumeRenderingLogic::FitROIToVolume | ( | vtkMRMLVolumeRenderingDisplayNode * | vspNode | ) |
Utility function that modifies the ROI node of the display node to fit the boundaries of the volume node
|
virtual |
Reimplemented from vtkSlicerModuleLogic.
|
virtual |
vtkMRMLVolumeRenderingDisplayNode* vtkSlicerVolumeRenderingLogic::GetFirstVolumeRenderingDisplayNode | ( | vtkMRMLVolumeNode * | volumeNode | ) |
Find first volume rendering display node.
vtkMRMLVolumeRenderingDisplayNode* vtkSlicerVolumeRenderingLogic::GetFirstVolumeRenderingDisplayNodeByROINode | ( | vtkMRMLAnnotationROINode * | roiNode | ) |
Find the first volume rendering display node that uses the ROI.
|
inlinestatic |
This node reference role name allows linking from a preset node to a volume node that contains an icon for the preset node. For example, the icon is used for representing the node in qSlicerPresetComboBox.
Definition at line 288 of file vtkSlicerVolumeRenderingLogic.h.
vtkMRMLVolumePropertyNode* vtkSlicerVolumeRenderingLogic::GetPresetByName | ( | const char * | presetName | ) |
Return the preset presetName contained in the presets scene loaded using GetPresetsScene(). If no presets are found, return 0. If multiple presets are found, the first one is returned.
vtkMRMLScene* vtkSlicerVolumeRenderingLogic::GetPresetsScene | ( | ) |
Return the scene containing the volume rendering presets. If there is no presets scene, a scene is created and presets are loaded into. The presets scene is loaded from a file (presets.xml) located in the module share directory
std::map<std::string, std::string> vtkSlicerVolumeRenderingLogic::GetRenderingMethods | ( | ) |
|
virtual |
vtkMRMLVolumeRenderingDisplayNode* vtkSlicerVolumeRenderingLogic::GetVolumeRenderingDisplayNodeByID | ( | vtkMRMLVolumeNode * | volumeNode, |
char * | displayNodeID | ||
) |
Find volume rendering display node reference in the volume.
vtkMRMLVolumeRenderingDisplayNode* vtkSlicerVolumeRenderingLogic::GetVolumeRenderingDisplayNodeForViewNode | ( | vtkMRMLVolumeNode * | volumeNode, |
vtkMRMLViewNode * | viewNode | ||
) |
Find volume rendering display node referencing the view node and volume node.
vtkMRMLVolumeRenderingDisplayNode* vtkSlicerVolumeRenderingLogic::GetVolumeRenderingDisplayNodeForViewNode | ( | vtkMRMLViewNode * | viewNode | ) |
Find volume rendering display node referencing the view node in the scene.
|
virtual |
Reimplemented from vtkSlicerModuleLogic.
bool vtkSlicerVolumeRenderingLogic::IsDifferentFunction | ( | vtkPiecewiseFunction * | function1, |
vtkPiecewiseFunction * | function2 | ||
) | const |
Utility function that checks if the piecewise functions are equal Returns true if different
bool vtkSlicerVolumeRenderingLogic::IsDifferentFunction | ( | vtkColorTransferFunction * | function1, |
vtkColorTransferFunction * | function2 | ||
) | const |
Utility function that checks if the color transfer functions are equal Returns true if different
|
static |
|
protected |
|
static |
|
protectedvirtual |
Reimplemented to initialize display nodes in the scene.
Reimplemented from vtkMRMLAbstractLogic.
|
protectedvirtual |
Called after the corresponding MRML event is triggered.
Reimplemented from vtkMRMLAbstractLogic.
|
protectedvirtual |
If vtkMRMLScene::NodeAddedEvent has been set to be observed in SetMRMLSceneInternal, it is called when the scene fires the event
Reimplemented from vtkMRMLAbstractLogic.
|
protectedvirtual |
If vtkMRMLScene::NodeRemovedEvent has been set to be observed in SetMRMLSceneInternal, it is called when the scene fires the event
Reimplemented from vtkMRMLAbstractLogic.
void vtkSlicerVolumeRenderingLogic::PrintSelf | ( | ostream & | os, |
vtkIndent | indent | ||
) |
|
protectedvirtual |
Register node classes into the MRML scene. Called each time a new scene is set. Do nothing by default. Can be reimplemented in derivated classes.
Reimplemented from vtkMRMLAbstractLogic.
void vtkSlicerVolumeRenderingLogic::RegisterRenderingMethod | ( | const char * | methodName, |
const char * | displayNodeClassName | ||
) |
Inform the logic and observers that a rendering method (class deriving from vtkMRMLVolumeRenderingDisplayNode) is available. The event ModifiedEvent gets fired.
void vtkSlicerVolumeRenderingLogic::RemoveAllVolumeRenderingDisplayNodes | ( | ) |
Unobserve all the volume rendering display nodes of the scene.
void vtkSlicerVolumeRenderingLogic::RemovePreset | ( | vtkMRMLVolumePropertyNode * | preset | ) |
Removes a preset and its associated icon (if specified) from the preset scene.
void vtkSlicerVolumeRenderingLogic::RemoveViewFromVolumeDisplayNodes | ( | vtkMRMLVolumeNode * | volumeNode, |
vtkMRMLViewNode * | viewNode | ||
) |
Remove ViewNode from VolumeRenderingDisplayNode for a VolumeNode,.
void vtkSlicerVolumeRenderingLogic::RemoveVolumeRenderingDisplayNode | ( | vtkMRMLVolumeRenderingDisplayNode * | node | ) |
Unobserve the volume rendering display node.
|
static |
|
virtual |
The default rendering method is set to display nodes created in CreateVolumeRenderingDisplayNode(). If no rendering method is given the VTKCPURayCast is instantiated.
void vtkSlicerVolumeRenderingLogic::SetGradientOpacityToVolumeProp | ( | double | scalarRange[2], |
vtkVolumeProperty * | node | ||
) |
Create an opacity transfer function for gradient opacity. It ranges from 0 to scalarRange[1] - scalarRange[0].
void vtkSlicerVolumeRenderingLogic::SetLabelMapToVolumeProp | ( | vtkScalarsToColors * | lut, |
vtkVolumeProperty * | node | ||
) |
Generate and set to the volume property node an opacity and color transfer function from the labelmap LUT colors.
|
protectedvirtual |
Called each time a new scene is set. Can be reimplemented in derivated classes. Doesn't observe the scene by default, that means that UpdateFromMRMLScene() won't be called by default when a scene is imported, closed or restored, only when a new scene is set.
Reimplemented from vtkMRMLAbstractLogic.
void vtkSlicerVolumeRenderingLogic::SetThresholdToVolumeProp | ( | double | scalarRange[2], |
double | threshold[2], | ||
vtkVolumeProperty * | node, | ||
bool | linearRamp = false , |
||
bool | stayUpAtUpperLimit = false |
||
) |
Applies a threshold to a volume property
/// true: false: _ /// __/|__ __| |__ ///
/// true: ______ false: /// __/ __/|_____ ///
|
virtual |
Use a linear ramp (true) or a sharp ramp (false) when copying the volume display node threshold values into the volume rendering display node. True by default.
void vtkSlicerVolumeRenderingLogic::SetWindowLevelToVolumeProp | ( | double | scalarRange[2], |
double | windowLevel[2], | ||
vtkLookupTable * | lut, | ||
vtkVolumeProperty * | node | ||
) |
Create a color transfer function that ranges from scalarRange[0] to scalarRange[1] and containing a windowLevel[0] wide ramp centered on level:
/// max = level + window/2 scalarRange[1] /// .___________________________. /// .____________________./ /// scalarRange[0] min = level - window/2 ///
The generated transfer function contains at least 4 points located in:
If lut is 0, the colors go from black (0, 0, 0) to white (1, 1, 1) If lut contains only 1 value, that color is used for all the generated points. If lut contains more than 1 value, each color is used in the ramp. The generated transfer function will be made of lut->size() + 2 points. The function is then applied to the volume property node.
void vtkSlicerVolumeRenderingLogic::UpdateDisplayNodeFromVolumeNode | ( | vtkMRMLVolumeRenderingDisplayNode * | displayNode, |
vtkMRMLVolumeNode * | volumeNode, | ||
vtkMRMLVolumePropertyNode * | propNode = NULL , |
||
vtkMRMLAnnotationROINode * | roiNode = NULL |
||
) |
Update DisplayNode from VolumeNode, Can pass a VolumePropertyNode and a AnnotationROINode to be the display node. If they are NULL and the display node does not already have any, new ones will be created then set and observed to the display node.
void vtkSlicerVolumeRenderingLogic::UpdateTranferFunctionRangeFromImage | ( | vtkMRMLVolumeRenderingDisplayNode * | vspNode | ) |
|
protected |
|
protected |
This property holds the default rendering method to instantiate in CreateVolumeRenderingDisplayNode(). If no rendering method is given, the VTKCPURayCast technique is instantiated.
Definition at line 331 of file vtkSlicerVolumeRenderingLogic.h.
|
protected |
Definition at line 335 of file vtkSlicerVolumeRenderingLogic.h.
|
protected |
Definition at line 338 of file vtkSlicerVolumeRenderingLogic.h.
|
protected |
Definition at line 324 of file vtkSlicerVolumeRenderingLogic.h.
|
protected |
Definition at line 332 of file vtkSlicerVolumeRenderingLogic.h.