Slicer  4.11
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
vtkMRMLVolumeNode.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: vtkMRMLVolumeNode.h,v $
10  Date: $Date: 2006/03/19 17:12:29 $
11  Version: $Revision: 1.13 $
12 
13 =========================================================================auto=*/
14 
15 #ifndef __vtkMRMLVolumeNode_h
16 #define __vtkMRMLVolumeNode_h
17 
18 // MRML includes
19 #include "vtkMRMLDisplayableNode.h"
21 
22 // VTK includes
23 class vtkAlgorithmOutput;
24 class vtkEventForwarderCommand;
25 class vtkImageData;
26 class vtkMatrix4x4;
27 
28 // ITK includes
29 #include "itkMetaDataDictionary.h"
30 
40 class VTK_MRML_EXPORT vtkMRMLVolumeNode : public vtkMRMLDisplayableNode
41 {
42 public:
44  void PrintSelf(ostream& os, vtkIndent indent) override;
45 
46  vtkMRMLNode* CreateNodeInstance() override = 0;
47 
50  void ReadXMLAttributes( const char** atts) override;
51 
54  void WriteXML(ostream& of, int indent) override;
55 
58  void Copy(vtkMRMLNode *node) override;
59 
62  void CopyOrientation(vtkMRMLVolumeNode *node);
63 
64 
67  const char* GetNodeTagName() override = 0;
68 
71  void UpdateScene(vtkMRMLScene *scene) override;
72 
73  //--------------------------------------------------------------------------
75  //--------------------------------------------------------------------------
76 
83  static bool ComputeIJKToRASFromScanOrder(const char *order,
84  const double* spacing,
85  const int *dims,
86  bool centerImage,
87  vtkMatrix4x4 *IJKToRAS);
88 
89  static const char* ComputeScanOrderFromIJKToRAS(vtkMatrix4x4 *IJKToRAS);
90 
91  void SetIJKToRASDirections(double dirs[3][3]);
92  void SetIJKToRASDirections(double ir, double ia, double is,
93  double jr, double ja, double js,
94  double kr, double ka, double ks);
95  void SetIToRASDirection(double ir, double ia, double is);
96  void SetJToRASDirection(double jr, double ja, double js);
97  void SetKToRASDirection(double kr, double ka, double ks);
98 
99  void GetIJKToRASDirections(double dirs[3][3]);
100  void GetIToRASDirection(double dirs[3]);
101  void GetJToRASDirection(double dirs[3]);
102  void GetKToRASDirection(double dirs[3]);
103 
109  vtkGetVector3Macro (Spacing, double);
110  virtual void SetSpacing(double arg1, double arg2, double arg3);
111  virtual void SetSpacing(double arg[3]);
112  vtkGetVector3Macro (Origin, double);
113  virtual void SetOrigin(double arg1, double arg2, double arg3);
114  virtual void SetOrigin(double arg[3]);
115 
118  double GetMinSpacing();
119 
122  double GetMaxSpacing();
123 
128  void GetIJKToRASMatrix(vtkMatrix4x4* mat);
129  void GetRASToIJKMatrix(vtkMatrix4x4* mat);
130 
131  void GetIJKToRASDirectionMatrix(vtkMatrix4x4* mat);
132  void SetIJKToRASDirectionMatrix(vtkMatrix4x4* mat);
133 
137  void SetIJKToRASMatrix(vtkMatrix4x4* mat);
138  void SetRASToIJKMatrix(vtkMatrix4x4* mat);
139 
146  void GetRASBounds(double bounds[6]) override;
147 
151  void GetBounds(double bounds[6]) override;
152 
157  void GetSliceBounds(double bounds[6], vtkMatrix4x4* rasToSlice);
158 
161  virtual vtkMRMLVolumeDisplayNode* GetVolumeDisplayNode();
162 
173  virtual void SetAndObserveImageData(vtkImageData *ImageData);
174  virtual vtkImageData* GetImageData();
178  virtual void SetImageDataConnection(vtkAlgorithmOutput *inputPort);
180  vtkGetObjectMacro(ImageDataConnection, vtkAlgorithmOutput);
181 
186  void ShiftImageDataExtentToZeroStart();
187 
190  void ProcessMRMLEvents ( vtkObject * /*caller*/,
191  unsigned long /*event*/,
192  void * /*callData*/ ) override;
193 
195  enum
196  {
197  ImageDataModifiedEvent = 18001
198  };
199 
202  void SetMetaDataDictionary( const itk::MetaDataDictionary& );
203  const itk::MetaDataDictionary& GetMetaDataDictionary() const;
204 
205  bool CanApplyNonLinearTransforms()const override;
206 
207  void ApplyTransform(vtkAbstractTransform* transform) override;
208 
209  void ApplyTransformMatrix(vtkMatrix4x4* transformMatrix) override;
210 
211  virtual void ApplyNonLinearTransform(vtkAbstractTransform* transform);
212 
213  bool GetModifiedSinceRead() override;
214 
219  virtual double GetImageBackgroundScalarComponentAsDouble(int component);
220 
221 protected:
223  ~vtkMRMLVolumeNode() override;
225  void operator=(const vtkMRMLVolumeNode&);
226 
228  void SetImageDataToDisplayNodes();
229  void SetImageDataToDisplayNode(vtkMRMLVolumeDisplayNode* displayNode);
230 
233  virtual void UpdateDisplayNodeImageData(vtkMRMLDisplayNode *dnode);
234 
237  void OnNodeReferenceAdded(vtkMRMLNodeReference *reference) override;
238 
241  void OnNodeReferenceModified(vtkMRMLNodeReference *reference) override;
242 
246  virtual void GetBoundsInternal(double bounds[6], vtkMatrix4x4* rasToSlice, bool useTransform);
247 
249  double IJKToRASDirections[3][3];
250 
252  double Spacing[3];
253  double Origin[3];
254 
255  vtkAlgorithmOutput* ImageDataConnection;
256  vtkEventForwarderCommand* DataEventForwarder;
257 
258  itk::MetaDataDictionary Dictionary;
259 };
260 
261 #endif
void ProcessMRMLEvents(vtkObject *, unsigned long, void *) override
alternative method to propagate events generated in Display nodes
void ReadXMLAttributes(const char **atts) override
Read node attributes from XML file
vtkEventForwarderCommand * DataEventForwarder
MRML node for representing a volume display attributes.
virtual void GetBounds(double bounds[6])
virtual bool GetModifiedSinceRead()
void OnNodeReferenceAdded(vtkMRMLNodeReference *reference) override
Called when a node reference ID is added (list size increased).
virtual void ApplyTransform(vtkAbstractTransform *transform)
void WriteXML(ostream &of, int indent) override
Write this node's information to a MRML file in XML format.
void operator=(const vtkMRMLDisplayableNode &)
A set of MRML Nodes that supports serialization and undo/redo.
Definition: vtkMRMLScene.h:56
void PrintSelf(ostream &os, vtkIndent indent) override
void Copy(vtkMRMLNode *node) override
Copy the node's attributes to this object
virtual void ApplyTransformMatrix(vtkMatrix4x4 *transformMatrix)
const char * GetNodeTagName() override=0
Get node XML tag name (like Volume, Model)
MRML node for representing a volume (image stack).
vtkAlgorithmOutput * ImageDataConnection
vtkMRMLNode * CreateNodeInstance() override=0
MRMLNode methods.
itk::MetaDataDictionary Dictionary
virtual bool CanApplyNonLinearTransforms() const
Abstract class that contains graphical display properties for displayable nodes.
void UpdateScene(vtkMRMLScene *scene) override
Finds the storage node and read the data
Abstract Superclass for all specific types of MRML nodes.
Definition: vtkMRMLNode.h:138
void OnNodeReferenceModified(vtkMRMLNodeReference *reference) override
Called when a node reference ID is modified.
virtual void GetRASBounds(double bounds[6])