Slicer 5.9
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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;
33
34// STD includes
35#include <vector>
36
41{
42 public:
45 void PrintSelf(ostream& os, vtkIndent indent) override;
46
48
51 void ReadXMLAttributes( const char** atts) override;
52
55 void WriteXML(ostream& of, int indent) override;
56
60
63 const char* GetNodeTagName() override {return "VolumeDisplay";}
64
65
66 //--------------------------------------------------------------------------
68 //--------------------------------------------------------------------------
69
72 {
73 vtkWarningMacro("vtkMRMLScalarVolumeDisplayNode::GetWindowLevelLocked method is deprecated. To check if the mouse mode cannot change window/level, get info from the interaction node. "
74 "e.g. slicer.app.applicationLogic().GetInteractionNode().GetCurrentInteractionMode() == slicer.vtkMRMLInteractionNode.AdjustWindowLevel");
75 return false;
76 };
77
78 virtual void SetWindowLevelLocked(bool)
79 {
80 vtkWarningMacro("vtkMRMLScalarVolumeDisplayNode::SetWindowLevelLocked method is deprecated. To prevent the mouse from changing window/level, set the interaction node to something other than AdjustWindowLevel. "
81 "e.g. slicer.app.applicationLogic().GetInteractionNode().SetCurrentInteractionMode(slicer.vtkMRMLInteractionNode.ViewTransform)");
82 };
83
86 vtkBooleanMacro(AutoWindowLevel, int);
87 vtkGetMacro(AutoWindowLevel, int);
88 vtkSetMacro(AutoWindowLevel, int);
89
92 double GetWindow();
93 virtual void SetWindow(double);
94
97 double GetLevel();
98 virtual void SetLevel(double);
99
102 virtual void SetWindowLevel(double window, double level);
105 void SetWindowLevelMinMax(double min, double max);
106
111
114 vtkBooleanMacro(ApplyThreshold, int);
115 vtkGetMacro(ApplyThreshold, int);
116 virtual void SetApplyThreshold(int);
117
120 vtkBooleanMacro(AutoThreshold, int);
121 vtkGetMacro(AutoThreshold, int);
122 vtkSetMacro(AutoThreshold, int);
123
127 virtual double GetLowerThreshold();
128 virtual void SetLowerThreshold(double lower);
129
133 virtual double GetUpperThreshold();
134 virtual void SetUpperThreshold(double upper);
135
136 virtual void SetThreshold(double lower, double upper);
137
140 vtkGetMacro(Interpolate, int);
141 vtkSetMacro(Interpolate, int);
142 vtkBooleanMacro(Interpolate, int);
143
144 void SetDefaultColorMap() override;
145
148 void ProcessMRMLEvents ( vtkObject * /*caller*/,
149 unsigned long /*event*/,
150 void * /*callData*/ ) override;
151
153 void SetInputImageDataConnection(vtkAlgorithmOutput *imageDataConnection) override;
154
156 vtkAlgorithmOutput* GetInputImageDataConnection() override;
157
159 vtkAlgorithmOutput* GetOutputImageDataConnection() override;
160
163 void SetBackgroundImageStencilDataConnection(vtkAlgorithmOutput *imageDataConnection) override;
164 vtkAlgorithmOutput* GetBackgroundImageStencilDataConnection() override;
165
168 void AddWindowLevelPresetFromString(const char *preset);
171 void AddWindowLevelPreset(double window, double level);
172
176
180
184
187 double GetWindowPreset(int p);
188 double GetLevelPreset(int p);
189
195 virtual void GetDisplayScalarRange(double range[2]);
196
197protected:
202
203 void SetColorNodeInternal(vtkMRMLColorNode* newColorNode) override;
206
209 vtkImageData* GetScalarImageData();
210 virtual vtkAlgorithmOutput* GetScalarImageDataConnection();
211
212 void SetInputToImageDataPipeline(vtkAlgorithmOutput *imageDataConnection) override;
213
219 {
220 public:
221 double Window;
222 double Level;
223 WindowLevelPreset() { this->Window = 0.0; this->Level = 0.0; };
224 };
225 //double Window;
226 //double Level;
227 //double UpperThreshold;
228 //double LowerThreshold;
229
230
236
237 vtkImageLogic *AlphaLogic;
238 vtkImageMapToColors *MapToColors;
239 vtkImageThreshold *Threshold;
240 vtkImageAppendComponents *AppendComponents;
241 vtkImageMapToWindowLevelColors *MapToWindowLevelColors;
242 vtkImageExtractComponents *ExtractRGB;
243 vtkImageExtractComponents *ExtractAlpha;
244 vtkImageStencil *MultiplyAlpha;
245
248 std::vector<WindowLevelPreset> WindowLevelPresets;
249
252 vtkImageHistogramStatistics *HistogramStatistics;
254};
255
256#endif
Abstract MRML node to represent color information.
std::vector< WindowLevelPreset > WindowLevelPresets
window level presets
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)
void UpdateLookupTable(vtkMRMLColorNode *newColorNode)
void SetInputImageDataConnection(vtkAlgorithmOutput *imageDataConnection) override
Set the pipeline input.
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
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.
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.