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
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
27// VTK includes
28#include <vtkPolyDataToImageStencil.h>
29#include <vtkSmartPointer.h>
30#include <vtkCellArray.h>
31#include <vtkSetGet.h>
32#include <vtkMatrix4x4.h>
33#include <vtkCellLocator.h>
34
35// Segmentations includes
37
38// std includes
39#include <map>
40
41#include "vtkSegmentationCoreConfigure.h"
42
43// Define the datatype and fractional constants for fractional labelmap conversion based on the value of VTK_FRACTIONAL_DATA_TYPE
44#define VTK_FRACTIONAL_DATA_TYPE VTK_CHAR
45
46#if VTK_FRACTIONAL_DATA_TYPE == VTK_UNSIGNED_CHAR
47 #define FRACTIONAL_DATA_TYPE VTK_TYPE_NAME_UNSIGNED_CHAR
48 #define FRACTIONAL_MIN 0
49 #define FRACTIONAL_MAX 216
50 #define FRACTIONAL_STEP_SIZE 1
51#elif VTK_FRACTIONAL_DATA_TYPE == VTK_CHAR
52 #define FRACTIONAL_DATA_TYPE VTK_TYPE_NAME_CHAR
53 #define FRACTIONAL_MIN -108
54 #define FRACTIONAL_MAX 108
55 #define FRACTIONAL_STEP_SIZE 1
56#elif VTK_FRACTIONAL_DATA_TYPE == VTK_FLOAT
57 #define FRACTIONAL_DATA_TYPE VTK_TYPE_NAME_FLOAT
58 #define FRACTIONAL_MIN 0.0
59 #define FRACTIONAL_MAX 1.0
60 #define FRACTIONAL_STEP_SIZE (1.0/216.0)
61#endif
62
63class vtkSegmentationCore_EXPORT vtkPolyDataToFractionalLabelmapFilter :
64 public vtkPolyDataToImageStencil
65{
66private:
67 std::map<double, vtkSmartPointer<vtkCellArray> > LinesCache;
68 std::map<double, vtkSmartPointer<vtkPolyData> > SliceCache;
69 std::map<double, vtkIdType*> PointIdsCache;
70 std::map<double, vtkIdType> NptsCache;
71 std::map<double, vtkSmartPointer<vtkIdTypeArray> > PointNeighborCountsCache;
72
73 vtkCellLocator* CellLocator;
74
75 vtkOrientedImageData* OutputImageTransformData;
76 int NumberOfOffsets;
77
78public:
80 vtkTypeMacro(vtkPolyDataToFractionalLabelmapFilter, vtkPolyDataToImageStencil);
81
83 virtual void SetOutput(vtkOrientedImageData* output);
84
85 void SetOutputImageToWorldMatrix(vtkMatrix4x4* imageToWorldMatrix);
86 void GetOutputImageToWorldMatrix(vtkMatrix4x4* imageToWorldMatrix);
87
88 using Superclass::GetOutputOrigin;
89 double* GetOutputOrigin() VTK_SIZEHINT(3) override;
90 void GetOutputOrigin(double origin[3]) override;
91
93 void SetOutputOrigin(const double origin[3]) override;
94 void SetOutputOrigin(double x, double y, double z) override;
95
97 double* GetOutputSpacing() VTK_SIZEHINT(3) override;
98 void GetOutputSpacing(double spacing[3]) override;
99
101 void SetOutputSpacing(const double spacing[3]) override;
102 void SetOutputSpacing(double x, double y, double z) override;
103
106
107 vtkSetMacro(NumberOfOffsets, int);
108 vtkGetMacro(NumberOfOffsets, int);
109
110protected:
113
114 int RequestData(vtkInformation *, vtkInformationVector **,
115 vtkInformationVector *) override;
116 vtkOrientedImageData *AllocateOutputData(vtkDataObject *out, int* updateExt);
117 int FillOutputPortInformation(int, vtkInformation*) override;
118
124 void FillImageStencilData(vtkImageStencilData *output, vtkPolyData* closedSurface, int extent[6]);
125
129 void AddBinaryLabelMapToFractionalLabelMap(vtkImageData* binaryLabelMap, vtkImageData* fractionalLabelMap);
130
136 void PolyDataCutter(vtkPolyData *input, vtkPolyData *output,
137 double z);
138
139private:
141 void operator=(const vtkPolyDataToFractionalLabelmapFilter&) = delete;
142};
143
144#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.