yu-lab-vt / AQuA

An event-based tool for analyzing and quantifying calcium or neurotransmitter imaging data
51 stars 14 forks source link

About 'res.dF' and 'res.dffMatFav' #9

Closed invincibleyue closed 3 years ago

invincibleyue commented 3 years ago

dear Dr.Yu , Dr.Wang I am Yue Chen from Miao Jing Lab, Chinese institute for Brain Research, Beijing. Thank you very much for sharing the AQuA program which is very important for our experiment data analyzing. But we have some questions when we are using, We appreciate that if you could answer these questions ASAP.

  1. Is res.dF A three-dimensional matrix of ΔF/F0 for the entire image sequence.
  2. We found it have similar waveform but showed different ΔF/F0 curve in res.dffMatFav(:,:,1) (curve is higher) and averaged res.dF in res.ftsFav.loc.x2D (curve is lower) formed 3D cylinder formed. So, how to derive from res.dF to res.dffMatFav(:,:,1)?

Looking forward your apply! Thanks a lot Yue 20210929

Dr. Yu ,Dr. Wang 您好, 我是北京脑科学与类脑研究中心井淼实验室的陈阅,非常感谢您分享的AQuA程序,对我们的实验起到了非常重要的帮助。在使用过程中出现了一些问题希望得您到回复! 1.res.dF是否是对于整个图片序列的ΔF/F0的三维矩阵。 2.我们使用res.dFres.ftsFav.loc.x2D 时间轴上扩展形成的三维柱体内的平均值作为ΔF/F0的值和res.dffMatFav(:,:,1)在波形上相似但是ΔF/F0数值上却有较大偏差,请问res.dffMatFav(:,:,1)res.dF通过什么方式计算得出的呢?

期待您的回复 非常感谢 陈阅 20210929

% calculation method image res.dF to ΔF/F0 matrix in ROIs

for i=1:length(res.ftsFav.loc.x2D) ROI2D=zeros(502,502); %data size 502,502,2000 ROI2D(res.ftsFav.loc.x2D{1,i})=1; ROI3D=double(res.dF).*ROI2D; Mat(i,:)=sum(sum(ROI3D))./length(res.ftsFav.loc.x2D{1,i}); end

freemanwyz commented 3 years ago

Hi Yue,

Is res.dF A three-dimensional matrix of ΔF/F0 for the entire image sequence.

res.dF is the result of the first step of AQuA, which removes the background (in a rough way). So it is just ΔF. In more detail, it cut the video to shorter time durations to alleviate the impact of the global trends.

We found it have similar waveform but showed different ΔF/F0 curve in res.dffMatFav(:,:,1) (curve is higher) and averaged res.dF in res.ftsFav.loc.x2D (curve is lower) formed 3D cylinder formed. So, how to derive from res.dF to res.dffMatFav(:,:,1)?

In res.dffMat (as well as res.dffMat), we first fit a polynomial curve to approximate the global trend of each event (using raw data, not based on res.dF). After removing this trend, we use its minimum value (along with the background fluorescence value) as F0, and calculate ΔF/F0 for that event. res.dffMatFav(:,:,1) and res.dffMatFav(:,:,2) differs in the way it deals with the impact of other events. In res.dffMatFav(:,:,2), the influence of other events is removed by setting these values to NaN.

Usually, the base F0 intensity is low, so ΔF/F0 peak value is likely to be higher than ΔF.

In terms of your code, since you use res.dF, it is just ΔF, so you need to divide F0 yourself, maybe from raw data.

Thanks, Yizhi Wang

invincibleyue commented 3 years ago

Dear Dr. Wang   Thank you very much for your timely reply! •  The mean is about 10000 to 50000 if I use one frame of res.datOrg as F0 which has no signal. •  Did you Normalize or use other calculations in res.datOrg to processing F0? •       Best Wishes , •       Yue 20210930  

freemanwyz commented 3 years ago

If your movie does not have some global trend (like bleaching), I think using a frame with no signal as F0 is good.

We calculate F0 by fitting a polynomial curve for each event, which may remove the trend. Then we smooth the resulting curve and take the minimum value of the smoothed curve. If the events are very dense, we optionally remove these interfering events from the current event of interest. But if your data does not have these problems, your strategy is just fine.

invincibleyue commented 3 years ago

Thanks a lot if we want to show a ΔF/F0 image in some frame , What algorithm do you suggest we use to make the ΔF/F0 frame image same as res.dffMatFav numerically? I want to use res.dF divide F0 (But averaged res.datOrg is about 30000 ) Yue

freemanwyz commented 3 years ago

I think your method is fine. Just choose a frame in raw data (res.datOrg) without signal. You don't need to use res.dF. Minus that frame from raw data, then divide by that frame.

To make the values numerically consistent, I suggest calculating per event ΔF/F0 the same way as above. For example, just extract the per event ΔF/F0 from the above-calculated maps. You can just ignore res.dffMatFav (due to the choice of per event F0 and the de-trending, they are not likely to be numerically the same as above).

invincibleyue commented 3 years ago

Thanks a lot !!