Slicer 5.6
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
Loading...
Searching...
No Matches
vtkSlicerTransformLogic.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 This file was partly developed by Andras Lasso and Franklin King at
9 PerkLab, Queen's University and was supported through the Applied Cancer
10 Research Unit program of Cancer Care Ontario with funds provided by the
11 Ontario Ministry of Health and Long-Term Care.
12
13=========================================================================auto=*/
14
19
20#ifndef __vtkSlicerTransformLogic_h
21#define __vtkSlicerTransformLogic_h
22
23// SlicerLogic includes
24#include "vtkSlicerBaseLogic.h"
25#include "vtkSlicerTransformsModuleLogicExport.h"
26
27// MRMLLogic includes
29
30// STD includes
31#include <vector>
32
33// MRML includes
38class vtkMRMLScene;
44
45// VTK includes
46class vtkImageData;
47class vtkMatrix4x4;
48class vtkPoints;
49class vtkPointSet;
50class vtkPolyData;
51class vtkUnstructuredGrid;
52
53class VTK_SLICER_TRANSFORMS_MODULE_LOGIC_EXPORT vtkSlicerTransformLogic : public vtkMRMLAbstractLogic
54{
55 public:
56
60 void PrintSelf(ostream& os, vtkIndent indent) override { Superclass::PrintSelf(os, indent); }
61
67
70 vtkMRMLTransformNode* AddTransform(const char* filename, vtkMRMLScene *scene, vtkMRMLMessageCollection* userMessages=nullptr);
71
74 static bool GetVisualization2d(vtkPolyData* output_RAS, vtkMRMLTransformDisplayNode* displayNode,
75 vtkMRMLSliceNode* sliceNode, vtkMRMLMarkupsNode* glyphPointsNode = nullptr);
76
79 static bool GetVisualization2d(vtkPolyData* output_RAS, vtkMRMLTransformDisplayNode* displayNode,
80 vtkMatrix4x4* sliceToRAS, double* fieldOfViewOrigin, double* fieldOfViewSize, vtkPoints* samplePositions_RAS = nullptr);
81
86 static bool GetVisualization3d(vtkPolyData* output_RAS, vtkMRMLTransformDisplayNode* displayNode,
87 vtkMatrix4x4* roiToRAS, int* roiSize, vtkPoints* samplePositions_RAS = nullptr);
88
93 static bool GetVisualization3d(vtkPolyData* output_RAS, vtkMRMLTransformDisplayNode* displayNode,
94 vtkMRMLNode* regionNode, vtkMRMLMarkupsNode* glyphPointsNode=nullptr);
95
99
106 bool magnitude = true, vtkMRMLVolumeNode* existingOutputVolumeNode = nullptr);
107
111 vtkMRMLTransformNode* ConvertToGridTransform(vtkMRMLTransformNode* inputTransformNode, vtkMRMLVolumeNode* referenceVolumeNode = nullptr,
112 vtkMRMLTransformNode* existingOutputTransformNode = nullptr);
113
120 static bool GetTransformedPointSamplesAsMagnitudeImage(vtkImageData* outputMagnitudeImage, vtkMRMLTransformNode* inputTransformNode,
121 vtkMatrix4x4* ijkToRAS, bool transformToWorld = true);
122
129 static bool GetTransformedPointSamplesAsVectorImage(vtkImageData* outputVectorImage, vtkMRMLTransformNode* inputTransformNode,
130 vtkMatrix4x4* ijkToRAS, bool transformToWorld = true);
131
137 vtkMRMLScene* scene, vtkMRMLTransformNode* transformNode,
138 std::vector<vtkMRMLDisplayableNode*>& transformedNodes,
139 bool recursive=true);
140
145 static void GetNodesRASBounds(
146 const std::vector<vtkMRMLDisplayableNode*>& nodes,
147 double bounds[6]);
148
153 static void GetNodesBounds(
154 const std::vector<vtkMRMLDisplayableNode*>& nodes,
155 double bounds[6]);
156
172
173protected:
178
182 static void GetGlyphVisualization2d(vtkPolyData* output_RAS, vtkMRMLTransformDisplayNode* displayNode, vtkMatrix4x4* sliceToRAS,
183 double* fieldOfViewOrigin, double* fieldOfViewSize, vtkPoints* samplePositions_RAS = nullptr);
187 static void GetGlyphVisualization3d(vtkPolyData* output_RAS, vtkMRMLTransformDisplayNode* displayNode, vtkMatrix4x4* roiToRAS,
188 int* roiSize, vtkPoints* samplePositions_RAS = nullptr);
189
192 static void GetGridVisualization2d(vtkPolyData* output_RAS, vtkMRMLTransformDisplayNode* displayNode, vtkMatrix4x4* sliceToRAS,
193 double* fieldOfViewOrigin, double* fieldOfViewSize);
196 static void GetGridVisualization3d(vtkPolyData* output_RAS, vtkMRMLTransformDisplayNode* displayNode, vtkMatrix4x4* roiToRAS, int* roiSize);
197
200 static void GetContourVisualization2d(vtkPolyData* output_RAS, vtkMRMLTransformDisplayNode* displayNode, vtkMatrix4x4* sliceToRAS,
201 double* fieldOfViewOrigin, double* fieldOfViewSize);
204 static void GetContourVisualization3d(vtkPolyData* output_RAS, vtkMRMLTransformDisplayNode* displayNode, vtkMatrix4x4* roiToRAS, int* roiSize);
205
208
210 static void CreateGrid(vtkPolyData* outputGrid_RAS, vtkMRMLTransformDisplayNode* displayNode, int numGridPoints[3], vtkPolyData* outputWarpedGrid_RAS=nullptr);
211
215 static void GetTransformedPointSamples(vtkPointSet* outputPointSet,
216 vtkMRMLTransformNode* inputTransformNode, vtkPoints* samplePositions_RAS,
217 bool transformToWorld = true);
218
224 static void GetTransformedPointSamples(vtkPointSet* outputPointSet_RAS, vtkMRMLTransformNode* inputTransformNode,
225 vtkMatrix4x4* gridToRAS, int* gridSize, bool transformToWorld = true);
226
231 static void GetTransformedPointSamplesOnSlice(vtkPointSet* outputPointSet_RAS, vtkMRMLTransformNode* inputTransformNode,
232 vtkMatrix4x4* sliceToRAS, double* fieldOfViewOrigin, double* fieldOfViewSize, double pointSpacing, int pointGroupSize = 1, int* numGridPoints = nullptr,
233 vtkPoints* samplePositions_RAS = nullptr);
234
238 static void GetTransformedPointSamplesOnRoi(vtkPointSet* outputPointSet_RAS, vtkMRMLTransformNode* inputTransformNode,
239 vtkMatrix4x4* roiToRAS, int* roiSize, double pointSpacingMm, int pointGroupSize=1, int* numGridPoints=nullptr);
240
242 static void GetMarkupsAsPoints(vtkMRMLMarkupsNode* markupsNode, vtkPoints* samplePoints_RAS);
243
244};
245
246#endif
Superclass for MRML logic classes.
Abstract Superclass for all specific types of MRML nodes.
MRML node for representing a volume (image stack).
A set of MRML Nodes that supports serialization and undo/redo.
MRML node for storing a slice through RAS space.
MRML node to represent display properties for transforms visualization in the slice and 3D viewers.
MRML node for representing a transformation between this node space and a parent node space.
MRML node for representing a node with a transform.
MRML node for representing a volume (image stack).
static vtkSlicerTransformLogic * New()
The Usual vtk class functions.
static void GetGridVisualization3d(vtkPolyData *output_RAS, vtkMRMLTransformDisplayNode *displayNode, vtkMatrix4x4 *roiToRAS, int *roiSize)
static void GetTransformedPointSamples(vtkPointSet *outputPointSet_RAS, vtkMRMLTransformNode *inputTransformNode, vtkMatrix4x4 *gridToRAS, int *gridSize, bool transformToWorld=true)
static bool GetTransformedPointSamplesAsMagnitudeImage(vtkImageData *outputMagnitudeImage, vtkMRMLTransformNode *inputTransformNode, vtkMatrix4x4 *ijkToRAS, bool transformToWorld=true)
static void GetTransformedNodes(vtkMRMLScene *scene, vtkMRMLTransformNode *transformNode, std::vector< vtkMRMLDisplayableNode * > &transformedNodes, bool recursive=true)
static int GetGridSubdivision(vtkMRMLTransformDisplayNode *displayNode)
Return the number of samples in each grid.
static bool GetVisualization2d(vtkPolyData *output_RAS, vtkMRMLTransformDisplayNode *displayNode, vtkMatrix4x4 *sliceToRAS, double *fieldOfViewOrigin, double *fieldOfViewSize, vtkPoints *samplePositions_RAS=nullptr)
static void GetMarkupsAsPoints(vtkMRMLMarkupsNode *markupsNode, vtkPoints *samplePoints_RAS)
Get markup points as vtkPoints in RAS coordinate system.
vtkSlicerTransformLogic(const vtkSlicerTransformLogic &)
static bool GetVisualization3d(vtkPolyData *output_RAS, vtkMRMLTransformDisplayNode *displayNode, vtkMRMLNode *regionNode, vtkMRMLMarkupsNode *glyphPointsNode=nullptr)
static void GetNodesRASBounds(const std::vector< vtkMRMLDisplayableNode * > &nodes, double bounds[6])
static void GetContourVisualization2d(vtkPolyData *output_RAS, vtkMRMLTransformDisplayNode *displayNode, vtkMatrix4x4 *sliceToRAS, double *fieldOfViewOrigin, double *fieldOfViewSize)
static void GetGlyphVisualization3d(vtkPolyData *output_RAS, vtkMRMLTransformDisplayNode *displayNode, vtkMatrix4x4 *roiToRAS, int *roiSize, vtkPoints *samplePositions_RAS=nullptr)
static void GetTransformedPointSamplesOnSlice(vtkPointSet *outputPointSet_RAS, vtkMRMLTransformNode *inputTransformNode, vtkMatrix4x4 *sliceToRAS, double *fieldOfViewOrigin, double *fieldOfViewSize, double pointSpacing, int pointGroupSize=1, int *numGridPoints=nullptr, vtkPoints *samplePositions_RAS=nullptr)
static bool hardenTransform(vtkMRMLTransformableNode *node)
static TransformKind GetTransformKind(vtkMRMLTransformNode *transformNode)
void PrintSelf(ostream &os, vtkIndent indent) override
static const char * GetVisualizationDisplacementMagnitudeScalarName()
static bool GetVisualization3d(vtkPolyData *output_RAS, vtkMRMLTransformDisplayNode *displayNode, vtkMatrix4x4 *roiToRAS, int *roiSize, vtkPoints *samplePositions_RAS=nullptr)
static void GetNodesBounds(const std::vector< vtkMRMLDisplayableNode * > &nodes, double bounds[6])
static void GetTransformedPointSamples(vtkPointSet *outputPointSet, vtkMRMLTransformNode *inputTransformNode, vtkPoints *samplePositions_RAS, bool transformToWorld=true)
vtkMRMLVolumeNode * CreateDisplacementVolumeFromTransform(vtkMRMLTransformNode *inputTransformNode, vtkMRMLVolumeNode *referenceVolumeNode=nullptr, bool magnitude=true, vtkMRMLVolumeNode *existingOutputVolumeNode=nullptr)
static bool GetVisualization2d(vtkPolyData *output_RAS, vtkMRMLTransformDisplayNode *displayNode, vtkMRMLSliceNode *sliceNode, vtkMRMLMarkupsNode *glyphPointsNode=nullptr)
static void GetGlyphVisualization2d(vtkPolyData *output_RAS, vtkMRMLTransformDisplayNode *displayNode, vtkMatrix4x4 *sliceToRAS, double *fieldOfViewOrigin, double *fieldOfViewSize, vtkPoints *samplePositions_RAS=nullptr)
static void GetGridVisualization2d(vtkPolyData *output_RAS, vtkMRMLTransformDisplayNode *displayNode, vtkMatrix4x4 *sliceToRAS, double *fieldOfViewOrigin, double *fieldOfViewSize)
static void GetTransformedPointSamplesOnRoi(vtkPointSet *outputPointSet_RAS, vtkMRMLTransformNode *inputTransformNode, vtkMatrix4x4 *roiToRAS, int *roiSize, double pointSpacingMm, int pointGroupSize=1, int *numGridPoints=nullptr)
vtkMRMLTransformNode * AddTransform(const char *filename, vtkMRMLScene *scene, vtkMRMLMessageCollection *userMessages=nullptr)
Read transform from file.
static bool GetTransformedPointSamplesAsVectorImage(vtkImageData *outputVectorImage, vtkMRMLTransformNode *inputTransformNode, vtkMatrix4x4 *ijkToRAS, bool transformToWorld=true)
void operator=(const vtkSlicerTransformLogic &)
static void GetContourVisualization3d(vtkPolyData *output_RAS, vtkMRMLTransformDisplayNode *displayNode, vtkMatrix4x4 *roiToRAS, int *roiSize)
~vtkSlicerTransformLogic() override
static void CreateGrid(vtkPolyData *outputGrid_RAS, vtkMRMLTransformDisplayNode *displayNode, int numGridPoints[3], vtkPolyData *outputWarpedGrid_RAS=nullptr)
Add lines to the gridPolyData to make it a grid. If warpedGrid is specified then a warped grid is gen...
vtkMRMLTransformNode * ConvertToGridTransform(vtkMRMLTransformNode *inputTransformNode, vtkMRMLVolumeNode *referenceVolumeNode=nullptr, vtkMRMLTransformNode *existingOutputTransformNode=nullptr)