Slicer 5.9
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
Loading...
Searching...
No Matches
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 {
49 VoxelVectorTypeSpatial, // 3D contravariant spatial vector (displacement field, motion, etc.)
52 VoxelVectorTypeSpatialCovariant, // 3D covariant spatial vector (gradient, etc.)
53 VoxelVectorType_Last // must be last
54 };
55
57
60 void ReadXMLAttributes(const char** atts) override;
61
64 void WriteXML(ostream& of, int indent) override;
65
69
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, const double* spacing, const int* dims, bool centerImage, vtkMatrix4x4* IJKToRAS);
93
94 static const char* ComputeScanOrderFromIJKToRAS(vtkMatrix4x4* IJKToRAS);
95
96 void SetIJKToRASDirections(double dirs[3][3]);
97 void SetIJKToRASDirections(double ir, double jr, double kr, double ia, double ja, double ka, double is, double js, double ks);
98 void SetIToRASDirection(double ir, double ia, double is);
99 void SetJToRASDirection(double jr, double ja, double js);
100 void SetKToRASDirection(double kr, double ka, double ks);
101
102 void GetIJKToRASDirections(double dirs[3][3]);
103 void GetIToRASDirection(double dirs[3]);
104 void GetJToRASDirection(double dirs[3]);
105 void GetKToRASDirection(double dirs[3]);
106
112 vtkGetVector3Macro(Spacing, double);
113 virtual void SetSpacing(double arg1, double arg2, double arg3);
114 virtual void SetSpacing(double arg[3]);
115 vtkGetVector3Macro(Origin, double);
116 virtual void SetOrigin(double arg1, double arg2, double arg3);
117 virtual void SetOrigin(double arg[3]);
118
122
126
131 void GetIJKToRASMatrix(vtkMatrix4x4* mat);
132 void GetRASToIJKMatrix(vtkMatrix4x4* mat);
133
134 void GetIJKToRASDirectionMatrix(vtkMatrix4x4* mat);
135 void SetIJKToRASDirectionMatrix(vtkMatrix4x4* mat);
136
140 void SetIJKToRASMatrix(vtkMatrix4x4* mat);
141 void SetRASToIJKMatrix(vtkMatrix4x4* mat);
142
149 void GetRASBounds(double bounds[6]) override;
150
154 void GetBounds(double bounds[6]) override;
155
162 void GetSliceBounds(double bounds[6], vtkMatrix4x4* rasToSlice, bool useVoxelCenter = false);
163
167
178 virtual void SetAndObserveImageData(vtkImageData* ImageData);
179 virtual vtkImageData* GetImageData();
183 virtual void SetImageDataConnection(vtkAlgorithmOutput* inputPort);
185 vtkGetObjectMacro(ImageDataConnection, vtkAlgorithmOutput);
186
192
196
199 void ProcessMRMLEvents(vtkObject* /*caller*/, unsigned long /*event*/, void* /*callData*/) override;
200
202 enum
203 {
205 };
206
209 void SetMetaDataDictionary(const itk::MetaDataDictionary&);
210 const itk::MetaDataDictionary& GetMetaDataDictionary() const;
211
212 bool CanApplyNonLinearTransforms() const override;
213
214 void ApplyTransform(vtkAbstractTransform* transform) override;
215
216 void ApplyTransformMatrix(vtkMatrix4x4* transformMatrix) override;
217
218 virtual void ApplyNonLinearTransform(vtkAbstractTransform* transform);
219
220 bool GetModifiedSinceRead() override;
221
226 virtual double GetImageBackgroundScalarComponentAsDouble(int component);
227
230
233
237
244 vtkGetMacro(VoxelVectorType, int);
245 vtkSetMacro(VoxelVectorType, int);
246
248 static const char* GetVoxelVectorTypeAsString(int id);
249 static int GetVoxelVectorTypeFromString(const char* name);
250
253 static bool IsIJKCoordinateSystemRightHanded(vtkMatrix4x4* ijkToRasMatrix);
254
257 static void ReverseSliceOrder(vtkImageData* imageData, vtkMatrix4x4* ijkToRasMatrix);
258
259protected:
264
268
272
276
280
286 virtual void GetBoundsInternal(double bounds[6], vtkMatrix4x4* rasToSlice, bool useTransform, bool useVoxelCenter = false);
287
290 void GetCenterPositionRAS(double* centerPositionRAS, bool useParentTransform = true);
291
295
297 double IJKToRASDirections[3][3];
298
300 double Spacing[3];
301 double Origin[3];
302
303 vtkAlgorithmOutput* ImageDataConnection;
304 vtkEventForwarderCommand* DataEventForwarder;
305
307 itk::MetaDataDictionary Dictionary;
308};
309
310#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)