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
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
34class vtkSegmentation;
35
37class vtkSegmentationCore_EXPORT vtkSegmentationModifier : public vtkObject
38{
39public:
41 vtkTypeMacro(vtkSegmentationModifier, vtkObject);
42
43public:
50 enum
51 {
56 };
57 static bool ModifyBinaryLabelmap(vtkOrientedImageData* labelmap, vtkSegmentation* segmentation, std::string segmentID,
58 int mergeMode = MODE_REPLACE, const int extent[6] = nullptr, bool minimumOfAllSegments = false, bool sourceRepresentationModifiedEnabled = false,
59 const std::vector<std::string> segmentIdsToOverwrite = {}, std::vector<std::string>* modifiedSegmentIDs = nullptr);
60
67 static bool GetSharedSegmentIDsInMask(vtkSegmentation* segmentation, std::string sharedSegmentID, vtkOrientedImageData* mask, const int extent[6],
68 std::vector<std::string>& segmentIDs, int maskThreshold = 0.0, bool includeInputSharedSegmentID = false);
69
70protected:
71 static bool AppendLabelmapToSegment(vtkOrientedImageData* labelmap, vtkSegmentation* segmentation, std::string segmentID, int mergeMode, const int extent[6],
72 bool minimumOfAllSegments, std::vector<std::string>* modifiedSegmentIDs, bool& segmentLabelmapModified);
73
75
76 static bool SharedLabelmapShouldOverlap(vtkSegmentation* segmentation, std::string segmentID, std::vector<std::string>& segmentIDsToOverwrite);
77
78 static void SeparateModifiedSegmentFromSharedLabelmap(vtkOrientedImageData* labelmap, vtkSegmentation* segmentation, std::string segmentID,
79 const int extent[6], const std::vector<std::string>& segmentIDsToOverwrite);
80
87 static void GetExtentIntersection(const int extentA[6], const int extentB[6], int extentIntersection[6]);
88
91 static bool IsExtentValid(int extent[6]);
92
93protected:
96
97private:
99 void operator=(const vtkSegmentationModifier&) = delete;
100};
101
102#endif
Image data containing orientation information.
~vtkSegmentationModifier() override
static void GetExtentIntersection(const int extentA[6], const int extentB[6], int extentIntersection[6])
static vtkSegmentationModifier * New()
static void SeparateModifiedSegmentFromSharedLabelmap(vtkOrientedImageData *labelmap, vtkSegmentation *segmentation, std::string segmentID, const int extent[6], const std::vector< std::string > &segmentIDsToOverwrite)
static bool AppendLabelmapToSegment(vtkOrientedImageData *labelmap, vtkSegmentation *segmentation, std::string segmentID, int mergeMode, const int extent[6], bool minimumOfAllSegments, std::vector< std::string > *modifiedSegmentIDs, bool &segmentLabelmapModified)
static bool SharedLabelmapShouldOverlap(vtkSegmentation *segmentation, std::string segmentID, std::vector< std::string > &segmentIDsToOverwrite)
static bool GetSharedSegmentIDsInMask(vtkSegmentation *segmentation, std::string sharedSegmentID, vtkOrientedImageData *mask, const int extent[6], std::vector< std::string > &segmentIDs, int maskThreshold=0.0, bool includeInputSharedSegmentID=false)
static bool ModifyBinaryLabelmap(vtkOrientedImageData *labelmap, vtkSegmentation *segmentation, std::string segmentID, int mergeMode=MODE_REPLACE, const int extent[6]=nullptr, bool minimumOfAllSegments=false, bool sourceRepresentationModifiedEnabled=false, const std::vector< std::string > segmentIdsToOverwrite={}, std::vector< std::string > *modifiedSegmentIDs=nullptr)
static bool IsExtentValid(int extent[6])
static void ShrinkSegmentToEffectiveExtent(vtkOrientedImageData *segmentLabelmap)
This class encapsulates a segmentation that can contain multiple segments and multiple representation...