/// <summary> /// Deserializes the specified bitmap display shutter module. /// </summary> /// <remarks> /// This method must be called after <see cref="DeserializeOverlayPlane">the overlay planes have been deserialized</see>. /// </remarks> /// <param name="bitmapDisplayShutterModule"></param> /// <param name="image"></param> protected void DeserializeBitmapDisplayShutter(BitmapDisplayShutterModuleIod bitmapDisplayShutterModule, T image) { if (!_overlayPlanesDeserialized) { throw new InvalidOperationException("Overlay planes must be deserialized first."); } if (bitmapDisplayShutterModule.ShutterShape == ShutterShape.Bitmap) { DicomGraphicsPlane dicomGraphicsPlane = DicomGraphicsPlane.GetDicomGraphicsPlane(image, true); int overlayIndex = bitmapDisplayShutterModule.ShutterOverlayGroupIndex; if (overlayIndex >= 0 && overlayIndex < 16) { IShutterGraphic shutter = null; if (dicomGraphicsPlane.PresentationOverlays.Contains(overlayIndex)) { shutter = dicomGraphicsPlane.PresentationOverlays[overlayIndex]; dicomGraphicsPlane.PresentationOverlays.ActivateAsShutter(overlayIndex); dicomGraphicsPlane.ImageOverlays.Deactivate(overlayIndex); } else if (dicomGraphicsPlane.ImageOverlays.Contains(overlayIndex)) { shutter = dicomGraphicsPlane.ImageOverlays[overlayIndex]; dicomGraphicsPlane.ImageOverlays.ActivateAsShutter(overlayIndex); } // Some day, we will properly deserialize CIELab colours - until then, handle only a specified presentation value if (shutter != null) { shutter.PresentationColor = Color.Empty; shutter.PresentationValue = bitmapDisplayShutterModule.ShutterPresentationValue ?? 0; } } } }
public void Activate(IShutterGraphic shutter) { Platform.CheckTrue(base.Graphics.Contains(shutter), "Shutter must be part of the collection."); foreach (IShutterGraphic graphic in this) { graphic.Visible = (graphic == shutter); } }
protected void DeserializeDisplayShutter(DisplayShutterModuleIod displayShutterModule, T image) { ShutterShape shape = displayShutterModule.ShutterShape; if (shape != ShutterShape.Bitmap && shape != ShutterShape.None) { IShutterGraphic shutter = DicomGraphicsFactory.CreateGeometricShuttersGraphic(displayShutterModule, image.Frame.Rows, image.Frame.Columns); // Some day, we will properly deserialize CIELab colours - until then, leave PresentationColor default black DicomGraphicsPlane dicomGraphicsPlane = DicomGraphicsPlane.GetDicomGraphicsPlane(image, true); dicomGraphicsPlane.Shutters.Add(shutter); dicomGraphicsPlane.Shutters.Activate(shutter); } }
public bool Contains(IShutterGraphic shutter) { return(base.Graphics.Contains(shutter)); }
public int IndexOf(IShutterGraphic shutter) { return(base.Graphics.IndexOf(shutter)); }
public void Insert(int index, IShutterGraphic shutter) { base.Graphics.Insert(0, shutter); shutter.Visible = false; }
public bool Remove(IShutterGraphic shutter) { return(base.Graphics.Remove(shutter)); }
public void Add(IShutterGraphic shutter) { base.Graphics.Add(shutter); shutter.Visible = false; }