MCPcopy Create free account
hub / github.com/MITK/MITK / Complete

Method Complete

Modules/Multilabel/src/mitkDICOMSegmentationPropertyHelper.cpp:248–319  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

246}
247
248std::vector<mitk::DICOMSegmentationPropertyHelper::MissingItem>
249mitk::DICOMSegmentationPropertyHelper::Complete(MultiLabelSegmentation* seg,
250 const CompletionOptions& options)
251{
252 if (seg == nullptr)
253 mitkThrow() << "DICOMSegmentationPropertyHelper::Complete: seg must not be nullptr.";
254
255 // Class invariants: Modality is fixed by the type, and the remaining
256 // textuals are MITK branding that survive a later synthesis call
257 // because every write is fill-only-if-missing. Identifying tags
258 // (PatientName, PatientID, StudyID, ...) are deliberately NOT stamped
259 // here so Initialize(templateImage) and InheritXxxFromSource can adopt
260 // them from a real source.
261 SetIfMissing(seg, DICOMTagKey(0x0008, 0x0060),
262 TemporoSpatialStringProperty::New("SEG"));
263 SetIfMissing(seg, DICOMTagKey(0x0008, 0x103E),
264 TemporoSpatialStringProperty::New("MITK Segmentation"));
265 SetIfMissing(seg, DICOMTagKey(0x0070, 0x0084),
266 TemporoSpatialStringProperty::New("MITK"));
267
268 // SeriesInstanceUID is the seg's own identity, never inherited from a
269 // source image (the source's series UID belongs to the source). Mint
270 // at construction so every seg carries a stable (0020,000E) from New()
271 // onward, and strict-mode writes work without opting into synthetic
272 // mode. Stability across the copy ctor holds: BaseData's copy ctor
273 // clones the property list first, then Complete(this, {}) hits
274 // SetIfMissing and no-ops on the cloned property.
275 SetIfMissing(seg, DICOMTagKey(0x0020, 0x000E),
276 TemporoSpatialStringProperty::New(DICOMSegmentationPropertyHelper::MintSyntheticUID("series")));
277
278 if (options.synthesizeMissingIdentity)
279 {
280 SetIfMissing(seg, DICOMTagKey(0x0010, 0x0010),
281 TemporoSpatialStringProperty::New(UnknownPatientName()));
282 SetIfMissing(seg, DICOMTagKey(0x0010, 0x0020),
283 TemporoSpatialStringProperty::New(UnknownPatientID()));
284 SetIfMissing(seg, DICOMTagKey(0x0020, 0x0010),
285 TemporoSpatialStringProperty::New(UnknownStudyID()));
286 SetIfMissing(seg, DICOMTagKey(0x0070, 0x0084),
287 TemporoSpatialStringProperty::New(UnknownContentCreatorName()));
288
289 SetIfMissing(seg, DICOMTagKey(0x0020, 0x000D),
290 TemporoSpatialStringProperty::New(DICOMSegmentationPropertyHelper::MintSyntheticUID("study")));
291 SetIfMissing(seg, DICOMTagKey(0x0020, 0x0052),
292 TemporoSpatialStringProperty::New(DICOMSegmentationPropertyHelper::MintSyntheticUID("for")));
293 }
294
295 if (options.deriveGeometryFromSegmentation)
296 {
297 // The seg's own per-frame geometry stands in for the absent source's
298 // frame of reference. When synthesizeMissingIdentity also runs, the
299 // earlier block already minted (0020,0052); SetIfMissing makes this a
300 // no-op then. The block is kept so callers can derive a FoR without
301 // committing to the full identity-placeholder set.
302 SetIfMissing(seg, DICOMTagKey(0x0020, 0x0052),
303 TemporoSpatialStringProperty::New(DICOMSegmentationPropertyHelper::MintSyntheticUID("for")));
304 }
305

Callers

nothing calls this directly

Calls 7

SetIfMissingFunction · 0.85
DICOMTagKeyFunction · 0.85
GetLabelsMethod · 0.80
SetAlgorithmTypeMethod · 0.80
NewFunction · 0.50
GetValueMethod · 0.45
GetAlgorithmTypeMethod · 0.45

Tested by

no test coverage detected