Slicer  5.1
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
vtkSlicerSegmentationGeometryLogic.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 Csaba Pinter, PerkLab, Queen's University
16  and was supported through CANARIE and the Applied Cancer Research Unit program
17  of Cancer Care Ontario with funds provided by the Ontario Ministry of Health and
18  Long-Term Care
19 
20 ==============================================================================*/
21 
22 // .NAME vtkSlicerSegmentationGeometryLogic
23 // .SECTION Description
24 // This class manages the logic associated with converting and handling
25 // segmentation node objects.
26 
27 #ifndef __vtkSlicerSegmentationGeometryLogic_h
28 #define __vtkSlicerSegmentationGeometryLogic_h
29 
30 // Slicer includes
31 #include "vtkSlicerSegmentationsModuleLogicExport.h"
32 
33 // Segmentations includes
35 
36 // vtkSegmentationCore includes
37 #include "vtkOrientedImageData.h"
38 
40 class VTK_SLICER_SEGMENTATIONS_LOGIC_EXPORT vtkSlicerSegmentationGeometryLogic : public vtkObject
41 {
42 public:
44  vtkTypeMacro(vtkSlicerSegmentationGeometryLogic, vtkObject);
45  void PrintSelf(ostream& os, vtkIndent indent) override;
46 
49  std::string CalculateOutputGeometry();
50 
52  bool IsSourceSegmentationWithBinaryLabelmapMaster();
53 
55  bool InputSegmentationCanBeResampled();
56 
59  void ComputeSourceAxisIndexForInputAxis();
60 
63  bool ResampleLabelmapsInSegmentationNode();
64 
66  vtkGetObjectMacro(OutputGeometryImageData, vtkOrientedImageData);
67 
69  void ResetGeometryImageData();
70 
72  vtkGetObjectMacro(InputSegmentationNode, vtkMRMLSegmentationNode);
74  vtkSetObjectMacro(InputSegmentationNode, vtkMRMLSegmentationNode);
76 
78  vtkGetObjectMacro(SourceGeometryNode, vtkMRMLDisplayableNode);
79  virtual void SetSourceGeometryNode(vtkMRMLDisplayableNode* node);
80 
82  vtkGetMacro(IsotropicSpacing, bool);
86  vtkSetMacro(IsotropicSpacing, bool);
87  vtkBooleanMacro(IsotropicSpacing, bool);
89 
91  vtkGetMacro(OversamplingFactor, double);
95  vtkSetMacro(OversamplingFactor, double);
97 
99  vtkGetVectorMacro(UserSpacing, double, 3);
102  vtkSetVectorMacro(UserSpacing, double, 3);
104 
106  vtkGetVectorMacro(InputAxisIndexForSourceAxis, int, 3);
107 
109  vtkGetVectorMacro(SourceAxisIndexForInputAxis, int, 3);
110 
112  vtkGetMacro(PadOutputGeometry, bool);
115  vtkSetMacro(PadOutputGeometry, bool);
116  vtkBooleanMacro(PadOutputGeometry, bool);
118 
119 protected:
122 
123 protected:
124 
128  std::string CalculateOutputGeometryFromImage();
129 
134  std::string CalculateOutputGeometryFromBounds(bool keepCurrentAxisDirections);
135 
136  void CalculatePaddedOutputGeometry();
137 
138  vtkMRMLSegmentationNode* InputSegmentationNode{ nullptr };
139  vtkMRMLDisplayableNode* SourceGeometryNode{ nullptr };
140  bool IsotropicSpacing{ false };
141  double OversamplingFactor{ 1.0 };
142  bool PadOutputGeometry{ true };
143  double UserSpacing[3]{ 1.0, 1.0, 1.0 };
144  vtkOrientedImageData* OutputGeometryImageData{ nullptr };
145  int InputAxisIndexForSourceAxis[3]{ 0, 1, 2 };
146  int SourceAxisIndexForInputAxis[3]{ 0, 1, 2 };
147 
148 private:
150  void operator=(const vtkSlicerSegmentationGeometryLogic&) = delete;
151 };
152 
153 #endif
Image data containing orientation information.
MRML node containing segmentationsSegmentation node stores a set of segments (also known as contours ...