diff --git a/README.md b/README.md index f6b213c..e8f3820 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,36 @@ ninja all sudo ninja install ``` +## Running the examples + +First, follow the *Quick start* instructions to build the example app. Then, given the following microscope configurations in the screenshot... + + +... program the example C++ file at (https://github.com/MicroscPSF/MicroscPSF-Cpp/blob/main/examples/generate-psf.cpp)[examples/generate-psf.cpp] + +```c++ +microscope_params_t params{}; +params.NA = 1.4; +params.ti0 = 150.0_um; +params.ni = 1.5; +params.ni0 = 1.5; +params.pz = 2.0_um; + +precision_li2017_t precision{}; +precision.num_basis = 153; +precision.rho_samples = 1000; + +const auto psf = + makePSF(params, {0.1_um, 0.25_um}, {256, 128}, 0.610_um, precision); +``` + +Next, repeat the *Quick start* steps to re-compile the C++ app. Run `ninja test` +to invoke the compiled example. Locate the outputs `psf_xy.pgm`, `psf_xz.pgm`, +and `psf.h5`. The XZ cross-section of the C++-simulated PSF should match the +screenshot above. + + + ## Appendix: Bessel function support - The original ISO C++ proposal: https://wg21.link/p0226r1 diff --git a/examples/generate-psf.cpp b/examples/generate-psf.cpp index bd79b46..77846c4 100644 --- a/examples/generate-psf.cpp +++ b/examples/generate-psf.cpp @@ -10,9 +10,20 @@ int main() { namespace hdf5_opts = arma::hdf5_opts; using namespace ::units::literals; + microscope_params_t params{}; + params.NA = 1.4; + params.ti0 = 150.0_um; + params.ni = 1.5; + params.ni0 = 1.5; + params.pz = 2.0_um; + + precision_li2017_t precision{}; + precision.num_basis = 153; + precision.rho_samples = 1000; + const auto psf = - makePSF(microscope_params_t{}, {0.1_um, 0.25_um}, {120, 63}, 0.530_um, precision_li2017_t{}); -#ifdef ARMA_USE_HDF5 + makePSF(params, {0.1_um, 0.25_um}, {256, 128}, 0.610_um, precision); +#ifdef ARMA_USE_HDF5 std::cout << "Saving volume to HDF5...\n"; psf.save(hdf5_name("psf.h5", "psf", hdf5_opts::trans)); std::cout << R"(Done. diff --git a/examples/psf_xz.png b/examples/psf_xz.png new file mode 100644 index 0000000..db4ce3f Binary files /dev/null and b/examples/psf_xz.png differ