示例#1
0
        public void TestDetectFormat()
        {
            var osr = new OpenSlide();

            Assert.IsTrue(osr.DetectFormat("nonExisting") == null);
            Assert.IsTrue(osr.DetectFormat("setup.py") == null);
            Assert.IsTrue(osr.DetectFormat("tests/boxes.tiff") == "generic-tiff");
        }
示例#2
0
        public Slide(OpenSlide osr)
        {
            FilePath            = osr.FilePath;
            Name                = Path.GetFileName(FilePath);
            Url                 = UrlFormatter.UrlFor(Name);
            Vendor              = osr.DetectFormat(FilePath);
            Width               = osr.Dimensions.Width;
            Height              = osr.Dimensions.Height;
            HasAssociatedImages = osr.ReadAssociatedImages().Any();

            try
            {
                double.TryParse(osr.Properties[OpenSlide.PROPERTY_NAME_MPP_X], out double mppX);
                double.TryParse(osr.Properties[OpenSlide.PROPERTY_NAME_MPP_Y], out double mppY);
                Mpp = (mppX + mppY) / 2;
            }
            catch (Exception)
            {
                Mpp = 0;
            }
        }