Hi Dr.Fang,
Congratulations for the new release of the MCX and the announcing of the first MCX/MMC workshop.
I was playing with the "replay" mode these days. It will be very convenient for us to solve the forward problem for NIRS tomography, since it provides the Jacobian matrix (sensitivity) for a pair of source and detector. To make sure we are using this function correctly, I have some questions as following (I searched in this group but there are very few questions related to this topic. They were posted at the time when "replay" model was not validated as you mentioned):
1) Do we have a reference that gives an idea of how does "replay" model work? For the adjoint method, I've read your paper Fang Q, et al, “Combined optical Imaging and mammography of the healthy breast: optical contrast derives from breast structure and compression,” IEEE TMI, 28(1): 30 – 42, 2009. In terms of algorithm, is replay model using this method?
2) To get the sensitivity of a NIRS channel, we used to calculate the fluences of the source and detector separately from mcxlab and then substitute them into the mu_a equation. In the replay mode demo, for one pair, mcx was called twice. Fluence of source was calculated first, but the detector info was also involved. In our previous implementation, we only put one light input info (either source or detector) for fluence calculation. Why do you give the detector info for the first time of calling mcx? Is it because the detp output should be specific for the detector?
3) I don't really understand the newcfg, what are these two matrix newcfg.seed=seeds.data; newcfg.detphotons=detp.data; doing ? Why the seed data has to be the one from the first mcx output ? Why do we need the pathlength file detp.data for replay model?
4) What's the difference between detp.data and detp2.data? I checked the histogram of these two metric and they are quite similar. If we want to extract the pathlength info of a channel, should we use detp or detp2, I guess it should be detp2, but no idea of the reason. For me if we input source and detector both for the first and second call of mcx, the pathlength should be similar.
5) To use the replay model for CW NIRS forward model, do we just repeat this demo for each specific channel? Each time we just update the loc and dir of source and detector the code will be same, am I right? or there are other advanced setup for replay model that is not shown in the demo?
Thank you very much.
Best regards,
Zhengchen
%%%%%% replay model demo%%%%%%%
clear cfg cfgs
cfg.nphoton=1e6;
cfg.vol=uint8(ones(60,60,60));
cfg.srcpos=[30 30 1];
cfg.srcdir=[0 0 1];
cfg.gpuid=1;
cfg.autopilot=1;
cfg.prop=[0 0 1 1;0.005 1 0 1.37];
cfg.tstart=0;
cfg.tend=5e-9;
cfg.tstep=5e-10;
% calculate the flux distribution with the given config
cfg.detpos=[15 30 0 2];
[flux, detp, vol, seeds]=mcxlab(cfg);
newcfg=cfg;
newcfg.seed=seeds.data;
newcfg.outputtype='jacobian';
newcfg.detphotons=detp.data;
[flux2, detp2, vol2, seeds2]=mcxlab(newcfg);
jac=sum(flux2.data,4);