public void ActivateAsLayer(int index, string layerId) { OverlayPlaneGraphic overlay = _overlays[index]; if (overlay != null) { if (overlay.ParentGraphic is ShutterCollection) { ShutterCollection shutterCollection = (ShutterCollection)overlay.ParentGraphic; shutterCollection.Deactivate(overlay); shutterCollection.Graphics.Remove(overlay); } ILayer layer = _owner.Layers[layerId]; if (overlay.ParentGraphic is CompositeGraphic && overlay.ParentGraphic != layer) { ((CompositeGraphic)overlay.ParentGraphic).Graphics.Remove(overlay); } if (overlay.ParentGraphic == null) { layer.Graphics.Add(overlay); } overlay.Visible = true; } }
public string GetLayer(OverlayPlaneGraphic overlay) { Platform.CheckForNullReference(overlay, "overlay"); Platform.CheckTrue(_overlays.Contains(overlay), "Overlay must be part of collection."); if (overlay.ParentGraphic is ILayer && overlay.ParentGraphic.ParentGraphic == _owner.Layers) { return(((ILayer)overlay.ParentGraphic).Id); } return(null); }
public void Add(OverlayPlaneGraphic overlay) { Platform.CheckForNullReference(overlay, "overlay"); Platform.CheckTrue(CanAdd(overlay), "Overlay is already part of a different collection."); if (overlay.ParentGraphic == null) { _owner.Layers.InactiveLayer.Graphics.Add(overlay); } _overlays.Add(overlay); }
public void Deactivate(int index) { OverlayPlaneGraphic overlay = _overlays[index]; if (overlay != null) { if (overlay.ParentGraphic == _owner.Shutters) { _owner.Shutters.Deactivate(overlay); } if (overlay.ParentGraphic is LayerGraphic && _owner._layers.Graphics.Contains(overlay.ParentGraphic)) { ActivateAsLayer(index, string.Empty); } } }
public void Deactivate(int index) { Platform.CheckArgumentRange(index, 0, 15, "index"); OverlayPlaneGraphic overlay = _overlays[index]; if (overlay != null) { if (overlay.ParentGraphic == _owner.Shutters) { _owner.Shutters.Deactivate(overlay); } if (overlay.ParentGraphic is LayerGraphic && _owner._layers.Graphics.Contains(overlay.ParentGraphic)) { this.ActivateAsLayer(index, string.Empty); } } }
protected void SerializeBitmapDisplayShutter(BitmapDisplayShutterModuleIod bitmapDisplayShutterModule, IOverlayMapping overlayMapping, DicomPresentationImageCollection <T> images) { // Doesn't support multiframe or whatever case it is when we get more than one image serialized to one state for (int n = 0; n < 16; n++) { OverlayPlaneGraphic overlay = overlayMapping[n]; if (overlay != null) { if (overlay.ParentGraphic is IDicomGraphicsPlaneShutters) { bitmapDisplayShutterModule.ShutterShape = ShutterShape.Bitmap; bitmapDisplayShutterModule.ShutterOverlayGroupIndex = n; bitmapDisplayShutterModule.ShutterPresentationValue = overlay.GrayPresentationValue; bitmapDisplayShutterModule.ShutterPresentationColorCielabValue = null; break; // there can only be one } } } }
protected void SerializeOverlayActivation(OverlayActivationModuleIod overlayActivationModule, IOverlayMapping overlayMapping, DicomPresentationImageCollection <T> images) { // Doesn't support multiframe or whatever case it is when we get more than one image serialized to one state for (int n = 0; n < 16; n++) { OverlayPlaneGraphic overlay = overlayMapping[n]; if (overlay != null) { if (overlay.ParentGraphic is ILayer) { overlayActivationModule[n].OverlayActivationLayer = ((ILayer)overlay.ParentGraphic).Id; } else { overlayActivationModule.Delete(n); } } } }
public void ActivateAsShutter(int index) { OverlayPlaneGraphic overlay = _overlays[index]; if (overlay != null) { if (overlay.ParentGraphic is CompositeGraphic && overlay.ParentGraphic != _owner.Shutters) { ((CompositeGraphic)overlay.ParentGraphic).Graphics.Remove(overlay); } if (overlay.ParentGraphic == null) { _owner.Shutters.Add(overlay); } _owner.Shutters.Activate(overlay); } else { _owner.Shutters.DeactivateAll(); } }
private bool CanAdd(OverlayPlaneGraphic overlay) { if (overlay.ParentGraphic == null) { // The overlay has no current parent return(true); } if (overlay.ParentGraphic is LayerGraphic) { // The owning DicomGraphicsPlane should be the parent of the LayerCollection that is the parent of the LayerGraphic return(overlay.ParentGraphic.ParentGraphic is LayerCollection && overlay.ParentGraphic.ParentGraphic.ParentGraphic == _owner); } if (overlay.ParentGraphic is ShutterCollection) { // The owning DicomGraphicsPlane should be the parent of the ShutterCollection that is the parent of the overlay return(overlay.ParentGraphic.ParentGraphic == _owner); } return(false); }
public bool IsShutter(OverlayPlaneGraphic overlay) { Platform.CheckForNullReference(overlay, "overlay"); Platform.CheckTrue(_overlays.Contains(overlay), "Overlay must be part of collection."); return (overlay.ParentGraphic == _owner.Shutters); }
public bool IsLayer(OverlayPlaneGraphic overlay) { return(!string.IsNullOrEmpty(GetLayer(overlay))); }
public bool IsShutter(OverlayPlaneGraphic overlay) { Platform.CheckForNullReference(overlay, "overlay"); Platform.CheckTrue(_overlays.Contains(overlay), "Overlay must be part of collection."); return(overlay.ParentGraphic == _owner.Shutters); }
public void Remove(OverlayPlaneGraphic overlay) { Platform.CheckForNullReference(overlay, "overlay"); Platform.CheckTrue(_overlays.Contains(overlay), "Overlay must be part of collection."); _overlays.Remove(overlay); }
public string GetLayer(OverlayPlaneGraphic overlay) { Platform.CheckForNullReference(overlay, "overlay"); Platform.CheckTrue(_overlays.Contains(overlay), "Overlay must be part of collection."); if (overlay.ParentGraphic is ILayer && overlay.ParentGraphic.ParentGraphic == _owner.Layers) return ((ILayer) overlay.ParentGraphic).Id; return null; }
public void Remove(OverlayPlaneGraphic overlay) { Platform.CheckForNullReference(overlay, "overlay"); Platform.CheckTrue(_overlays[overlay.Index] == overlay, "Overlay must be part of collection."); _overlays[overlay.Index] = null; }
public void ActivateAsShutter(OverlayPlaneGraphic overlay) { Platform.CheckForNullReference(overlay, "overlay"); Platform.CheckTrue(_overlays[overlay.Index] == overlay, "Overlay must be part of collection."); ActivateAsShutter(overlay.Index); }
public void Deactivate(OverlayPlaneGraphic overlay) { Platform.CheckForNullReference(overlay, "overlay"); Platform.CheckTrue(_overlays.Contains(overlay), "Overlay must be part of collection."); Deactivate(_overlays.IndexOf(overlay)); }
public void ActivateAsLayer(OverlayPlaneGraphic overlay, string layerId) { Platform.CheckForNullReference(overlay, "overlay"); Platform.CheckTrue(_overlays.Contains(overlay), "Overlay must be part of collection."); ActivateAsLayer(_overlays.IndexOf(overlay), layerId); }
private bool CanAdd(OverlayPlaneGraphic overlay) { if (overlay.ParentGraphic == null) // The overlay has no current parent return true; if (overlay.ParentGraphic is LayerGraphic) // The owning DicomGraphicsPlane should be the parent of the LayerCollection that is the parent of the LayerGraphic return (overlay.ParentGraphic.ParentGraphic is LayerCollection && overlay.ParentGraphic.ParentGraphic.ParentGraphic == _owner); if (overlay.ParentGraphic is ShutterCollection) // The owning DicomGraphicsPlane should be the parent of the ShutterCollection that is the parent of the overlay return (overlay.ParentGraphic.ParentGraphic == _owner); return false; }
public bool Contains(OverlayPlaneGraphic overlay) { Platform.CheckForNullReference(overlay, "overlay"); return _overlays.Contains(overlay); }
public void ActivateAsShutter(OverlayPlaneGraphic overlay) { Platform.CheckForNullReference(overlay, "overlay"); Platform.CheckTrue(_overlays.Contains(overlay), "Overlay must be part of collection."); ActivateAsShutter(_overlays.IndexOf(overlay)); }
/// <summary> /// Cloning constructor. /// </summary> private ErrorOverlayPlaneGraphic(OverlayPlaneGraphic source, ICloningContext context) : base(source, context) {}
/// <summary> /// Cloning constructor. /// </summary> private ErrorOverlayPlaneGraphic(OverlayPlaneGraphic source, ICloningContext context) : base(source, context) { }
public bool IsLayer(OverlayPlaneGraphic overlay) { return !string.IsNullOrEmpty(GetLayer(overlay)); }
protected void SerializeOverlayPlane(OverlayPlaneModuleIod overlayPlaneModule, out IOverlayMapping overlayMapping, DicomPresentationImageCollection <T> images) { // Doesn't support multiframe or whatever case it is when we get more than one image serialized to one state List <OverlayPlaneGraphic> visibleOverlays = new List <OverlayPlaneGraphic>(); foreach (T image in images) { DicomGraphicsPlane dicomGraphics = DicomGraphicsPlane.GetDicomGraphicsPlane(image, false); if (dicomGraphics != null) { // identify visible bitmap shutter if exists OverlayPlaneGraphic bitmapShutter = dicomGraphics.Shutters.ActiveShutter as OverlayPlaneGraphic; if (bitmapShutter != null) { visibleOverlays.Add(bitmapShutter); } // identify any visible overlays visibleOverlays.AddRange(((IEnumerable <ILayer>)dicomGraphics.Layers).Where(l => l.Visible).SelectMany(l => l.Graphics).OfType <OverlayPlaneGraphic>().Where(g => g.Visible)); } } OverlayMapping overlayMap = new OverlayMapping(); Queue <OverlayPlaneGraphic> overlaysToRemap = new Queue <OverlayPlaneGraphic>(); // user and presentation state overlays are high priority items to remap foreach (OverlayPlaneGraphic overlay in CollectionUtils.Select(visibleOverlays, delegate(OverlayPlaneGraphic t) { return(t.Source != OverlayPlaneSource.Image); })) { overlaysToRemap.Enqueue(overlay); } foreach (OverlayPlaneGraphic overlay in CollectionUtils.Select(visibleOverlays, delegate(OverlayPlaneGraphic t) { return(t.Source == OverlayPlaneSource.Image); })) { if (overlayMap[overlay.Index] == null) { overlayMap[overlay.Index] = overlay; } else { overlaysToRemap.Enqueue(overlay); // image overlays are lower priority items to remap, since they will be included in the header anyway } } // seed the overlays to remap into the remaining available overlay groups for (int n = 0; n < 16 && overlaysToRemap.Count > 0; n++) { if (overlayMap[n] == null) { overlayMap[n] = overlaysToRemap.Dequeue(); } } // serialize the overlays for (int n = 0; n < 16; n++) { OverlayPlaneGraphic overlay = overlayMap[n]; if (overlay != null) { if (overlay.Source != OverlayPlaneSource.Image || overlay.Index != n) { // only record this overlay in the presentation state if it is being remapped to another group or is not already in the image. OverlayPlane overlayIod = overlayPlaneModule[n]; overlayIod.OverlayData = overlay.CreateOverlayData(overlayIod.IsBigEndianOW).Raw; overlayIod.OverlayBitPosition = 0; overlayIod.OverlayBitsAllocated = 1; overlayIod.OverlayColumns = overlay.Columns; overlayIod.OverlayDescription = overlay.Description; overlayIod.OverlayLabel = overlay.Label; overlayIod.OverlayOrigin = Point.Round(overlay.Origin); overlayIod.OverlayRows = overlay.Rows; overlayIod.OverlaySubtype = overlay.Subtype; overlayIod.OverlayType = overlay.Type; overlayIod.RoiArea = null; overlayIod.RoiMean = null; overlayIod.RoiStandardDeviation = null; } else { overlayPlaneModule.Delete(n); } } } if (overlaysToRemap.Count > 0) { Platform.Log(LogLevel.Warn, "Attempt to serialize presentation state with more than 16 visible overlays - some information may be lost."); } overlayMapping = overlayMap; }
/// <summary> /// Cloning constructor. /// </summary> /// <param name="source">The source object from which to clone.</param> /// <param name="context">The cloning context object.</param> protected OverlayPlaneGraphic(OverlayPlaneGraphic source, ICloningContext context) : base() { context.CloneFields(source, this); }
public bool Contains(OverlayPlaneGraphic overlay) { Platform.CheckForNullReference(overlay, "overlay"); return(_overlays.Contains(overlay)); }
public void Add(OverlayPlaneGraphic overlay) { Platform.CheckForNullReference(overlay, "overlay"); Platform.CheckTrue(CanAdd(overlay), "Overlay is already part of a different collection."); if (overlay.ParentGraphic == null) _owner.Layers.InactiveLayer.Graphics.Add(overlay); _overlays.Add(overlay); }