Esempio n. 1
0
        private void RenderImages(IRenderContext context)
        {
            var primaryImgRect   = new Rectd(0, 0, 1, 1);
            var secondaryImgRect = new Rectd(0, 0, 1, 1);

            if (ImageRenderContext != null)
            {
                ImageRenderer?.BeginRender(primaryImgRect, context);
                ImageRenderer?.Render(FromImage(PrimaryImage, BlendMode.None, new Rectd(0, 0, 1, 1)), Camera, context);
                ImageRenderer?.Render(FromImage(SecondaryImage, BlendMode.OverWhereNonZero, SpyGlass), Camera, context);
                foreach (var img in AdditionalImages)
                {
                    ImageRenderer?.Render(img, Camera, context);
                }

                ImageRenderer?.EndRender(primaryImgRect, context);
                //ImageRenderContext?.DrawString("" + ImageRenderer.iy, 0, 0, 12, DicomColors.Yellow);
            }
        }
Esempio n. 2
0
        public ImagePreviewObject(DicomImageObject img)
        {
            Image        = img;
            ImagePreview = new WriteableBitmap(50, 50, 96, 96, PixelFormats.Bgr32, null);
            var wbContext = new WriteableBitmapRenderContext(ImagePreview);

            wbContext.Resize(ImagePreview, 50, 50);
            var imgRenderer = new ImageRenderer();
            var camera      = new Camera();

            camera.SetAxial();
            camera.SetFOV(512, 512);
            camera.MoveTo(img.Grid.XRange.GetCentre(), img.Grid.YRange.GetCentre(), img.Grid.ZRange.GetCentre());
            var renderableImage = new RenderableImage();

            renderableImage.LUT        = img.LUT;
            renderableImage.ScreenRect = new RT.Core.Utilities.RTMath.Rectd(0, 0, 1, 1);
            renderableImage.Scaling    = img.Grid.Scaling;
            renderableImage.Grid       = img.Grid;
            renderableImage.Units      = "HU";
            imgRenderer.BeginRender(renderableImage.ScreenRect, wbContext);
            imgRenderer.Render(renderableImage, camera, wbContext);
            imgRenderer.EndRender(renderableImage.ScreenRect, wbContext);
        }