예제 #1
0
        public void IgnorePixelDataLessThan(bool ignoreShortText)
        {
            var opts = new IsIdentifiableDicomFileOptions
            {
                ColumnReport  = true,
                TessDirectory = _tessDir.FullName,
            };

            // NOTE(rkm 2020-11-16) The test image should report 3 bits of text with lengths 123, 127, and 170.
            // If we ignore less than 170 then only 1 bit of text should be reported.
            opts.IgnoreTextLessThan = ignoreShortText ? 170 : 0U;

            string fileName = Path.Combine(TestContext.CurrentContext.TestDirectory, nameof(DicomFileRunnerTest), "f1.dcm");

            TestData.Create(new FileInfo(fileName), TestData.BURNED_IN_TEXT_IMG);

            var runner = new DicomFileRunner(opts);

            var       fileSystem = new FileSystem();
            IFileInfo fileInfo   = fileSystem.FileInfo.FromFileName(fileName);

            Assert.True(fileInfo.Exists);

            var toMemory = new ToMemoryFailureReport();

            runner.Reports.Add(toMemory);

            runner.ValidateDicomFile(fileInfo);

            List <Failure> failures = toMemory.Failures.ToList();

            Assert.AreEqual(ignoreShortText ? 1 : 3, failures.Count);
        }
예제 #2
0
        public override IEnumerable <Reporting.Failure> Classify(IFileInfo dcm)
        {
            _runner.Reports.Clear();
            var toMemory = new ToMemoryFailureReport();

            _runner.Reports.Add(toMemory);
            _runner.ValidateDicomFile(dcm);

            return(toMemory.Failures);
        }