public void ShouldThrowErrorWhenTryingToCorrectImageOfDifferentModelThanNonUniformityImageModel()
        {
            // Given
            var imageModel = new ImageModel(4, 2, ImageBitDepth.Bpp12);
            var inputImage = new Image(new ushort[] { 5, 0, 2, 8, 2, 8, 2, 8 }, imageModel);

            var nonUniformityModel = new NonUniformityModel(new[] { 1, 0, 0.5, 0.25 }, new[] { 5.0, 0, -4, 5 }, new ImageModel(2, 2, ImageBitDepth.Bpp8));

            var correctionAlgorithm = new TwoPointNonUniformityCorrectionAlgorithm(new TwoPointNonUniformityCorrectionTemplate {
                NonUniformityModel = nonUniformityModel
            });

            // When
            // Then
            Assert.Throws <ImageModelMismatchException>(() => { correctionAlgorithm.ProcessImage(inputImage); });
        }
        public void ShouldModifyInputImageForNonTrivialNonUniformityModel()
        {
            // Given
            var nonUniformityModel  = new NonUniformityModel(new[] { 1, 0, 0.5, 0.25 }, new[] { 5.0, 0, -4, 5 }, new ImageModel(2, 2, ImageBitDepth.Bpp8));
            var imageModel          = new ImageModel(2, 2, ImageBitDepth.Bpp8);
            var inputImage          = new Image(new ushort[] { 5, 0, 2, 8 }, imageModel);
            var correctionAlgorithm = new TwoPointNonUniformityCorrectionAlgorithm(new TwoPointNonUniformityCorrectionTemplate {
                NonUniformityModel = nonUniformityModel
            });

            // When
            var correctedImage = correctionAlgorithm.ProcessImage(inputImage);

            // Then
            Assert.AreNotEqual(inputImage, correctedImage);
        }
예제 #3
0
 public TwoPointNonUniformityCorrectionAlgorithm(TwoPointNonUniformityCorrectionTemplate template)
 {
     _imageModel         = template.ImageModel;
     _nonUniformityModel = template.NonUniformityModel;
 }