/// <summary> /// Helper method to serialize a graphic to the supplied serialization state object. /// </summary> /// <param name="graphic">The graphic to serialize.</param> /// <param name="serializationState">The state to which the graphic should be serialized.</param> /// <returns>True if the graphic was serializable; False otherwise.</returns> public static bool SerializeGraphic(IGraphic graphic, GraphicAnnotationSequenceItem serializationState) { Platform.CheckForNullReference(graphic, "graphic"); Platform.CheckForNullReference(serializationState, "serializationState"); object[] attributes = graphic.GetType().GetCustomAttributes(typeof (DicomSerializableGraphicAnnotationAttribute), true); if (attributes.Length > 0) { ((DicomSerializableGraphicAnnotationAttribute) attributes[0]).Serializer.Serialize(graphic, serializationState); return true; } return false; }
public static DicomGraphicAnnotation CreateGraphicAnnotation(Frame frame, GraphicAnnotationSequenceItem sequenceItem, RectangleF displayedArea, bool interactive = false) { ImageSopInstanceReferenceDictionary dictionary = new ImageSopInstanceReferenceDictionary(sequenceItem.ReferencedImageSequence, true); return dictionary.ReferencesFrame(frame.ParentImageSop.SopInstanceUid, frame.FrameNumber) ? DicomGraphicAnnotation.Create(sequenceItem, displayedArea) : null; }
/// <summary> /// Serializes the specified graphic to the supplied serialization state object. /// </summary> /// <param name="graphic">The graphic to serialize.</param> /// <param name="serializationState">The state to which the graphic should be serialized.</param> protected abstract void Serialize(IGraphic graphic, GraphicAnnotationSequenceItem serializationState);