Slicer 5.4
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 {
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
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
234
237
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
255protected:
260
264
268
272
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
291
293 double IJKToRASDirections[3][3];
294
296 double Spacing[3];
297 double Origin[3];
298
299 vtkAlgorithmOutput* ImageDataConnection;
300 vtkEventForwarderCommand* DataEventForwarder;
301
303 itk::MetaDataDictionary Dictionary;
304};
305
306#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.
MRML node for representing a volume (image stack).
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 &)
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
vtkAlgorithmOutput * ImageDataConnection
void SetImageDataToDisplayNodes()
Set the image data pipeline to all the display nodes.
void GetIJKToRASDirectionMatrix(vtkMatrix4x4 *mat)
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 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.
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)