Slicer 5.9
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
20
21// VTK includes
22class vtkImageAlgorithm;
23class vtkImageAppendComponents;
24class vtkImageHistogramStatistics;
25class vtkImageCast;
26class vtkImageLogic;
27class vtkImageMapToColors;
28class vtkImageMapToWindowLevelColors;
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
154 void SetDefaultColorMap() override;
155
158 void ProcessMRMLEvents(vtkObject* /*caller*/, unsigned long /*event*/, void* /*callData*/) override;
159
161 void SetInputImageDataConnection(vtkAlgorithmOutput* imageDataConnection) override;
162
164 vtkAlgorithmOutput* GetInputImageDataConnection() override;
165
167 vtkAlgorithmOutput* GetOutputImageDataConnection() override;
168
171 void SetBackgroundImageStencilDataConnection(vtkAlgorithmOutput* imageDataConnection) override;
172 vtkAlgorithmOutput* GetBackgroundImageStencilDataConnection() override;
173
176 static bool GetWindowLevelFromPresetString(const char* preset, double& window, double& level);
179 static std::string GetWindowLevelAsPresetString(double window, double level);
182 void AddWindowLevelPresetFromString(const char* preset);
185 void AddWindowLevelPreset(double window, double level);
186
190
194
198
201 double GetWindowPreset(int p);
202 double GetLevelPreset(int p);
203
209 virtual void GetDisplayScalarRange(double range[2]);
210
214 virtual vtkScalarsToColors* GetLookupTable();
215
216protected:
221
222 void SetColorNodeInternal(vtkMRMLColorNode* newColorNode) override;
225
228 vtkImageData* GetScalarImageData();
229 virtual vtkAlgorithmOutput* GetScalarImageDataConnection();
230
231 void SetInputToImageDataPipeline(vtkAlgorithmOutput* imageDataConnection) override;
232
238 {
239 public:
240 double Window;
241 double Level;
242 WindowLevelPreset(double window, double level)
243 : Window(window)
244 , Level(level)
245 {
246 }
247 };
248 // double Window;
249 // double Level;
250 // double UpperThreshold;
251 // double LowerThreshold;
252
255 void SetWindowLevelPresets(const std::vector<WindowLevelPreset>& windowLevelPresets);
256
263
264 vtkImageLogic* AlphaLogic;
265 vtkImageMapToColors* MapToColors;
266 vtkImageThreshold* Threshold;
267 vtkImageAppendComponents* AppendComponents;
268 vtkImageMapToWindowLevelColors* MapToWindowLevelColors;
269 vtkImageExtractComponents* ExtractRGB;
270 vtkImageExtractComponents* ExtractAlpha;
271 vtkImageStencil* MultiplyAlpha;
272
275 std::vector<WindowLevelPreset> WindowLevelPresets;
276
279 vtkImageHistogramStatistics* HistogramStatistics;
281};
282
283#endif
Abstract MRML node to represent color information.
std::vector< WindowLevelPreset > WindowLevelPresets
window level presets
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'.
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)
virtual vtkScalarsToColors * GetLookupTable()
void UpdateLookupTable(vtkMRMLColorNode *newColorNode)
void SetInputImageDataConnection(vtkAlgorithmOutput *imageDataConnection) override
Set the pipeline input.
void SetWindowLevelPresets(const std::vector< WindowLevelPreset > &windowLevelPresets)
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.
vtkImageMapToWindowLevelColors * MapToWindowLevelColors
vtkMRMLScalarVolumeDisplayNode(const vtkMRMLScalarVolumeDisplayNode &)
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.