Slicer  4.10
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) VTK_OVERRIDE;
45 
46  virtual vtkMRMLNode* CreateNodeInstance() VTK_OVERRIDE = 0;
47 
50  virtual void ReadXMLAttributes( const char** atts) VTK_OVERRIDE;
51 
54  virtual void WriteXML(ostream& of, int indent) VTK_OVERRIDE;
55 
58  virtual void Copy(vtkMRMLNode *node) VTK_OVERRIDE;
59 
62  void CopyOrientation(vtkMRMLVolumeNode *node);
63 
64 
67  virtual const char* GetNodeTagName() VTK_OVERRIDE = 0;
68 
71  virtual void UpdateScene(vtkMRMLScene *scene) VTK_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  virtual void GetRASBounds(double bounds[6]) VTK_OVERRIDE;
147 
151  virtual void GetBounds(double bounds[6]) VTK_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  virtual void ProcessMRMLEvents ( vtkObject * /*caller*/,
191  unsigned long /*event*/,
192  void * /*callData*/ ) VTK_OVERRIDE;
193 
195  enum
196  {
197  ImageDataModifiedEvent = 18001
198  };
199 
202  void SetMetaDataDictionary( const itk::MetaDataDictionary& );
203  const itk::MetaDataDictionary& GetMetaDataDictionary() const;
204 
205  virtual bool CanApplyNonLinearTransforms()const VTK_OVERRIDE;
206 
207  virtual void ApplyTransform(vtkAbstractTransform* transform) VTK_OVERRIDE;
208 
209  virtual void ApplyTransformMatrix(vtkMatrix4x4* transformMatrix) VTK_OVERRIDE;
210 
211  virtual void ApplyNonLinearTransform(vtkAbstractTransform* transform);
212 
213  virtual bool GetModifiedSinceRead() VTK_OVERRIDE;
214 
219  virtual double GetImageBackgroundScalarComponentAsDouble(int component);
220 
221 protected:
225  void operator=(const vtkMRMLVolumeNode&);
226 
228  void SetImageDataToDisplayNodes();
229  void SetImageDataToDisplayNode(vtkMRMLVolumeDisplayNode* displayNode);
230 
233  virtual void UpdateDisplayNodeImageData(vtkMRMLDisplayNode *dnode);
234 
237  virtual void OnNodeReferenceAdded(vtkMRMLNodeReference *reference) VTK_OVERRIDE;
238 
241  virtual void OnNodeReferenceModified(vtkMRMLNodeReference *reference) VTK_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
MRML node for representing a volume display attributes.
Simplified inverse ITK transforms.
void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE
A set of MRML Nodes that supports serialization and undo/redo.
Definition: vtkMRMLScene.h:54
MRML node for representing a volume (image stack).
virtual bool CanApplyNonLinearTransforms() const
Abstract class that contains graphical display properties for displayable nodes.
Abstract Superclass for all specific types of MRML nodes.
Definition: vtkMRMLNode.h:138
virtual vtkMRMLNode * CreateNodeInstance() VTK_OVERRIDE=0
MRMLNode methods.