Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitkDICOMSegmentationPropertyHelper.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef mitkDICOMSegmentationPropertyHelper_h
14 #define mitkDICOMSegmentationPropertyHelper_h
15 
16 #include <mitkDICOMTag.h>
17 #include <mitkExceptionMacro.h>
18 #include <mitkLabel.h>
19 #include <mitkLabelSetImage.h>
20 
21 #include <MitkMultilabelExports.h>
22 
23 #include <string>
24 #include <vector>
25 
26 namespace mitk
27 {
28  class IPropertyProvider;
29 
39  {
40  public:
42  };
43 
85  {
86  public:
88  struct MissingItem
89  {
90  enum class Scope
91  {
92  Segmentation,
93  Group,
94  Label
95  };
96 
99  std::string identifier;
100  std::string description;
101  };
102 
105  {
120  bool synthesizeMissingIdentity = false;
121 
130  bool deriveGeometryFromSegmentation = false;
131  };
132 
142  static std::vector<MissingItem> Validate(const MultiLabelSegmentation* seg);
143 
163  static std::vector<MissingItem> Complete(MultiLabelSegmentation* seg,
164  const CompletionOptions& options);
165 
188  const IPropertyProvider* source,
189  bool overwrite = true);
190 
205  const IPropertyProvider* source,
206  bool overwrite = true);
207 
223  const IPropertyProvider* source,
224  bool overwrite = true);
225 
256 
273  static std::string MintSyntheticUID(const std::string& kind);
274 
275  // Placeholder constants used by Complete's synthesis path. Exposed so
276  // tests, downstream tooling, and consumers reading a MITK-written SEG
277  // can distinguish placeholders from real-world data by string match
278  // against one canonical source.
279  static const std::string& UnknownPatientName();
280  static const std::string& UnknownPatientID();
281  static const std::string& UnknownStudyID();
282  static const std::string& UnknownContentCreatorName();
283  };
284 }
285 
286 #endif
#define MITKMULTILABEL_EXPORT
Thrown when a DICOM SEG write is rejected in strict mode because the segmentation is missing contract...
mitkExceptionClassMacro(DICOMSegStrictModeException, mitk::Exception)
Helpers around the DICOM SEG property contract on MultiLabelSegmentation.
static const std::string & UnknownPatientID()
static std::vector< MissingItem > Validate(const MultiLabelSegmentation *seg)
Reports what is missing from the seg's DICOM SEG contract without mutating it.
static std::string MintSyntheticUID(const std::string &kind)
Mint a globally unique DICOM-valid UID for a synthetic identifier.
static std::size_t MigrateLegacyReferenceFilesToRelation(MultiLabelSegmentation *seg)
Migrate a legacy "referenceFiles" StringLookupTable property on seg into SegSourceImageRelationRule c...
static const std::string & UnknownContentCreatorName()
static const std::string & UnknownPatientName()
static void InheritPatientFromSource(MultiLabelSegmentation *seg, const IPropertyProvider *source, bool overwrite=true)
Copies PatientName (0010,0010) and PatientID (0010,0020) from source to seg.
static std::vector< MissingItem > Complete(MultiLabelSegmentation *seg, const CompletionOptions &options)
Stamps MITK-specific branding defaults and applies the opt-in synthesis flags.
static void InheritStudyFromSource(MultiLabelSegmentation *seg, const IPropertyProvider *source, bool overwrite=true)
Copies StudyID (0020,0010) and StudyInstanceUID (0020,000d) from source to seg.
static void InheritFrameOfReferenceFromSource(MultiLabelSegmentation *seg, const IPropertyProvider *source, bool overwrite=true)
Copies FrameOfReferenceUID (0020,0052) from source to seg.
static const std::string & UnknownStudyID()
Base class for all MITK exceptions.
Definition: mitkException.h:53
Interface implemented by classes that provide access to property information.
A data structure describing a label in a multi-label segmentation.
Definition: mitkLabel.h:101
MultiLabelSegmentation class for handling labels and layers in a segmentation session.
Find image slices visible on a given plane.
Synthesis options for Complete. Flags are independent and additive.
One item missing from the DICOM SEG property contract on a seg.