Slicer  5.0
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
vtkSegmentationModifier.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 CANARIE's Research Software Program, Cancer
17  Care Ontario, OpenAnatomy, and Brigham and Women's Hospital through NIH grant R01MH112748.
18 
19 ==============================================================================*/
20 
21 #ifndef __vtkSegmentationModifier_h
22 #define __vtkSegmentationModifier_h
23 
24 // Segmentation includes
25 #include "vtkSegmentationCoreConfigure.h"
26 
27 // VTK includes
28 #include "vtkObject.h"
29 
30 // STD includes
31 #include <vector>
32 
34 class vtkSegmentation;
35 
38 class vtkSegmentationCore_EXPORT vtkSegmentationModifier : public vtkObject
39 {
40 public:
41  static vtkSegmentationModifier* New();
42  vtkTypeMacro(vtkSegmentationModifier, vtkObject);
43 
44 public:
51  enum
52  {
53  MODE_REPLACE = 0,
56  MODE_MERGE_MASK
57  };
58  static bool ModifyBinaryLabelmap(vtkOrientedImageData* labelmap, vtkSegmentation* segmentation, std::string segmentID,
59  int mergeMode = MODE_REPLACE, const int extent[6] = nullptr, bool minimumOfAllSegments = false, bool masterRepresentationModifiedEnabled = false,
60  const std::vector<std::string> segmentIdsToOverwrite = {}, std::vector<std::string>* modifiedSegmentIDs = nullptr);
61 
68  static bool GetSharedSegmentIDsInMask(vtkSegmentation* segmentation, std::string sharedSegmentID, vtkOrientedImageData* mask, const int extent[6],
69  std::vector<std::string>& segmentIDs, int maskThreshold = 0.0, bool includeInputSharedSegmentID = false);
70 
71 protected:
72  static bool AppendLabelmapToSegment(vtkOrientedImageData* labelmap, vtkSegmentation* segmentation, std::string segmentID, int mergeMode, const int extent[6],
73  bool minimumOfAllSegments, std::vector<std::string>* modifiedSegmentIDs, bool& segmentLabelmapModified);
74 
75  static void ShrinkSegmentToEffectiveExtent(vtkOrientedImageData* segmentLabelmap);
76 
77  static bool SharedLabelmapShouldOverlap(vtkSegmentation* segmentation, std::string segmentID, std::vector<std::string>& segmentIDsToOverwrite);
78 
79  static void SeparateModifiedSegmentFromSharedLabelmap(vtkOrientedImageData* labelmap, vtkSegmentation* segmentation, std::string segmentID,
80  const int extent[6], const std::vector<std::string>& segmentIDsToOverwrite);
81 
88  static void GetExtentIntersection(const int extentA[6], const int extentB[6], int extentIntersection[6]);
89 
92  static bool IsExtentValid(int extent[6]);
93 
94 protected:
96  ~vtkSegmentationModifier() override;
97 
98 private:
100  void operator=(const vtkSegmentationModifier&) = delete;
101 };
102 
103 #endif
Image data containing orientation information.
This class encapsulates a segmentation that can contain multiple segments and multiple representation...
Utility functions for resampling oriented image data.