/// <summary> /// Creates zero or more <see cref="IDisplaySet"/>s from the given <see cref="Series"/>. /// </summary> /// <remarks>When the input series does not contain a mixture of single and multiframe /// images, no <see cref="IDisplaySet"/>s will be returned.</remarks> public override List <IDisplaySet> CreateDisplaySets(Series series) { List <IDisplaySet> displaySets = new List <IDisplaySet>(); List <ImageSop> singleFrames = new List <ImageSop>(); List <ImageSop> multiFrames = new List <ImageSop>(); foreach (Sop sop in series.Sops) { if (sop.IsImage) { ImageSop imageSop = (ImageSop)sop; if (imageSop.NumberOfFrames > 1) { multiFrames.Add(imageSop); } else { singleFrames.Add(imageSop); } } } if (multiFrames.Count > 1 || (singleFrames.Count > 0 && multiFrames.Count > 0)) { if (singleFrames.Count > 0) { List <IPresentationImage> singleFrameImages = new List <IPresentationImage>(); foreach (ImageSop singleFrame in singleFrames) { singleFrameImages.AddRange(PresentationImageFactory.CreateImages(singleFrame)); } if (singleFrameImages.Count > 0) { var descriptor = new SingleImagesDisplaySetDescriptor(series.GetIdentifier(), PresentationImageFactory); var singleImagesDisplaySet = new DisplaySet(descriptor); foreach (IPresentationImage singleFrameImage in singleFrameImages) { singleImagesDisplaySet.PresentationImages.Add(singleFrameImage); } singleImagesDisplaySet.PresentationImages.Sort(); displaySets.Add(singleImagesDisplaySet); } } foreach (ImageSop multiFrame in multiFrames) { List <IPresentationImage> multiFrameImages = PresentationImageFactory.CreateImages(multiFrame); if (multiFrameImages.Count > 0) { MultiframeDisplaySetDescriptor descriptor = new MultiframeDisplaySetDescriptor(multiFrame.ParentSeries.GetIdentifier(), multiFrame.SopInstanceUid, multiFrame.InstanceNumber); DisplaySet displaySet = new DisplaySet(descriptor); foreach (IPresentationImage multiFrameImage in multiFrameImages) { displaySet.PresentationImages.Add(multiFrameImage); } displaySet.PresentationImages.Sort(); displaySets.Add(displaySet); } } } return(displaySets); }
protected SingleImagesDisplaySetDescriptor(SingleImagesDisplaySetDescriptor source, ICloningContext context) : base(source, context) { context.CloneFields(source, this); }