From 38f95eaa14675052a43acba0258693e206bd6d02 Mon Sep 17 00:00:00 2001 From: Antony Chan Date: Tue, 26 Nov 2024 08:54:04 -0800 Subject: [PATCH] Instructions to run the example app Given the screenshot on the original author's lab website (https://www.ee.cuhk.edu.hk/~tblu/monsite/phps/fastPSF.php), reproduce the same outputs with the C++ example app. Replicate the identical inputs in the C++ file at `examples/generate-psf.cpp`. Write the instructions in Raadme. --- README.md | 30 ++++++++++++++++++++++++++++++ examples/generate-psf.cpp | 15 +++++++++++++-- examples/psf_xz.png | Bin 0 -> 12205 bytes 3 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 examples/psf_xz.png 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 0000000000000000000000000000000000000000..db4ce3f0fb488db57146d1ff2ef321ec1ccb197d GIT binary patch literal 12205 zcmZ`Ph&$s*@` zNg|aLB)=ixApih?Z_-j?DgXfRKNk=P_rJD(^LXh$fU*#l7X|?8;}GACp#O^@jAbRo z0AJy86TSaMu&&bb;;_evcmP%mWa9)`0DxgfT1@zt=W0&(iu>O96x(+pN?2+4i}|yF z{GQ{*<&RI4*{>BdS#lSVdvWAq-G_}P4X;!R2wXU*c&XI)EgDWI+6~=oSrFjTFc91^ zw}ItB-3WD@%MQ(n&8}_@rudj+8cw7$Mzx;^<69I zl3ucmj9k|ZbrJ@B`$^m2vH$%7MTy4_wX+l3=+*6GYu}nTK0eC3+KtsdTcg_#9Pxlft-7Z z6XDf9!{+};l=X5CzQ#Hr`>k^MmLppus~VxLTDHe2*Z)Fmg~q{yt#v(rJ|2(9s)66H zIkw0RX?#$nfnd`6R<$T@M(&WpfkYO!Tyr-llFF%y$_O^tc(z8B3AiB4DC*4TG5AUP zC<}(u^M8#@P;?mW>$(F2{MP>B7O?iU6P*8Ogzw>`7_k@%i_j~e(ftny^m#tsVY%NI;nb>sZ=abw zvSgie>*RN zgm&WZBa^Spqua%}gLNAx2|f4)T(kT}|0RKgQCJ0U9%Y}hR-*)b?{bM-BX5~)G>^xf zW{3*EE|p(S|_P2FXu)VveHFHU85qLGj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