Slicer 5.9
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
Loading...
Searching...
No Matches
vtkPolyDataToFractionalLabelmapFilter.h
Go to the documentation of this file.
1/*==============================================================================
2
3 Copyright (c) Laboratory for Percutaneous Surgery (PerkLab)
4 Queen's University, Kingston, ON, Canada. All Rights Reserved.
5
6 See COPYRIGHT.txt
7 or http://www.slicer.org/copyright/copyright.txt for details.
8
9 Unless required by applicable law or agreed to in writing, software
10 distributed under the License is distributed on an "AS IS" BASIS,
11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 See the License for the specific language governing permissions and
13 limitations under the License.
14
15 This file was originally developed by Kyle Sunderland, PerkLab, Queen's University
16 and was supported through the Applied Cancer Research Unit program of Cancer Care
17 Ontario with funds provided by the Ontario Ministry of Health and Long-Term Care
18
19 This file is a modified version of vtkPolyDataToImageStencil.h
20
21==============================================================================*/
22
23#ifndef vtkPolyDataToFractionalLabelmapFilter_h
24#define vtkPolyDataToFractionalLabelmapFilter_h
25
26// VTK includes
27#include <vtkPolyDataToImageStencil.h>
28#include <vtkSmartPointer.h>
29#include <vtkCellArray.h>
30#include <vtkSetGet.h>
31#include <vtkMatrix4x4.h>
32#include <vtkCellLocator.h>
33
34// Segmentations includes
36
37// std includes
38#include <map>
39
40#include "vtkSegmentationCoreConfigure.h"
41
42// Define the datatype and fractional constants for fractional labelmap conversion based on the value of VTK_FRACTIONAL_DATA_TYPE
43#define VTK_FRACTIONAL_DATA_TYPE VTK_CHAR
44
45#if VTK_FRACTIONAL_DATA_TYPE == VTK_UNSIGNED_CHAR
46# define FRACTIONAL_DATA_TYPE VTK_TYPE_NAME_UNSIGNED_CHAR
47# define FRACTIONAL_MIN 0
48# define FRACTIONAL_MAX 216
49# define FRACTIONAL_STEP_SIZE 1
50#elif VTK_FRACTIONAL_DATA_TYPE == VTK_CHAR
51# define FRACTIONAL_DATA_TYPE VTK_TYPE_NAME_CHAR
52# define FRACTIONAL_MIN -108
53# define FRACTIONAL_MAX 108
54# define FRACTIONAL_STEP_SIZE 1
55#elif VTK_FRACTIONAL_DATA_TYPE == VTK_FLOAT
56# define FRACTIONAL_DATA_TYPE VTK_TYPE_NAME_FLOAT
57# define FRACTIONAL_MIN 0.0
58# define FRACTIONAL_MAX 1.0
59# define FRACTIONAL_STEP_SIZE (1.0 / 216.0)
60#endif
61
62class vtkSegmentationCore_EXPORT vtkPolyDataToFractionalLabelmapFilter : public vtkPolyDataToImageStencil
63{
64private:
65 std::map<double, vtkSmartPointer<vtkCellArray>> LinesCache;
66 std::map<double, vtkSmartPointer<vtkPolyData>> SliceCache;
67 std::map<double, vtkIdType*> PointIdsCache;
68 std::map<double, vtkIdType> NptsCache;
69 std::map<double, vtkSmartPointer<vtkIdTypeArray>> PointNeighborCountsCache;
70
71 vtkCellLocator* CellLocator;
72
73 vtkOrientedImageData* OutputImageTransformData;
74 int NumberOfOffsets;
75
76public:
78 vtkTypeMacro(vtkPolyDataToFractionalLabelmapFilter, vtkPolyDataToImageStencil);
79
81 virtual void SetOutput(vtkOrientedImageData* output);
82
83 void SetOutputImageToWorldMatrix(vtkMatrix4x4* imageToWorldMatrix);
84 void GetOutputImageToWorldMatrix(vtkMatrix4x4* imageToWorldMatrix);
85
86 using Superclass::GetOutputOrigin;
87 double* GetOutputOrigin() VTK_SIZEHINT(3) override;
88 void GetOutputOrigin(double origin[3]) override;
89
91 void SetOutputOrigin(const double origin[3]) override;
92 void SetOutputOrigin(double x, double y, double z) override;
93
95 double* GetOutputSpacing() VTK_SIZEHINT(3) override;
96 void GetOutputSpacing(double spacing[3]) override;
97
99 void SetOutputSpacing(const double spacing[3]) override;
100 void SetOutputSpacing(double x, double y, double z) override;
101
104
105 vtkSetMacro(NumberOfOffsets, int);
106 vtkGetMacro(NumberOfOffsets, int);
107
108protected:
111
112 int RequestData(vtkInformation*, vtkInformationVector**, vtkInformationVector*) override;
113 vtkOrientedImageData* AllocateOutputData(vtkDataObject* out, int* updateExt);
114 int FillOutputPortInformation(int, vtkInformation*) override;
115
121 void FillImageStencilData(vtkImageStencilData* output, vtkPolyData* closedSurface, int extent[6]);
122
126 void AddBinaryLabelMapToFractionalLabelMap(vtkImageData* binaryLabelMap, vtkImageData* fractionalLabelMap);
127
133 void PolyDataCutter(vtkPolyData* input, vtkPolyData* output, double z);
134
135private:
137 void operator=(const vtkPolyDataToFractionalLabelmapFilter&) = delete;
138};
139
140#endif
Image data containing orientation information.
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
void PolyDataCutter(vtkPolyData *input, vtkPolyData *output, double z)
virtual vtkOrientedImageData * GetOutput()
void AddBinaryLabelMapToFractionalLabelMap(vtkImageData *binaryLabelMap, vtkImageData *fractionalLabelMap)
void FillImageStencilData(vtkImageStencilData *output, vtkPolyData *closedSurface, int extent[6])
static vtkPolyDataToFractionalLabelmapFilter * New()
virtual void SetOutput(vtkOrientedImageData *output)
void SetOutputOrigin(const double origin[3]) override
vtkOrientedImageData * AllocateOutputData(vtkDataObject *out, int *updateExt)
double * GetOutputOrigin() VTK_SIZEHINT(3) override
int FillOutputPortInformation(int, vtkInformation *) override
double * GetOutputSpacing() VTK_SIZEHINT(3) override
void SetOutputSpacing(const double spacing[3]) override
void GetOutputImageToWorldMatrix(vtkMatrix4x4 *imageToWorldMatrix)
void SetOutputImageToWorldMatrix(vtkMatrix4x4 *imageToWorldMatrix)
void DeleteCache()
This method deletes the currently stored cache variables.