private static DicomSequenceItem[] UpdateSourceImageSequence(IDicomAttributeProvider baseSop, IEnumerable<IDicomAttributeProvider> overlaySops) { var baseItem = new SourceImageSequence { ReferencedSopInstanceUid = baseSop[DicomTags.SopInstanceUid].ToString(), ReferencedSopClassUid = baseSop[DicomTags.SopClassUid].ToString(), SpatialLocationsPreserved = SpatialLocationsPreserved.Yes, PurposeOfReferenceCodeSequence = SourceImagePurposesOfReferenceContextGroup.SourceImageForImageProcessingOperation }; var maskItems = overlaySops != null ? overlaySops.GroupBy(s => s[DicomTags.SopInstanceUid].ToString()) .Select(s => s.First()) .Select(s => new SourceImageSequence { ReferencedSopInstanceUid = s[DicomTags.SopInstanceUid].ToString(), ReferencedSopClassUid = s[DicomTags.SopClassUid].ToString(), SpatialLocationsPreserved = SpatialLocationsPreserved.Yes, PurposeOfReferenceCodeSequence = SourceImagePurposesOfReferenceContextGroup.SourceImageForImageProcessingOperation }) : Enumerable.Empty<SourceImageSequence>(); return new[] {baseItem}.Concat(maskItems).Select(s => s.DicomSequenceItem).ToArray(); }
/// <summary> /// Creates a single instance of a SourceImageSequence item. Does not modify the SourceImageSequence in the underlying collection. /// </summary> public SourceImageSequence CreateSourceImageSequence() { var iodBase = new SourceImageSequence(new DicomSequenceItem()); return iodBase; }