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  enum
47  {
52  VoxelVectorType_Last // must be last
53  };
54 
55  vtkMRMLNode* CreateNodeInstance() override = 0;
56 
59  void ReadXMLAttributes( const char** atts) override;
60 
63  void WriteXML(ostream& of, int indent) override;
64 
68 
71  void CopyOrientation(vtkMRMLVolumeNode *node);
72 
73 
76  const char* GetNodeTagName() override = 0;
77 
80  void UpdateScene(vtkMRMLScene *scene) override;
81 
82  //--------------------------------------------------------------------------
84  //--------------------------------------------------------------------------
85 
92  static bool ComputeIJKToRASFromScanOrder(const char *order,
93  const double* spacing,
94  const int *dims,
95  bool centerImage,
96  vtkMatrix4x4 *IJKToRAS);
97 
98  static const char* ComputeScanOrderFromIJKToRAS(vtkMatrix4x4 *IJKToRAS);
99 
100  void SetIJKToRASDirections(double dirs[3][3]);
101  void SetIJKToRASDirections(double ir, double ia, double is,
102  double jr, double ja, double js,
103  double kr, double ka, double ks);
104  void SetIToRASDirection(double ir, double ia, double is);
105  void SetJToRASDirection(double jr, double ja, double js);
106  void SetKToRASDirection(double kr, double ka, double ks);
107 
108  void GetIJKToRASDirections(double dirs[3][3]);
109  void GetIToRASDirection(double dirs[3]);
110  void GetJToRASDirection(double dirs[3]);
111  void GetKToRASDirection(double dirs[3]);
112 
118  vtkGetVector3Macro (Spacing, double);
119  virtual void SetSpacing(double arg1, double arg2, double arg3);
120  virtual void SetSpacing(double arg[3]);
121  vtkGetVector3Macro (Origin, double);
122  virtual void SetOrigin(double arg1, double arg2, double arg3);
123  virtual void SetOrigin(double arg[3]);
124 
127  double GetMinSpacing();
128 
131  double GetMaxSpacing();
132 
137  void GetIJKToRASMatrix(vtkMatrix4x4* mat);
138  void GetRASToIJKMatrix(vtkMatrix4x4* mat);
139 
140  void GetIJKToRASDirectionMatrix(vtkMatrix4x4* mat);
141  void SetIJKToRASDirectionMatrix(vtkMatrix4x4* mat);
142 
146  void SetIJKToRASMatrix(vtkMatrix4x4* mat);
147  void SetRASToIJKMatrix(vtkMatrix4x4* mat);
148 
155  void GetRASBounds(double bounds[6]) override;
156 
160  void GetBounds(double bounds[6]) override;
161 
168  void GetSliceBounds(double bounds[6], vtkMatrix4x4* rasToSlice, bool useVoxelCenter = false);
169 
172  virtual vtkMRMLVolumeDisplayNode* GetVolumeDisplayNode();
173 
184  virtual void SetAndObserveImageData(vtkImageData *ImageData);
185  virtual vtkImageData* GetImageData();
189  virtual void SetImageDataConnection(vtkAlgorithmOutput *inputPort);
191  vtkGetObjectMacro(ImageDataConnection, vtkAlgorithmOutput);
192 
197  void ShiftImageDataExtentToZeroStart();
198 
201  void ProcessMRMLEvents ( vtkObject * /*caller*/,
202  unsigned long /*event*/,
203  void * /*callData*/ ) override;
204 
206  enum
207  {
208  ImageDataModifiedEvent = 18001
209  };
210 
213  void SetMetaDataDictionary( const itk::MetaDataDictionary& );
214  const itk::MetaDataDictionary& GetMetaDataDictionary() const;
215 
216  bool CanApplyNonLinearTransforms()const override;
217 
218  void ApplyTransform(vtkAbstractTransform* transform) override;
219 
220  void ApplyTransformMatrix(vtkMatrix4x4* transformMatrix) override;
221 
222  virtual void ApplyNonLinearTransform(vtkAbstractTransform* transform);
223 
224  bool GetModifiedSinceRead() override;
225 
230  virtual double GetImageBackgroundScalarComponentAsDouble(int component);
231 
233  void CreateDefaultSequenceDisplayNodes() override;
234 
236  bool IsCentered();
237 
240  bool AddCenteringTransform();
241 
248  vtkGetMacro(VoxelVectorType, int);
249  vtkSetMacro(VoxelVectorType, int);
250 
252  static const char *GetVoxelVectorTypeAsString(int id);
253  static int GetVoxelVectorTypeFromString(const char *name);
254 
255 protected:
257  ~vtkMRMLVolumeNode() override;
259  void operator=(const vtkMRMLVolumeNode&);
260 
262  void SetImageDataToDisplayNodes();
263  void SetImageDataToDisplayNode(vtkMRMLVolumeDisplayNode* displayNode);
264 
267  virtual void UpdateDisplayNodeImageData(vtkMRMLDisplayNode *dnode);
268 
271  void OnNodeReferenceAdded(vtkMRMLNodeReference *reference) override;
272 
275  void OnNodeReferenceModified(vtkMRMLNodeReference *reference) override;
276 
282  virtual void GetBoundsInternal(double bounds[6], vtkMatrix4x4* rasToSlice, bool useTransform, bool useVoxelCenter = false);
283 
286  void GetCenterPositionRAS(double* centerPositionRAS, bool useParentTransform=true);
287 
289  double IJKToRASDirections[3][3];
290 
292  double Spacing[3];
293  double Origin[3];
294 
295  vtkAlgorithmOutput* ImageDataConnection;
296  vtkEventForwarderCommand* DataEventForwarder;
297 
299  itk::MetaDataDictionary Dictionary;
300 };
301 
302 #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)
virtual void CreateDefaultSequenceDisplayNodes()
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:61
void PrintSelf(ostream &os, vtkIndent indent) override
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
vtkMRMLCopyContentMacro(vtkMRMLStorableNode)
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:167
void OnNodeReferenceModified(vtkMRMLNodeReference *reference) override
Called when a node reference ID is modified.
virtual void GetRASBounds(double bounds[6])