Slicer 5.11
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
Loading...
Searching...
No Matches
vtkMRMLScalarVolumeDisplayNode.h
Go to the documentation of this file.
1/*=auto=========================================================================
2
3 Portions (c) Copyright 2005 Brigham and Women's Hospital (BWH) All Rights Reserved.
4
5 See COPYRIGHT.txt
6 or http://www.slicer.org/copyright/copyright.txt for details.
7
8 Program: 3D Slicer
9 Module: $RCSfile: vtkMRMLScalarVolumeDisplayNode.h,v $
10 Date: $Date: 2006/03/19 17:12:29 $
11 Version: $Revision: 1.3 $
12
13=========================================================================auto=*/
14
15#ifndef __vtkMRMLScalarVolumeDisplayNode_h
16#define __vtkMRMLScalarVolumeDisplayNode_h
17
18// MRML includes
21
22// VTK includes
23class vtkImageAlgorithm;
24class vtkImageAppendComponents;
25class vtkImageHistogramStatistics;
26class vtkImageCast;
27class vtkImageLogic;
28class vtkImageMapToColors;
29class vtkImageStencil;
30class vtkImageThreshold;
31class vtkImageExtractComponents;
32class vtkImageMathematics;
33class vtkScalarsToColors;
34
35// STD includes
36#include <vector>
37
42{
43public:
46 void PrintSelf(ostream& os, vtkIndent indent) override;
47
49
52 void ReadXMLAttributes(const char** atts) override;
53
56 void WriteXML(ostream& of, int indent) override;
57
61
64 const char* GetNodeTagName() override { return "VolumeDisplay"; }
65
66 //--------------------------------------------------------------------------
68 //--------------------------------------------------------------------------
69
72 {
73 vtkWarningMacro(
74 "vtkMRMLScalarVolumeDisplayNode::GetWindowLevelLocked method is deprecated. To check if the mouse mode cannot change window/level, get info from the interaction node. "
75 "e.g. slicer.app.applicationLogic().GetInteractionNode().GetCurrentInteractionMode() == slicer.vtkMRMLInteractionNode.AdjustWindowLevel");
76 return false;
77 };
78
80 virtual void SetWindowLevelLocked(bool)
81 {
82 vtkWarningMacro("vtkMRMLScalarVolumeDisplayNode::SetWindowLevelLocked method is deprecated. To prevent the mouse from changing window/level, set the interaction node to "
83 "something other than AdjustWindowLevel. "
84 "e.g. slicer.app.applicationLogic().GetInteractionNode().SetCurrentInteractionMode(slicer.vtkMRMLInteractionNode.ViewTransform)");
85 };
86
89 vtkBooleanMacro(AutoWindowLevel, int);
90 vtkGetMacro(AutoWindowLevel, int);
91 vtkSetMacro(AutoWindowLevel, int);
92
95 double GetWindow();
96 virtual void SetWindow(double);
97
100 double GetLevel();
101 virtual void SetLevel(double);
102
105 virtual void SetWindowLevel(double window, double level);
108 void SetWindowLevelMinMax(double min, double max);
109
114
117 vtkBooleanMacro(ApplyThreshold, int);
118 vtkGetMacro(ApplyThreshold, int);
119 virtual void SetApplyThreshold(int);
120
123 vtkBooleanMacro(AutoThreshold, int);
124 vtkGetMacro(AutoThreshold, int);
125 vtkSetMacro(AutoThreshold, int);
126
130 virtual double GetLowerThreshold();
131 virtual void SetLowerThreshold(double lower);
132
136 virtual double GetUpperThreshold();
137 virtual void SetUpperThreshold(double upper);
138
139 virtual void SetThreshold(double lower, double upper);
140
143 vtkGetMacro(Interpolate, int);
144 vtkSetMacro(Interpolate, int);
145 vtkBooleanMacro(Interpolate, int);
146
150 vtkGetMacro(InvertDisplayScalarRange, int);
151 virtual void SetInvertDisplayScalarRange(int invert);
152 vtkBooleanMacro(InvertDisplayScalarRange, int);
153
157 vtkGetMacro(WindowMappingMethod, int);
158 virtual void SetWindowMappingMethod(int method);
159
162 static int GetWindowMappingMethodFromString(const char* name);
163 static const char* GetWindowMappingMethodAsString(int type);
165
166 void SetDefaultColorMap() override;
167
170 void ProcessMRMLEvents(vtkObject* /*caller*/, unsigned long /*event*/, void* /*callData*/) override;
171
173 void SetInputImageDataConnection(vtkAlgorithmOutput* imageDataConnection) override;
174
176 vtkAlgorithmOutput* GetInputImageDataConnection() override;
177
179 vtkAlgorithmOutput* GetOutputImageDataConnection() override;
180
183 void SetBackgroundImageStencilDataConnection(vtkAlgorithmOutput* imageDataConnection) override;
184 vtkAlgorithmOutput* GetBackgroundImageStencilDataConnection() override;
185
188 static bool GetWindowLevelFromPresetString(const char* preset, double& window, double& level);
191 static std::string GetWindowLevelAsPresetString(double window, double level);
194 void AddWindowLevelPresetFromString(const char* preset);
197 void AddWindowLevelPreset(double window, double level);
198
202
206
210
213 double GetWindowPreset(int p);
214 double GetLevelPreset(int p);
215
221 virtual void GetDisplayScalarRange(double range[2]);
222
226 virtual vtkScalarsToColors* GetLookupTable();
227
228protected:
233
234 void SetColorNodeInternal(vtkMRMLColorNode* newColorNode) override;
237
240 vtkImageData* GetScalarImageData();
241 virtual vtkAlgorithmOutput* GetScalarImageDataConnection();
242
243 void SetInputToImageDataPipeline(vtkAlgorithmOutput* imageDataConnection) override;
244
250 {
251 public:
252 double Window;
253 double Level;
254 WindowLevelPreset(double window, double level)
255 : Window(window)
256 , Level(level)
257 {
258 }
259 };
260 // double Window;
261 // double Level;
262 // double UpperThreshold;
263 // double LowerThreshold;
264
267 void SetWindowLevelPresets(const std::vector<WindowLevelPreset>& windowLevelPresets);
268
276
277 vtkImageLogic* AlphaLogic;
278 vtkImageMapToColors* MapToColors;
279 vtkImageThreshold* Threshold;
280 vtkImageAppendComponents* AppendComponents;
282 vtkImageExtractComponents* ExtractRGB;
283 vtkImageExtractComponents* ExtractAlpha;
284 vtkImageStencil* MultiplyAlpha;
285
288 std::vector<WindowLevelPreset> WindowLevelPresets;
289
292 vtkImageHistogramStatistics* HistogramStatistics;
294};
295
296#endif
Subclass of vtkImageMapToWindowLevelColors that adds the option to compress values within the window ...
WindowMappingMode
Window Scalar Mapping Modes.
Abstract MRML node to represent color information.
std::vector< WindowLevelPreset > WindowLevelPresets
window level presets
static vtkImageMapToWindowLevelAddon::WindowMappingMode GetWindowMappingMethodFromIndex(int idx)
virtual void SetInvertDisplayScalarRange(int invert)
void SetDefaultColorMap() override
set gray colormap or override in subclass
void SetInputToImageDataPipeline(vtkAlgorithmOutput *imageDataConnection) override
virtual vtkAlgorithmOutput * GetScalarImageDataConnection()
double GetLevel()
The level value to use when autoWindowLevel is 'no'.
virtual void SetWindowMappingMethod(int method)
void PrintSelf(ostream &os, vtkIndent indent) override
vtkImageHistogramStatistics * HistogramStatistics
Used internally in CalculateScalarAutoLevels and CalculateStatisticsAutoLevels.
~vtkMRMLScalarVolumeDisplayNode() override
virtual void SetLevel(double)
virtual void SetUpperThreshold(double upper)
static const char * GetWindowMappingMethodAsString(int type)
virtual vtkScalarsToColors * GetLookupTable()
void UpdateLookupTable(vtkMRMLColorNode *newColorNode)
void SetInputImageDataConnection(vtkAlgorithmOutput *imageDataConnection) override
Set the pipeline input.
void SetWindowLevelPresets(const std::vector< WindowLevelPreset > &windowLevelPresets)
static int GetWindowMappingMethodFromString(const char *name)
virtual void SetApplyThreshold(int)
virtual void SetWindowLevel(double window, double level)
vtkAlgorithmOutput * GetOutputImageDataConnection() override
Gets the pipeline output.
void SetWindowLevelFromPreset(int p)
Set Window and Level from preset p.
vtkAlgorithmOutput * GetBackgroundImageStencilDataConnection() override
virtual void SetLowerThreshold(double lower)
double GetWindowPreset(int p)
Return a specific preset, returns 0 if p out of range.
vtkImageData * GetScalarImageData()
const char * GetNodeTagName() override
Get node XML tag name (like Volume, Model)
void SetColorNodeInternal(vtkMRMLColorNode *newColorNode) override
double GetWindowLevelMax()
Utility function that returns the maximum value of the window level.
void SetBackgroundImageStencilDataConnection(vtkAlgorithmOutput *imageDataConnection) override
Get/set background mask stencil.
static vtkMRMLScalarVolumeDisplayNode * New()
void ResetWindowLevelPresets()
Remove all presets.
virtual double GetUpperThreshold()
double GetWindow()
The window value to use when autoWindowLevel is 'no'.
void ProcessMRMLEvents(vtkObject *, unsigned long, void *) override
alternative method to propagate events generated in Display nodes
static bool GetWindowLevelFromPresetString(const char *preset, double &window, double &level)
Parse a window level preset string (window and level values separated by "|") to numeric values.
vtkMRMLCopyContentMacro(vtkMRMLScalarVolumeDisplayNode)
void ReadXMLAttributes(const char **atts) override
Read node attributes from XML file.
vtkMRMLScalarVolumeDisplayNode(const vtkMRMLScalarVolumeDisplayNode &)
vtkImageMapToWindowLevelAddon * MapToWindowLevelColors
void AddWindowLevelPreset(double window, double level)
Add a window level preset.
virtual void GetDisplayScalarRange(double range[2])
void operator=(const vtkMRMLScalarVolumeDisplayNode &)
vtkAlgorithmOutput * GetInputImageDataConnection() override
Gets the pipeline input.
void WriteXML(ostream &of, int indent) override
Write this node's information to a MRML file in XML format.
virtual void SetWindow(double)
void AddWindowLevelPresetFromString(const char *preset)
Parse a string with window and level as double|double, and add a preset.
static std::string GetWindowLevelAsPresetString(double window, double level)
Convert window and level values to preset string (window and level values separated by "|")
vtkMRMLNode * CreateNodeInstance() override
Create instance of the default node. Like New only virtual.
int GetNumberOfWindowLevelPresets()
Get the number of window/level presets.
bool GetWindowLevelLocked()
Display Information.
virtual void SetThreshold(double lower, double upper)
void SetWindowLevelMinMax(double min, double max)
virtual double GetLowerThreshold()
double GetWindowLevelMin()
Utility function that returns the minimum value of the window level.