private void performForwardAndBackwardTestCombined(Wavelet2D wavelet, bool simpleTestData = false, bool checkTransformationResults = false) { performForwardAndBackwardTest(wavelet, false, false, simpleTestData, checkTransformationResults); performForwardAndBackwardTest(wavelet, true, false, simpleTestData, checkTransformationResults); performForwardAndBackwardTest(wavelet, false, true, simpleTestData, checkTransformationResults); performForwardAndBackwardTest(wavelet, true, true, simpleTestData, checkTransformationResults); }
private void performForwardAndBackwardTest(Wavelet2D wavelet, bool parallel, bool cached, bool simpleTestData = false, bool checkTransformationResults = false) { initTestData(wavelet, simpleTestData); wavelet.EnableParallel = parallel; wavelet.EnableCaching = cached; wavelet.TransformIsotropic2D(test); //Note: This test is wrong, if transformation does not change //the values in the array! For a array with all zeros this is the case if (!isAllZero()) { Assert.IsFalse(compareSource()); } if (checkTransformationResults) { Assert.IsTrue(compareTransformed()); } wavelet.BacktransformIsotropic2D(test); Assert.IsTrue(compareSource()); }
private void initTestData(Wavelet2D wavelet, bool simpleTestData = false) { Random rnd = new Random(1); this.wavelet = wavelet; initArrays(wavelet.Width, wavelet.Height); for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) { if (simpleTestData) { test [x, y] = (float)(x + y); } else { test [x, y] = (float)(rnd.NextDouble() * 10.0 - 5.0); } valOrg [x, y] = test [x, y]; } } }