Example #1
0
        private static IAnnotationLayout CreateRealLayout(string storedLayoutId)
        {
            try
            {
                StoredAnnotationLayout storedLayout = GetStoredLayout(storedLayoutId);
                if (storedLayout != null)
                {
                    return(storedLayout.Clone());
                }

                //just return an empty layout.
                return(new AnnotationLayout());
            }
            catch (Exception e)
            {
                Platform.Log(LogLevel.Error, e);

                var layout = new AnnotationLayout();
                var item   = new BasicTextAnnotationItem("errorbox", "errorbox", @"LabelError",
                                                         SR.MessageErrorLoadingAnnotationLayout);
                var box = new AnnotationBox(new RectangleF(0.5F, 0.90F, 0.5F, 0.10F), item)
                {
                    Bold              = true,
                    Color             = "Red",
                    Justification     = AnnotationBox.JustificationBehaviour.Right,
                    NumberOfLines     = 5,
                    VerticalAlignment = AnnotationBox.VerticalAlignmentBehaviour.Bottom
                };

                layout.AnnotationBoxes.Add(box);
                return(layout);
            }
        }
Example #2
0
        private void HideOverlays()
        {
            if (_magnificationImage is IAnnotationLayoutProvider)
            {
                string magFactor = String.Format("{0:F1}x", ToolSettings.DefaultInstance.MagnificationFactor);
                AnnotationLayout layout = new AnnotationLayout();
                BasicTextAnnotationItem item = new BasicTextAnnotationItem("mag", "mag", "mag", magFactor);
                AnnotationBox box = new AnnotationBox(new RectangleF(0.8F, 0F, .2F, .05F), item);
                box.Justification = AnnotationBox.JustificationBehaviour.Right;
                box.VerticalAlignment = AnnotationBox.VerticalAlignmentBehaviour.Top;
                layout.AnnotationBoxes.Add(box);
                ((BasicPresentationImage)_magnificationImage).AnnotationLayout = layout;
            }

            if (_magnificationImage is IOverlayGraphicsProvider)
            {
                GraphicCollection graphics = ((IOverlayGraphicsProvider)_magnificationImage).OverlayGraphics;
                foreach (IGraphic graphic in graphics)
                    graphic.Visible = false;
            }

            if (_magnificationImage is IApplicationGraphicsProvider)
            {
                GraphicCollection graphics = ((IApplicationGraphicsProvider)_magnificationImage).ApplicationGraphics;
                foreach (IGraphic graphic in graphics)
                    graphic.Visible = false;
            }

            //we want the Dicom graphics to be visible (e.g. shutter and embedded overlays)

            //if (_magnificationImage is IDicomPresentationImage)
            //{
            //    GraphicCollection graphics = ((IDicomPresentationImage)_magnificationImage).DicomGraphics;
            //    foreach (IGraphic graphic in graphics)
            //        graphic.Visible = false;
            //}
        }
		private static IAnnotationLayout CreateRealLayout(string storedLayoutId)
		{
			try
			{
				StoredAnnotationLayout storedLayout = GetStoredLayout(storedLayoutId);
				if (storedLayout != null)
					return storedLayout.Clone();

				//just return an empty layout.
				return new AnnotationLayout();
			}
			catch (Exception e)
			{
				Platform.Log(LogLevel.Error, e);

				var layout = new AnnotationLayout();
				var item = new BasicTextAnnotationItem("errorbox", "errorbox", @"LabelError",
				                                       SR.MessageErrorLoadingAnnotationLayout);
				var box = new AnnotationBox(new RectangleF(0.5F, 0.90F, 0.5F, 0.10F), item)
				          	{
				          		Bold = true,
				          		Color = "Red",
				          		Justification = AnnotationBox.JustificationBehaviour.Right,
				          		NumberOfLines = 5,
				          		VerticalAlignment = AnnotationBox.VerticalAlignmentBehaviour.Bottom
				          	};

				layout.AnnotationBoxes.Add(box);
				return layout;
			}
		}