public Rectangle DrawABox(Point topleft, double width, double height, double imgwidth, double imgheight, m.ColorRGBA color)
        {
            if (ActualWidth < 1 || ActualHeight < 1)
            {
                return(null);
            }
            Point tl = new Point(topleft.X * imgwidth / ActualWidth, topleft.Y * imgheight / ActualHeight);
            Point br = new Point((topleft.X + width) * imgwidth / ActualWidth, (topleft.Y + height) * imgheight / ActualHeight);

            ;
            Rectangle r = new Rectangle {
                Width = br.X - tl.X, Height = br.Y - tl.Y, Stroke = Brushes.White, Fill = ColorConverter(color), StrokeThickness = 1, Opacity = 1.0
            };

            r.SetValue(Canvas.LeftProperty, tl.X);
            r.SetValue(Canvas.TopProperty, tl.Y);
            ROI_Container.Children.Add(r);
            return(r);
        }
 public SolidColorBrush ColorConverter(m.ColorRGBA c)
 {
     return(new SolidColorBrush(Color.FromArgb(128, (byte)Math.Round(c.r), (byte)Math.Round(c.g), (byte)Math.Round(c.b))));
 }