internal static IDicomGraphicsPlaneShutters GetShuttersGraphic(IDicomPresentationImage image, bool createAsNecessary = false) { DicomGraphicsPlane dicomGraphicsPlane = DicomGraphicsPlane.GetDicomGraphicsPlane(image, createAsNecessary); if (dicomGraphicsPlane != null) { return(dicomGraphicsPlane.Shutters); } return(null); }
internal static IDicomGraphicsPlaneShutters GetShuttersGraphic(IDicomPresentationImage image) { DicomGraphicsPlane dicomGraphicsPlane = DicomGraphicsPlane.GetDicomGraphicsPlane(image, false); if (dicomGraphicsPlane != null) { return(dicomGraphicsPlane.Shutters); } return(null); }
protected override void UpdateVisibility(IPresentationImage image, bool visible) { if (image is IDicomPresentationImage) { DicomGraphicsPlane dicomGraphics = DicomGraphicsPlane.GetDicomGraphicsPlane(image as IDicomPresentationImage, false); if (dicomGraphics != null) { dicomGraphics.Shutters.Enabled = Checked; } } }
private void UpdateEnabled(IPresentationImage image) { bool enabled = false; if (image != null && image is IDicomPresentationImage) { DicomGraphicsPlane dicomGraphicsPlane = DicomGraphicsPlane.GetDicomGraphicsPlane(image as IDicomPresentationImage, false); enabled = dicomGraphicsPlane == null || dicomGraphicsPlane.Shutters.Enabled; } this.Enabled = enabled; }
internal static GeometricShuttersGraphic GetGeometricShuttersGraphic(IDicomPresentationImage image) { DicomGraphicsPlane dicomGraphicsPlane = DicomGraphicsPlane.GetDicomGraphicsPlane(image, false); if (dicomGraphicsPlane == null) { return(null); } return(CollectionUtils.SelectFirst(dicomGraphicsPlane.Shutters, delegate(IShutterGraphic shutter) { return shutter is GeometricShuttersGraphic; }) as GeometricShuttersGraphic); }
private static IEnumerable <OverlayPlaneGraphic> GetOverlayPlanesGraphic(IDicomPresentationImage image) { DicomGraphicsPlane dicomGraphicsPlane = DicomGraphicsPlane.GetDicomGraphicsPlane(image, false); if (dicomGraphicsPlane != null) { foreach (ILayer layer in (IEnumerable <ILayer>)dicomGraphicsPlane.Layers) { foreach (OverlayPlaneGraphic overlayGraphic in CollectionUtils.Select(layer.Graphics, delegate(IGraphic graphic) { return(graphic is OverlayPlaneGraphic); })) { yield return(overlayGraphic); } } } }
public override void SetOverlayVisible(IPresentationImage image, bool visible) { var dicomPresentationImage = image as IDicomPresentationImage; if (dicomPresentationImage == null) { return; } DicomGraphicsPlane dicomGraphicsPlane = DicomGraphicsPlane.GetDicomGraphicsPlane(dicomPresentationImage, true); if (dicomGraphicsPlane != null) { dicomGraphicsPlane.Layers.Enabled = visible; } }
internal static GeometricShuttersGraphic GetGeometricShuttersGraphic(IDicomPresentationImage image, bool createAsNecessary = false) { DicomGraphicsPlane dicomGraphicsPlane = DicomGraphicsPlane.GetDicomGraphicsPlane(image, createAsNecessary); if (dicomGraphicsPlane == null) { return(null); } var geometricShuttersGraphic = (GeometricShuttersGraphic)CollectionUtils.SelectFirst(dicomGraphicsPlane.Shutters, shutter => shutter is GeometricShuttersGraphic); if (createAsNecessary && geometricShuttersGraphic == null) { dicomGraphicsPlane.Shutters.Add(geometricShuttersGraphic = new GeometricShuttersGraphic(image.Frame.Rows, image.Frame.Columns)); dicomGraphicsPlane.Shutters.Activate(geometricShuttersGraphic); } return(geometricShuttersGraphic); }
private static void IdentifyPresentationImageFrames(IPresentationImage image, out int imageFrameNumber, out int?overlayFrameNumber) { var overlayColor = Color.Red; var imageColor = Color.White; // force the overlays to show in our chosen colour PresentationState.DicomDefault.Deserialize(image); var dps = DicomGraphicsPlane.GetDicomGraphicsPlane((IDicomPresentationImage)image, true); foreach (var overlay in dps.ImageOverlays) { overlay.Color = overlayColor; } var sopProvider = (IImageSopProvider)image; using (var dump = image.DrawToBitmap(sopProvider.Frame.Columns, sopProvider.Frame.Rows)) { // identify the frame number encoded in the image imageFrameNumber = 0; imageFrameNumber += AreEqual(Sample(dump, 95, 205, 8, 8), imageColor) ? 0x10 : 0; imageFrameNumber += AreEqual(Sample(dump, 113, 205, 8, 8), imageColor) ? 0x08 : 0; imageFrameNumber += AreEqual(Sample(dump, 130, 205, 8, 8), imageColor) ? 0x04 : 0; imageFrameNumber += AreEqual(Sample(dump, 148, 205, 8, 8), imageColor) ? 0x02 : 0; imageFrameNumber += AreEqual(Sample(dump, 166, 205, 8, 8), imageColor) ? 0x01 : 0; // check if overlay positioning blocks are in the right place if (!AreEqual(Sample(dump, 187, 73, 8, 8), overlayColor) || !AreEqual(Sample(dump, 74, 182, 8, 8), overlayColor)) { overlayFrameNumber = null; return; } // identify the frame number encoded in the overlay overlayFrameNumber = 0; overlayFrameNumber += AreEqual(Sample(dump, 95, 182, 8, 8), overlayColor) ? 0x10 : 0; overlayFrameNumber += AreEqual(Sample(dump, 113, 182, 8, 8), overlayColor) ? 0x08 : 0; overlayFrameNumber += AreEqual(Sample(dump, 130, 182, 8, 8), overlayColor) ? 0x04 : 0; overlayFrameNumber += AreEqual(Sample(dump, 148, 182, 8, 8), overlayColor) ? 0x02 : 0; overlayFrameNumber += AreEqual(Sample(dump, 166, 182, 8, 8), overlayColor) ? 0x01 : 0; } }
public UserOverlaysCollection(DicomGraphicsPlane owner) { _owner = owner; _overlays = new List<OverlayPlaneGraphic>(); }