MCPcopy Create free account
hub / github.com/arrayfire/arrayfire / iterDeconvImageTest

Function iterDeconvImageTest

test/iterative_deconv.cpp:34–125  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32
33template<typename T, bool isColor>
34void iterDeconvImageTest(string pTestFile, const unsigned iters, const float rf,
35 const af::iterativeDeconvAlgo algo) {
36 typedef
37 typename cond_type<is_same_type<T, double>::value, double, float>::type
38 OutType;
39
40 SUPPORTED_TYPE_CHECK(T);
41 IMAGEIO_ENABLED_CHECK();
42
43 if (is_same_type<T, schar>::value &&
44 algo == AF_ITERATIVE_DECONV_RICHARDSONLUCY) {
45 GTEST_SKIP() << "Incompatible with signed values";
46 }
47
48 using af::dim4;
49
50 vector<dim4> inDims;
51 vector<string> inFiles;
52 vector<dim_t> outSizes;
53 vector<string> outFiles;
54
55 readImageTests(pTestFile, inDims, inFiles, outSizes, outFiles);
56
57 size_t testCount = inDims.size();
58
59 for (size_t testId = 0; testId < testCount; ++testId) {
60 inFiles[testId].insert(0, string(TEST_DIR "/iterative_deconv/"));
61 outFiles[testId].insert(0, string(TEST_DIR "/iterative_deconv/"));
62
63 af_array _inArray = 0;
64 af_array inArray = 0;
65 af_array kerArray = 0;
66 af_array _outArray = 0;
67 af_array cstArray = 0;
68 af_array minArray = 0;
69 af_array numArray = 0;
70 af_array denArray = 0;
71 af_array divArray = 0;
72 af_array outArray = 0;
73 af_array goldArray = 0;
74 af_array _goldArray = 0;
75 dim_t nElems = 0;
76
77 ASSERT_SUCCESS(af_gaussian_kernel(&kerArray, 13, 13, 2.25, 2.25));
78
79 af_dtype otype = (af_dtype)af::dtype_traits<OutType>::af_type;
80
81 ASSERT_SUCCESS(
82 af_load_image(&_inArray, inFiles[testId].c_str(), isColor));
83 ASSERT_SUCCESS(conv_image<T>(&inArray, _inArray));
84
85 ASSERT_SUCCESS(
86 af_load_image(&_goldArray, outFiles[testId].c_str(), isColor));
87 ASSERT_SUCCESS(conv_image<OutType>(&goldArray, _goldArray));
88 ASSERT_SUCCESS(af_get_elements(&nElems, goldArray));
89
90 unsigned ndims;
91 dim_t dims[4];

Callers

nothing calls this directly

Calls 14

readImageTestsFunction · 0.85
af_get_elementsFunction · 0.85
af_min_allFunction · 0.85
af_max_allFunction · 0.85
af_subFunction · 0.85
af_divFunction · 0.85
af_mulFunction · 0.85
af_gaussian_kernelFunction · 0.50
af_load_imageFunction · 0.50
af_get_numdimsFunction · 0.50
af_get_dimsFunction · 0.50
af_iterative_deconvFunction · 0.50

Tested by

no test coverage detected