示例#1
0
        private void CreateAnAttributeTypeLookup()
        {
            if (GraphicCollection == null || GraphicCollection.Count == 0)
            {
                return;
            }
            var graphic = GraphicCollection.FirstOrDefault();

            UniqueAttributes.Clear();
            foreach (var attribute in graphic.Attributes)
            {
                UniqueAttributes.Add(attribute.Key, attribute.Value == null ? typeof(string) : attribute.Value.GetType());
            }
        }
        /// <summary>
        /// Gets the DICOM graphics plane of the specified DICOM presentation image.
        /// </summary>
        /// <param name="dicomPresentationImage">The target DICOM presentation image.</param>
        /// <param name="createIfNecessary">A value indicating if a DICOM graphics plane should be automatically created and associated with the presentation image.</param>
        /// <returns>The DICOM graphics plane associated with the specified presentation image, or null if one doesn't exist and was not created.</returns>
        public static DicomGraphicsPlane GetDicomGraphicsPlane(IDicomPresentationImage dicomPresentationImage, bool createIfNecessary)
        {
            if (dicomPresentationImage == null)
            {
                return(null);
            }

            GraphicCollection  dicomGraphics      = dicomPresentationImage.DicomGraphics;
            DicomGraphicsPlane dicomGraphicsPlane = dicomGraphics.FirstOrDefault(IsType <DicomGraphicsPlane>) as DicomGraphicsPlane;

            if (dicomGraphicsPlane == null && createIfNecessary)
            {
                dicomGraphics.Add(dicomGraphicsPlane = new DicomGraphicsPlane());
            }

            return(dicomGraphicsPlane);
        }