Ejemplo n.º 1
0
        public DXImageAnnotationItemProvider()
            : base("AnnotationItemProviders.Dicom.DXImage", new AnnotationResourceResolver(typeof(DXImageAnnotationItemProvider).Assembly))
        {
            _annotationItems = new List <IAnnotationItem>();
            _frameContext    = new AnnotationDataSourceContext <Frame>();
            _frameContext.DataSourceChanged += OnFrameContextDataSourceChanged;

            AnnotationResourceResolver resolver = new AnnotationResourceResolver(this);

            _annotationItems.Add
            (
                new DicomAnnotationItem <string>
                (
                    // this is actually DX Positioning module
                    "Dicom.DXImage.DetectorPrimaryAngle",
                    resolver,
                    f => FormatFloat64(f, DicomTags.DetectorPrimaryAngle, SR.FormatDegrees),
                    DicomDataFormatHelper.RawStringFormat
                )
            );

            _annotationItems.Add
            (
                new DicomAnnotationItem <string>
                (
                    // this is actually DX Positioning module
                    "Dicom.DXImage.PositionerPrimaryAngle",
                    resolver,
                    f => FormatFloat64(f, DicomTags.PositionerPrimaryAngle, SR.FormatDegrees),
                    DicomDataFormatHelper.RawStringFormat
                )
            );

            _annotationItems.Add
            (
                new DicomAnnotationItem <string>
                (
                    // this is actually DX Positioning module
                    "Dicom.DXImage.PositionerSecondaryAngle",
                    resolver,
                    f => FormatFloat64(f, DicomTags.PositionerSecondaryAngle, SR.FormatDegrees),
                    DicomDataFormatHelper.RawStringFormat
                )
            );

            _annotationItems.Add
            (
                new DicomAnnotationItem <string>
                (
                    // this is actually DX Positioning or X-Ray 3D Acquisition module
                    "Dicom.DXImage.BodyPartThickness",
                    resolver,
                    f =>
            {
                var acquisitions = _frameContext.GetData <IXRay3DAcquisitionSequenceItem[]>(f, _keyAcquisitionSequence);
                var dataset      = acquisitions != null ? (IEnumerable <IDicomAttributeProvider>)acquisitions.Select(a => a.DicomSequenceItem) : new IDicomAttributeProvider[] { f };
                return(string.Format(SR.FormatMillimeters, FormatMultiValues(dataset, FormatFloat64, DicomTags.BodyPartThickness, "{0:F1}")));
            },
                    DicomDataFormatHelper.RawStringFormat
                )
            );

            _annotationItems.Add
            (
                new DicomAnnotationItem <string>
                (
                    // this is actually DX Positioning module
                    "Dicom.DXImage.CompressionForce",
                    resolver,
                    f =>
            {
                var acquisitions = _frameContext.GetData <IXRay3DAcquisitionSequenceItem[]>(f, _keyAcquisitionSequence);
                var dataset      = acquisitions != null ? (IEnumerable <IDicomAttributeProvider>)acquisitions.Select(a => a.DicomSequenceItem) : new IDicomAttributeProvider[] { f };
                return(FormatMultiValues(dataset, FormatFloat64, DicomTags.CompressionForce, SR.FormatNewtons));
            },
                    DicomDataFormatHelper.RawStringFormat
                )
            );

            _annotationItems.Add
            (
                new DicomAnnotationItem <string>
                (
                    // this is actually DX Series module
                    "Dicom.DXImage.PresentationIntentType",
                    resolver,
                    f => f[DicomTags.PresentationIntentType].ToString(),
                    DicomDataFormatHelper.RawStringFormat
                )
            );

            _annotationItems.Add
            (
                new DicomAnnotationItem <string>
                (
                    // whoa, this is actually DX Image module
                    "Dicom.DXImage.AcquisitionDeviceProcessingDescription",
                    resolver,
                    f => f[DicomTags.AcquisitionDeviceProcessingDescription].ToString(),
                    DicomDataFormatHelper.RawStringFormat
                )
            );

            _annotationItems.Add
            (
                new DicomAnnotationItem <string>
                (
                    // this is actually DX Detector module
                    "Dicom.DXImage.CassetteId",
                    resolver,
                    f => f[DicomTags.CassetteId].ToString(),
                    DicomDataFormatHelper.RawStringFormat
                )
            );

            _annotationItems.Add
            (
                new DicomAnnotationItem <string>
                (
                    // this is actually DX Detector module
                    "Dicom.DXImage.PlateId",
                    resolver,
                    f => f[DicomTags.PlateId].ToString(),
                    DicomDataFormatHelper.RawStringFormat
                )
            );

            _annotationItems.Add
            (
                new DicomAnnotationItem <string>
                (
                    // this isn't even a DX module, but other X-Ray related modules
                    "Dicom.DXImage.KVP",
                    resolver,
                    f =>
            {
                var acquisitions = _frameContext.GetData <IXRay3DAcquisitionSequenceItem[]>(f, _keyAcquisitionSequence);
                var dataset      = acquisitions != null ? (IEnumerable <IDicomAttributeProvider>)acquisitions.Select(a => a.DicomSequenceItem) : new IDicomAttributeProvider[] { f };
                return(FormatMultiValues(dataset, FormatFloat64, DicomTags.Kvp, SR.FormatKilovolts));
            },
                    DicomDataFormatHelper.RawStringFormat
                )
            );

            _annotationItems.Add
            (
                new DicomAnnotationItem <string>
                (
                    // this isn't even a DX module, but other X-Ray related modules
                    "Dicom.DXImage.AveragePulseWidth",
                    resolver,
                    f => FormatFloat64(f, DicomTags.AveragePulseWidth, SR.FormatMilliseconds),
                    DicomDataFormatHelper.RawStringFormat
                )
            );

            _annotationItems.Add
            (
                new DicomAnnotationItem <string>
                (
                    // this isn't even a DX module, but other X-Ray related modules
                    "Dicom.DXImage.ImageAndFluoroscopyAreaDoseProduct",
                    resolver,
                    f => FormatFloat64(f, DicomTags.ImageAndFluoroscopyAreaDoseProduct, SR.FormatDecigraySquareCentimeters),
                    DicomDataFormatHelper.RawStringFormat
                )
            );

            _annotationItems.Add
            (
                new DicomAnnotationItem <string>
                (
                    // legacy item (new layouts should use Exposure) so that current annotation layouts don't break - can be removed in a future release
                    "Dicom.DXImage.ExposureInMas",
                    resolver,
                    f =>
            {
                var acquisitions = _frameContext.GetData <IXRay3DAcquisitionSequenceItem[]>(f, _keyAcquisitionSequence);
                var dataset      = acquisitions != null ? (IEnumerable <IDicomAttributeProvider>)acquisitions.Select(a => a.DicomSequenceItem) : new IDicomAttributeProvider[] { f };
                return(FormatMultiValues(dataset, GetExposureInMas, SR.FormatMilliampSeconds));
            },
                    DicomDataFormatHelper.RawStringFormat
                )
            );

            _annotationItems.Add
            (
                new DicomAnnotationItem <string>
                (
                    // this isn't defined in a DX module, but rather in other X-Ray related modules
                    "Dicom.DXImage.Exposure",
                    resolver,
                    f =>
            {
                var acquisitions = _frameContext.GetData <IXRay3DAcquisitionSequenceItem[]>(f, _keyAcquisitionSequence);
                var dataset      = acquisitions != null ? (IEnumerable <IDicomAttributeProvider>)acquisitions.Select(a => a.DicomSequenceItem) : new IDicomAttributeProvider[] { f };
                return(FormatMultiValues(dataset, GetExposureInMas, SR.FormatMilliampSeconds));
            },
                    DicomDataFormatHelper.RawStringFormat
                )
            );

            _annotationItems.Add
            (
                new DicomAnnotationItem <string>
                (
                    // this isn't defined in a DX module, but rather in other X-Ray related modules
                    "Dicom.DXImage.ExposureTime",
                    resolver,
                    f =>
            {
                var acquisitions = _frameContext.GetData <IXRay3DAcquisitionSequenceItem[]>(f, _keyAcquisitionSequence);
                var dataset      = acquisitions != null ? (IEnumerable <IDicomAttributeProvider>)acquisitions.Select(a => a.DicomSequenceItem) : new IDicomAttributeProvider[] { f };
                return(FormatMultiValues(dataset, GetExposureTimeInMs, SR.FormatMilliseconds));
            },
                    DicomDataFormatHelper.RawStringFormat
                )
            );

            _annotationItems.Add
            (
                new DicomAnnotationItem <string>
                (
                    // this isn't defined in a DX module, but rather in other X-Ray related modules
                    "Dicom.DXImage.XRayTubeCurrent",
                    resolver,
                    f =>
            {
                var acquisitions = _frameContext.GetData <IXRay3DAcquisitionSequenceItem[]>(f, _keyAcquisitionSequence);
                var dataset      = acquisitions != null ? (IEnumerable <IDicomAttributeProvider>)acquisitions.Select(a => a.DicomSequenceItem) : new IDicomAttributeProvider[] { f };
                return(FormatMultiValues(dataset, GetXRayTubeCurrentInMa, SR.FormatMilliamps));
            },
                    DicomDataFormatHelper.RawStringFormat
                )
            );

            _annotationItems.Add
            (
                new DicomAnnotationItem <string>
                (
                    // this isn't even a DX module, but other X-Ray related modules
                    "Dicom.DXImage.FilterMaterial",
                    resolver,
                    f =>
            {
                var acquisitions = _frameContext.GetData <IXRay3DAcquisitionSequenceItem[]>(f, _keyAcquisitionSequence);
                var dataset      = acquisitions != null ? (IEnumerable <IDicomAttributeProvider>)acquisitions.Select(a => a.DicomSequenceItem) : new IDicomAttributeProvider[] { f };
                return(FormatMultiValues(dataset, FormatString, DicomTags.FilterMaterial, null));
            },
                    DicomDataFormatHelper.RawStringFormat
                )
            );

            _annotationItems.Add
            (
                new CodeSequenceAnnotationItem
                (
                    // definition of the contrast/bolus agent item takes into account the X-Ray 3D Acquisition sequence, and is thus separate from the normal contast/bolus modules
                    "Dicom.DXImage.ContrastBolusAgent",
                    resolver,
                    DicomTags.ContrastBolusAgentSequence,
                    DicomTags.ContrastBolusAgent,
                    dataSourceGetter: f =>
            {
                var acquisitions = _frameContext.GetData <IXRay3DAcquisitionSequenceItem[]>(f, _keyAcquisitionSequence);
                return(acquisitions != null ? (IDicomAttributeProvider)acquisitions.Select(d => d.DicomSequenceItem).FirstOrDefault() : f);
            }
                )
            );
        }
Ejemplo n.º 2
0
 internal AnnotationDataSourceContextEventArgs(AnnotationDataSourceContext <TSource> owner)
 {
     _owner      = owner;
     _dataSource = owner.DataSource;
 }