8 #include <catch2/catch_all.hpp>
21 #include "tools_for_tests/directories.h"
32 extern std::unique_ptr<std::mt19937_64>
mersenne;
33 const std::string input =
"cameraman256";
43 const Vector y0 = sampling * Vector::Map(image.data(), image.size());
44 constexpr
auto snr = 30.0;
45 const auto sigma = y0.stableNorm() / std::sqrt(y0.size()) * std::pow(10.0, -(snr / 20.0));
46 const auto epsilon = std::sqrt(nmeasure + 2 * std::sqrt(y0.size())) *
sigma;
48 std::normal_distribution<> gaussian_dist(0,
sigma);
52 Eigen::VectorXd dirty_image = sampling.
adjoint() * y;
61 .regulariser_strength(regulariser_strength)
63 .relative_variation(1e-3)
64 .residual_tolerance(0)
69 auto gp = std::make_shared<sopt::algorithm::TFGProximal<Scalar>>(model_path);
74 auto const diagnostic = fb();
76 CHECK(diagnostic.good);
77 CHECK(diagnostic.niters < 500);
83 "tf_reconstruction.tiff");
86 Eigen::Map<const Eigen::VectorXd> flat_image(image.data(), image.size());
87 auto mse = (flat_image - diagnostic.x).array().square().sum() / image.size();
An operator that samples a set of measurements.
std::unique_ptr< std::mt19937_64 > mersenne(new std::mt19937_64(0))
#define SOPT_HIGH_LOG(...)
High priority message.
void write_tiff(Image<> const &image, std::string const &filename)
Writes a tiff greyscale file.
int t_int
Root of the type hierarchy for signed integers.
double t_real
Root of the type hierarchy for real numbers.
size_t t_uint
Root of the type hierarchy for unsigned integers.
Eigen::Array< T, Eigen::Dynamic, Eigen::Dynamic > Image
A 2-dimensional list of elements of given type.
real_type< T >::type epsilon(sopt::LinearTransform< Vector< T >> const &sampling, sopt::Image< T > const &image)
Eigen::Matrix< T, Eigen::Dynamic, 1 > Vector
A vector of a given type.
real_type< T >::type sigma(sopt::LinearTransform< Vector< T >> const &sampling, sopt::Image< T > const &image)
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > Matrix
A matrix of a given type.
sopt::Vector< Scalar > Vector
sopt::Matrix< Scalar > Matrix
sopt::Image< Scalar > Image