-
Notifications
You must be signed in to change notification settings - Fork 85
Added computation of new frequency-domain and time-domain Jacobians #241
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…ed weight -weighted voxel-wise path lengths in replay mode.
…ected weight -weighted voxel-wise scattering counts (number of scattering events) in replay mode.
|
@HirviP, so sorry for the long delay in getting back to you on this - I have been overwhelmed by a progress report for another parallel project. I appreciate very much for the rigorous implementation and careful formatting the code. before accepting this PR, one of my questions is related to the Test_mcxlab_rfmusreplay_PH.sh script included in this PR do you need it to run the example? if not, I suggest to remove it. |
|
Build seems to fail because of the minimum required CMake version. I will try updating it. |
|
I think Test_mcxlab_rfmusreplay_PH.sh is specific to the HPC system at Aalto University. It's probably better to remove it. |
… types in replay mode. Modify utils/mcxrfmusreplay.m to use ‘rf’ and ‘rfmus’ replay modes to build the scattering Jacobians for FD log-amplitude and phase. Clean utils/mcxrfreplay.m and utils/mcxrfmusreplay.m.
|
Dear @fangq , No worries at all, great if you have some time for this project now! I agree that the .sh script was extra, so thanks @rantahar for removing it. I also just added demo script 'mcxlab/examples/demo_replay_all_jacobian.m' for computing any of the original or new Jacobian types (CW/TD/FD and mua/mus). This could also be formatted as a function with input parameter defining the wanted Jacobian type. I can make a separate GitHub issue on this matter, but note that the original 'wp' or 'nscat' replay can return NaN, very large values and negative values close to the source. One can observe this from matrix 'meanP' in the new demo script (or 'dlogIdmus' and 'dTOFdmus' Jacobians that utilize 'meanP'). I'm looking into this, and we are also adding validation results to the Overleaf document. |
MCX originally computes the Jacobians for CW and TD intensity with respect to voxel-wise absorption and scattering coefficients, and for radio-frequency (RF/FD) intensity-modulated light with respect to absorption. We added the computation of the RF scattering Jacobians, and the Jacobians for photon mean time-of-flight (TOF) with respect to absorption and scattering. Specifically, we added three new output types: 1) cosine- and sine weighted average scattering counts in each voxel (similarly to current rf replay for absorption), 2) weighted average of "total TOF x total path length" in each voxel, and 3) weighted average of "total TOF x scattering count" in each voxel. These can be combined with the other replay modes to obtain the Jacobians for FD amplitude and phase shift with respect to scattering, and TD mean TOF with respect to absorption and scattering. See the following document for the required formulas: Jacobian_Formulas. We also removed the normalization with cfg.unitinmm from replay outputs that do not use path lengths in voxel grid units.
Check List
Before you submit your pull-request, please verify and check all below items
make pretty(requiresastylein the command line) under thesrc/folder and formatted your C/C++/CUDA source codes before every commit; similarly, you should runpython3 -m black *.py(pip install blackfirst) to reformat all modified Python codes, or runmh_style --fix .(pip install miss-hitfirst) at the top-folder to format all MATLAB scripts.doxygenC formatIf your commits included in this PR contain changes that did not follow the above guidelines, you are strongly recommended to create a clean patch using
git rebaseandgit cherry-pickto prevent in-compliant history from appearing in the upstream code.Moreover, you are highly recommended to
mcx/test/testmcx.shscript, following existing examples, to test the newly added feature; or add a MATLAB script undermcxlab/examplesto gives examples of the desired outputs