Beispiel #1
0
        public ContrastBolusAnnotationItemProvider()
            : base("AnnotationItemProviders.Dicom.ContrastBolus", new AnnotationResourceResolver(typeof(ContrastBolusAnnotationItemProvider).Assembly))
        {
            _annotationItems = new List <IAnnotationItem>();

            AnnotationResourceResolver resolver = new AnnotationResourceResolver(this);

            _annotationItems.Add
            (
                new ContrastBolusAgentAnnotationItem
                (
                    "Dicom.ContrastBolus.Agent",
                    resolver,
                    dataSet => CodeSequenceAnnotationItem.FormatCodeSequence(dataSet, DicomTags.ContrastBolusAgentSequence, DicomTags.ContrastBolusAgent),
                    agents => CodeSequenceAnnotationItem.FormatCodeSequence(agents.Select(x => new CodeSequenceMacro(x)))
                )
            );

            // N.B.: The contrast/bolus items defined here are only for those that are defined as part of (enhanced) contrast/bolus module C.7.6.4 and C.7.6.4b
            // Annotation items for contrast/bolus tags in the X-Ray 3D Shared Acquisition macro should be defined separately in the DX or another X-Ray specific provider
        }
        public override string GetAnnotationText(IPresentationImage presentationImage)
        {
            string nullString = SR.ValueNil;

            IImageSopProvider provider = presentationImage as IImageSopProvider;

            if (provider == null)
            {
                return("");
            }

            string laterality = null;

            if (_showLaterality)
            {
                laterality = provider.Frame.Laterality;
            }

            string viewPosition = null;

            if (_showViewPosition)
            {
                viewPosition = provider.Frame.ViewPosition;
                if (string.IsNullOrEmpty(viewPosition))
                {
                    //TODO: later, we could translate to ACR MCQM equivalent, at least for mammo.
                    viewPosition = CodeSequenceAnnotationItem.FormatCodeSequence(provider.Frame, DicomTags.ViewCodeSequence, null);
                }
            }

            string str = "";

            if (_showLaterality && _showViewPosition)
            {
                if (string.IsNullOrEmpty(laterality))
                {
                    laterality = nullString;
                }
                if (string.IsNullOrEmpty(viewPosition))
                {
                    viewPosition = nullString;
                }

                if (laterality == nullString && viewPosition == nullString)
                {
                    str = "";                     // if both parts are null then just show one hyphen (rather than -/-)
                }
                else
                {
                    str = String.Format(SR.FormatLateralityViewPosition, laterality, viewPosition);
                }
            }
            else if (_showLaterality)
            {
                str = laterality;
            }
            else if (_showViewPosition)
            {
                str = viewPosition;
            }

            return(str);
        }