Ejemplo n.º 1
0
        public void TestRenderImage()
        {
            ImageManager.SetImplementation(new ImageSharpImageManager());
            var image = ImageManager.CreateImage(100, 100);

            image.Render(4, false, false, 0);
            Assert.IsType <ImageSharpImage>(image);
        }
Ejemplo n.º 2
0
 public void RenderImage_WPFManager_AsReturnsImageSource()
 {
     lock (this.@lock)
     {
         ImageManager.SetImplementation(WPFImageManager.Instance);
         var image = new DicomImage(@".\Test Data\CT-MONO2-16-ankle").RenderImage();
         Assert.IsAssignableFrom <ImageSource>(image.As <ImageSource>());
     }
 }
Ejemplo n.º 3
0
 public void RenderImage_WinFormsManager_AsReturnsBitmap()
 {
     lock (this.@lock)
     {
         ImageManager.SetImplementation(WinFormsImageManager.Instance);
         var image = new DicomImage(@".\Test Data\CT-MONO2-16-ankle").RenderImage();
         Assert.IsAssignableFrom <Bitmap>(image.As <Bitmap>());
     }
 }
Ejemplo n.º 4
0
        public void DicomJpegLosses_DecodingAvailable(string filename)
        {
            ImageManager.SetImplementation(RawImageManager.Instance);
            var file     = DicomFile.Open(@".\Test Data\" + filename, FileReadOption.ReadAll);
            var dcmImage = new DicomImage(file.Dataset);
            var image    = dcmImage.RenderImage();

            Assert.NotNull(image);
        }
Ejemplo n.º 5
0
 public void SetImplementation_WPF_ImageManagerUsesWPFImplementation()
 {
     lock (@lock)
     {
         ImageManager.SetImplementation(WPFImageManager.Instance);
         var image = ImageManager.CreateImage(100, 100);
         image.Render(4, false, false, 0);
         Assert.IsType <WPFImage>(image);
     }
 }
Ejemplo n.º 6
0
 public void RenderImage_ColorPaletteWithOffset(string filename)
 {
     lock (_lock)
     {
         ImageManager.SetImplementation(WinFormsImageManager.Instance);
         var file  = new DicomImage(@".\Test Data\" + filename);
         var image = file.RenderImage(0);
         Assert.IsAssignableFrom <Bitmap>(image.As <Bitmap>());
     }
 }
Ejemplo n.º 7
0
 public void RenderImage_ColorPalette()
 {
     lock (_lock)
     {
         ImageManager.SetImplementation(WinFormsImageManager.Instance);
         var file  = new DicomImage(@".\Test Data\10200904.dcm");
         var image = file.RenderImage(0);
         Assert.IsAssignableFrom <Bitmap>(image.As <Bitmap>());
     }
 }
Ejemplo n.º 8
0
        public void TestActualRendering()
        {
            ImageManager.SetImplementation(new ImageSharpImageManager());
            var dcmImage = new DicomImage(@"Test Data\CR-MONO1-10-chest");
            var image    = dcmImage.RenderImage();

            Assert.IsAssignableFrom <Image <Bgra32> >(image.AsSharpImage());
            var sharpImage = image.AsSharpImage();

            Assert.Equal(dcmImage.Width, sharpImage.Width);
            Assert.Equal(dcmImage.Height, sharpImage.Height);
        }
Ejemplo n.º 9
0
        public void ManipulatedImage_MultithreadedAccess_ShouldNotThrow()
        {
            lock (_lock)
            {
                ImageManager.SetImplementation(WinFormsImageManager.Instance);

                var image     = new DicomImage(@".\Test Data\CT-MONO2-16-ankle");
                var exception = Record.Exception(() =>
                {
                    Parallel.For(0, 1000, i =>
                    {
                        image.RenderImage().AsBitmap();
                        image.Scale = 0.999;
                    });
                });

                Assert.Null(exception);
            }
        }