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
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
21
22// VTK includes
23class vtkAlgorithmOutput;
24class vtkEventForwarderCommand;
25class vtkImageData;
26class vtkMatrix4x4;
27
28// ITK includes
29#include "itkMetaDataDictionary.h"
30
40class VTK_MRML_EXPORT vtkMRMLVolumeNode : public vtkMRMLDisplayableNode
41{
42public:
44 void PrintSelf(ostream& os, vtkIndent indent) override;
45
46 enum
47 {
52 VoxelVectorType_Last // must be last
53 };
54
56
59 void ReadXMLAttributes( const char** atts) override;
60
63 void WriteXML(ostream& of, int indent) override;
64
68
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 jr, double kr,
102 double ia, double ja, double ka,
103 double is, double js, 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
128
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
173
184 virtual void SetAndObserveImageData(vtkImageData *ImageData);
185 virtual vtkImageData* GetImageData();
189 virtual void SetImageDataConnection(vtkAlgorithmOutput *inputPort);
191 vtkGetObjectMacro(ImageDataConnection, vtkAlgorithmOutput);
192
198
202
205 void ProcessMRMLEvents ( vtkObject * /*caller*/,
206 unsigned long /*event*/,
207 void * /*callData*/ ) override;
208
210 enum
211 {
213 };
214
217 void SetMetaDataDictionary( const itk::MetaDataDictionary& );
218 const itk::MetaDataDictionary& GetMetaDataDictionary() const;
219
220 bool CanApplyNonLinearTransforms()const override;
221
222 void ApplyTransform(vtkAbstractTransform* transform) override;
223
224 void ApplyTransformMatrix(vtkMatrix4x4* transformMatrix) override;
225
226 virtual void ApplyNonLinearTransform(vtkAbstractTransform* transform);
227
228 bool GetModifiedSinceRead() override;
229
234 virtual double GetImageBackgroundScalarComponentAsDouble(int component);
235
238
241
245
252 vtkGetMacro(VoxelVectorType, int);
253 vtkSetMacro(VoxelVectorType, int);
254
256 static const char *GetVoxelVectorTypeAsString(int id);
257 static int GetVoxelVectorTypeFromString(const char *name);
258
261 static bool IsIJKCoordinateSystemRightHanded(vtkMatrix4x4* ijkToRasMatrix);
262
265 static void ReverseSliceOrder(vtkImageData* imageData, vtkMatrix4x4* ijkToRasMatrix);
266
267protected:
272
276
280
284
288
294 virtual void GetBoundsInternal(double bounds[6], vtkMatrix4x4* rasToSlice, bool useTransform, bool useVoxelCenter = false);
295
298 void GetCenterPositionRAS(double* centerPositionRAS, bool useParentTransform=true);
299
303
305 double IJKToRASDirections[3][3];
306
308 double Spacing[3];
309 double Origin[3];
310
311 vtkAlgorithmOutput* ImageDataConnection;
312 vtkEventForwarderCommand* DataEventForwarder;
313
315 itk::MetaDataDictionary Dictionary;
316};
317
318#endif
Abstract class that contains graphical display properties for displayable nodes.
Class to hold information about a node reference.
Abstract Superclass for all specific types of MRML nodes.
A set of MRML Nodes that supports serialization and undo/redo.
MRML node for representing a volume display attributes.
virtual void UpdateDisplayNodeImageData(vtkMRMLDisplayNode *dnode)
void ApplyTransform(vtkAbstractTransform *transform) override
vtkMRMLNode * CreateNodeInstance() override=0
MRMLNode methods.
static const char * ComputeScanOrderFromIJKToRAS(vtkMatrix4x4 *IJKToRAS)
void UpdateScene(vtkMRMLScene *scene) override
Finds the storage node and read the data.
void SetIJKToRASDirections(double dirs[3][3])
virtual void SetOrigin(double arg[3])
double GetMinSpacing()
Utility function that returns the min spacing between the 3 orientations.
void GetRASBounds(double bounds[6]) override
virtual vtkMRMLVolumeDisplayNode * GetVolumeDisplayNode()
Associated display MRML node.
void SetIToRASDirection(double ir, double ia, double is)
virtual int GetResamplingInterpolationMode()
vtkMRMLVolumeNode(const vtkMRMLVolumeNode &)
double IJKToRASDirections[3][3]
these are unit length direction cosines
vtkEventForwarderCommand * DataEventForwarder
void ReadXMLAttributes(const char **atts) override
Read node attributes from XML file.
void ProcessMRMLEvents(vtkObject *, unsigned long, void *) override
alternative method to propagate events generated in Display nodes
const char * GetNodeTagName() override=0
Get node XML tag name (like Volume, Model)
void SetIJKToRASMatrix(vtkMatrix4x4 *mat)
virtual void SetImageDataConnection(vtkAlgorithmOutput *inputPort)
void OnNodeReferenceAdded(vtkMRMLNodeReference *reference) override
Called when a node reference ID is added (list size increased).
itk::MetaDataDictionary Dictionary
void ApplyTransformMatrix(vtkMatrix4x4 *transformMatrix) override
static bool IsIJKCoordinateSystemRightHanded(vtkMatrix4x4 *ijkToRasMatrix)
vtkAlgorithmOutput * ImageDataConnection
void SetImageDataToDisplayNodes()
Set the image data pipeline to all the display nodes.
void GetIJKToRASDirectionMatrix(vtkMatrix4x4 *mat)
static void ReverseSliceOrder(vtkImageData *imageData, vtkMatrix4x4 *ijkToRasMatrix)
void GetJToRASDirection(double dirs[3])
virtual void GetBoundsInternal(double bounds[6], vtkMatrix4x4 *rasToSlice, bool useTransform, bool useVoxelCenter=false)
void operator=(const vtkMRMLVolumeNode &)
static const char * GetVoxelVectorTypeAsString(int id)
Convert between voxel type ID and name.
virtual void ApplyNonLinearTransform(vtkAbstractTransform *transform)
void SetRASToIJKMatrix(vtkMatrix4x4 *mat)
void OnNodeReferenceModified(vtkMRMLNodeReference *reference) override
Called when a node reference ID is modified.
static int GetVoxelVectorTypeFromString(const char *name)
void GetIToRASDirection(double dirs[3])
void GetKToRASDirection(double dirs[3])
void SetIJKCoordinateSystemToRightHanded()
void GetBounds(double bounds[6]) override
void GetCenterPositionRAS(double *centerPositionRAS, bool useParentTransform=true)
void SetJToRASDirection(double jr, double ja, double js)
const itk::MetaDataDictionary & GetMetaDataDictionary() const
void SetMetaDataDictionary(const itk::MetaDataDictionary &)
Set/Get the ITK MetaDataDictionary.
void SetKToRASDirection(double kr, double ka, double ks)
void SetIJKToRASDirections(double ir, double jr, double kr, double ia, double ja, double ka, double is, double js, double ks)
virtual double GetImageBackgroundScalarComponentAsDouble(int component)
virtual void SetSpacing(double arg1, double arg2, double arg3)
vtkMRMLCopyContentMacro(vtkMRMLVolumeNode)
void GetRASToIJKMatrix(vtkMatrix4x4 *mat)
void SetIJKToRASDirectionMatrix(vtkMatrix4x4 *mat)
void GetIJKToRASMatrix(vtkMatrix4x4 *mat)
bool AddCenteringTransform()
virtual void SetAndObserveImageData(vtkImageData *ImageData)
double GetMaxSpacing()
Utility function that returns the max spacing between the 3 orientations.
void WriteXML(ostream &of, int indent) override
Write this node's information to a MRML file in XML format.
virtual vtkImageData * GetImageData()
void PrintSelf(ostream &os, vtkIndent indent) override
void CreateDefaultSequenceDisplayNodes() override
Creates the most appropriate display node class for storing a sequence of these nodes.
double Spacing[3]
these are mappings to mm space
void ShiftImageDataExtentToZeroStart()
void GetSliceBounds(double bounds[6], vtkMatrix4x4 *rasToSlice, bool useVoxelCenter=false)
bool GetModifiedSinceRead() override
~vtkMRMLVolumeNode() override
void CopyOrientation(vtkMRMLVolumeNode *node)
Copy the node's attributes to this object.
bool IsCentered()
Returns true if the volume center is in the origin.
virtual void SetOrigin(double arg1, double arg2, double arg3)
void GetIJKToRASDirections(double dirs[3][3])
bool CanApplyNonLinearTransforms() const override
static bool ComputeIJKToRASFromScanOrder(const char *order, const double *spacing, const int *dims, bool centerImage, vtkMatrix4x4 *IJKToRAS)
RAS->IJK Matrix Calculation.
virtual void SetSpacing(double arg[3])
void SetImageDataToDisplayNode(vtkMRMLVolumeDisplayNode *displayNode)