Slicer  5.0
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
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
22 class vtkImageAlgorithm;
23 class vtkImageAppendComponents;
24 class vtkImageHistogramStatistics;
25 class vtkImageCast;
26 class vtkImageLogic;
27 class vtkImageMapToColors;
28 class vtkImageMapToWindowLevelColors;
29 class vtkImageStencil;
30 class vtkImageThreshold;
31 class vtkImageExtractComponents;
32 class vtkImageMathematics;
33 
34 // STD includes
35 #include <vector>
36 
41 {
42  public:
43  static vtkMRMLScalarVolumeDisplayNode *New();
45  void PrintSelf(ostream& os, vtkIndent indent) override;
46 
47  vtkMRMLNode* CreateNodeInstance() override;
48 
51  void ReadXMLAttributes( const char** atts) override;
52 
55  void WriteXML(ostream& of, int indent) override;
56 
59  void Copy(vtkMRMLNode *node) override;
60 
63  const char* GetNodeTagName() override {return "VolumeDisplay";}
64 
65 
66  //--------------------------------------------------------------------------
68  //--------------------------------------------------------------------------
69 
72  vtkGetMacro(WindowLevelLocked, bool);
73  vtkSetMacro(WindowLevelLocked, bool);
74 
77  vtkBooleanMacro(AutoWindowLevel, int);
78  vtkGetMacro(AutoWindowLevel, int);
79  vtkSetMacro(AutoWindowLevel, int);
80 
83  double GetWindow();
84  virtual void SetWindow(double);
85 
88  double GetLevel();
89  virtual void SetLevel(double);
90 
93  virtual void SetWindowLevel(double window, double level);
96  void SetWindowLevelMinMax(double min, double max);
97 
99  double GetWindowLevelMin();
101  double GetWindowLevelMax();
102 
105  vtkBooleanMacro(ApplyThreshold, int);
106  vtkGetMacro(ApplyThreshold, int);
107  virtual void SetApplyThreshold(int);
108 
111  vtkBooleanMacro(AutoThreshold, int);
112  vtkGetMacro(AutoThreshold, int);
113  vtkSetMacro(AutoThreshold, int);
114 
118  virtual double GetLowerThreshold();
119  virtual void SetLowerThreshold(double lower);
120 
124  virtual double GetUpperThreshold();
125  virtual void SetUpperThreshold(double upper);
126 
127  virtual void SetThreshold(double lower, double upper);
128 
131  vtkGetMacro(Interpolate, int);
132  vtkSetMacro(Interpolate, int);
133  vtkBooleanMacro(Interpolate, int);
134 
135  void SetDefaultColorMap() override;
136 
139  void ProcessMRMLEvents ( vtkObject * /*caller*/,
140  unsigned long /*event*/,
141  void * /*callData*/ ) override;
142 
144  void SetInputImageDataConnection(vtkAlgorithmOutput *imageDataConnection) override;
145 
147  vtkAlgorithmOutput* GetInputImageDataConnection() override;
148 
150  vtkAlgorithmOutput* GetOutputImageDataConnection() override;
151 
154  void SetBackgroundImageStencilDataConnection(vtkAlgorithmOutput *imageDataConnection) override;
155  vtkAlgorithmOutput* GetBackgroundImageStencilDataConnection() override;
156 
159  void AddWindowLevelPresetFromString(const char *preset);
162  void AddWindowLevelPreset(double window, double level);
163 
166  void ResetWindowLevelPresets();
167 
170  void SetWindowLevelFromPreset(int p);
171 
174  int GetNumberOfWindowLevelPresets();
175 
178  double GetWindowPreset(int p);
179  double GetLevelPreset(int p);
180 
186  virtual void GetDisplayScalarRange(double range[2]);
187 
188 protected:
190  ~vtkMRMLScalarVolumeDisplayNode() override;
193 
194  void SetColorNodeInternal(vtkMRMLColorNode* newColorNode) override;
195  void UpdateLookupTable(vtkMRMLColorNode* newColorNode);
196  void CalculateAutoLevels();
197 
200  vtkImageData* GetScalarImageData();
201  virtual vtkAlgorithmOutput* GetScalarImageDataConnection();
202 
203  void SetInputToImageDataPipeline(vtkAlgorithmOutput *imageDataConnection) override;
204 
210  {
211  public:
212  double Window;
213  double Level;
214  WindowLevelPreset() { this->Window = 0.0; this->Level = 0.0; };
215  };
216  //double Window;
217  //double Level;
218  //double UpperThreshold;
219  //double LowerThreshold;
220 
221 
228 
229  vtkImageLogic *AlphaLogic;
230  vtkImageMapToColors *MapToColors;
231  vtkImageThreshold *Threshold;
232  vtkImageAppendComponents *AppendComponents;
233  vtkImageMapToWindowLevelColors *MapToWindowLevelColors;
234  vtkImageExtractComponents *ExtractRGB;
235  vtkImageExtractComponents *ExtractAlpha;
236  vtkImageStencil *MultiplyAlpha;
237 
240  std::vector<WindowLevelPreset> WindowLevelPresets;
241 
244  vtkImageHistogramStatistics *HistogramStatistics;
246 };
247 
248 #endif
virtual void SetInputImageDataConnection(vtkAlgorithmOutput *imageDataConnection)
MRML node for representing a volume display attributes.
void PrintSelf(ostream &os, vtkIndent indent) override
const char * GetNodeTagName() override
Get node XML tag name (like Volume, Model)
virtual void SetDefaultColorMap()
set gray colormap or override in subclass
virtual vtkMRMLNode * CreateNodeInstance()=0
Create instance of the default node. Like New only virtual.
virtual void SetColorNodeInternal(vtkMRMLColorNode *newColorNode)
virtual void Copy(vtkMRMLNode *node)
Copy node contents from another node of the same type. Does not copy node ID and Scene. Performs deep copy - an independent copy is created from all data, including bulk data.
vtkImageMapToWindowLevelColors * MapToWindowLevelColors
std::vector< WindowLevelPreset > WindowLevelPresets
window level presets
virtual void SetBackgroundImageStencilDataConnection(vtkAlgorithmOutput *imageDataConnection)
void WriteXML(ostream &of, int indent) override
Write this node&#39;s information to a MRML file in XML format.
Abstract MRML node to represent color information.
void ProcessMRMLEvents(vtkObject *, unsigned long, void *) override
alternative method to propagate events generated in Display nodes
virtual void SetInputToImageDataPipeline(vtkAlgorithmOutput *imageDataConnection)
void operator=(const vtkMRMLVolumeDisplayNode &)
virtual vtkAlgorithmOutput * GetOutputImageDataConnection()
Abstract Superclass for all specific types of MRML nodes.
Definition: vtkMRMLNode.h:167
virtual vtkAlgorithmOutput * GetBackgroundImageStencilDataConnection()
void ReadXMLAttributes(const char **atts) override
Read node attributes from XML file
MRML node for representing a volume display attributes.
vtkImageHistogramStatistics * HistogramStatistics
Used internally in CalculateScalarAutoLevels and CalculateStatisticsAutoLevels
virtual vtkAlgorithmOutput * GetInputImageDataConnection()