compneuro-da / rsHRF

rsHRF: A Toolbox for Resting State HRF Deconvolution and Connectivity Analysis (MATLAB)
BSD 3-Clause "New" or "Revised" License
47 stars 15 forks source link

error wavedec() function #57

Closed bethlloyd closed 3 years ago

bethlloyd commented 3 years ago

Hi Daniele,

I am trying to run the Voxel-wise HRF estimation. I get the following error:

----------------------------------------------------------------

27-Apr-2021 18:31:43 - Failed 'Voxel-wise HRF deconvolution' Undefined function 'wavedec' for input arguments of type 'double'. In file "C:\Users\lloydb\surfdrive\ExperimentData\toolbox\spm12\spm12\toolbox\rsHRF\rsHRF_iterative_wiener_deconv.m" (???), function "rsHRF_iterative_wiener_deconv" at line 22. In file "C:\Users\lloydb\surfdrive\ExperimentData\toolbox\spm12\spm12\toolbox\rsHRF\rsHRF_deconv_job.m" (???), function "rsHRF_deconv_job" at line 107. In file "C:\Users\lloydb\surfdrive\ExperimentData\toolbox\spm12\spm12\toolbox\rsHRF\rsHRF.m" (???), function "rsHRF" at line 113. In file "C:\Users\lloydb\surfdrive\ExperimentData\toolbox\spm12\spm12\toolbox\rsHRF\tbx_cfg_rsHRF.m" (???), function "wgr_vox_ROI_rsHRF_conn" at line 884.

The following modules did not run: Failed: Voxel-wise HRF deconvolution

----------------------------------------------------------------

I changed the flag_parfor to 0 in rsHRF_estimation_temporal_basis.m (line 20) just in case the issue was with parfor, but the error remains. (by the way I am running it on Matlab version R2020a)

I had a look for the function 'wavedec' and it seems you have to buy it with the toolbox wavelet... Do you think that is the cause of the error? And do you suggest to purchase wavelet?

Thank you for your help! Beth

danielemarinazzo commented 3 years ago

Hi Beth Thanks a lot for this. I found this implementation of wavedec, which you can use instead, https://github.com/gnattar/main/blob/master/universal/helper_funcs/wavelettool/wavedec.m.

Also this nice toolbox https://ltfat.github.io should have a similar implementation.

I hope this will work for you!

bethlloyd commented 3 years ago

Hi!

Thank you for your quick response! Thanks for pointing me to that repository. I went through function by function which needed to be added.

I now get to the following error:


File : wavelets.bin not found !

27-Apr-2021 20:05:30 - Failed 'Voxel-wise HRF deconvolution' Error using wavemngr (line 121) ** STOP ** In file "C:\Users\lloydb\surfdrive\ExperimentData\toolbox\spm12\spm12\toolbox\rsHRF\wavemngr.m" (???), function "wavemngr" at line 121. In file "C:\Users\lloydb\surfdrive\ExperimentData\toolbox\spm12\spm12\toolbox\rsHRF\wavemngr.m" (???), function "wavemngr" at line 424. In file "C:\Users\lloydb\surfdrive\ExperimentData\toolbox\spm12\spm12\toolbox\rsHRF\wfilters.m" (???), function "wfilters" at line 40. In file "C:\Users\lloydb\surfdrive\ExperimentData\toolbox\spm12\spm12\toolbox\rsHRF\wavedec.m" (???), function "wavedec" at line 36. In file "C:\Users\lloydb\surfdrive\ExperimentData\toolbox\spm12\spm12\toolbox\rsHRF\rsHRF_iterative_wiener_deconv.m" (???), function "rsHRF_iterative_wiener_deconv" at line 22. In file "C:\Users\lloydb\surfdrive\ExperimentData\toolbox\spm12\spm12\toolbox\rsHRF\rsHRF_deconv_job.m" (???), function "rsHRF_deconv_job" at line 107. In file "C:\Users\lloydb\surfdrive\ExperimentData\toolbox\spm12\spm12\toolbox\rsHRF\rsHRF.m" (???), function "rsHRF" at line 113. In file "C:\Users\lloydb\surfdrive\ExperimentData\toolbox\spm12\spm12\toolbox\rsHRF\tbx_cfg_rsHRF.m" (???), function "wgr_vox_ROI_rsHRF_conn" at line 884.

The following modules did not run: Failed: Voxel-wise HRF deconvolution

Is there any chance you know what I could do here... ? It seems its not creating those files specified in wavemngr() function line(98-102).

Thanks again for your help! Beth

danielemarinazzo commented 3 years ago

Dear Beth

it seems to me that the function you added drove you into a rabbit hole of dependencies (wavelet.bin is an initial wavelet that you are supposed to supply).

So what they did here https://github.com/gnattar/main/tree/master/universal/helper_funcs/wavelettool was to reproduce the wavelet toolbox, you can maybe fork that one, and that should be fine.

bethlloyd commented 3 years ago

Dear Daniele,

So sorry to bother you again with this! I did pull the entire folder with its contents (so they are all in the folder C:\Users\lloydb\surfdrive\ExperimentData\toolbox\spm12\spm12\toolbox\rsHRF)

But I still get the same error ( File : wavelets.bin not found ! )

I get the same error if I try the ROIs-volume batch as well..

Best, Beth

danielemarinazzo commented 3 years ago

Dear Beth

is this the repo you pulled https://github.com/gnattar/main/tree/master/universal/helper_funcs/wavelettool ?

Because that one should not require for wavelet.bin.

Maybe if you ran the code without parfor, you should be able to see which function and which line report the error, this would be helpful.

We are anyway working at a version independent of the matlab toolbox, to avoid these issues in the future.

guorongwu commented 3 years ago

https://github.com/gnattar/main/tree/master/universal/helper_funcs/wavelettool does not include all necessary (wavelet) sub-function. here is the test (wmemutil.m is not included, so it call matlab wavelet toolbox again.)

[c,l] = wavedec(rand(200,1),1,'db2'); Error using prod Invalid data type. First argument must be numeric or logical.

Error in wmemutil (line 40) ind = ind+3+prod(in2(ind:ind+1));

Error in wavemngr (line 425) tab_file = wmemutil('get',Wavelets_Info,ind_tab_file);

Error in wfilters (line 40) [wtype,fname] = wavemngr('info',wname);

Error in wavedec (line 36) [LoF_D,HiF_D] = wfilters(arg3,'d');

On Wed, Apr 28, 2021 at 4:51 PM Daniele Marinazzo @.***> wrote:

Dear Beth

is this the repo you pulled https://github.com/gnattar/main/tree/master/universal/helper_funcs/wavelettool ?

Because that one should not require for wavelet.bin.

Maybe if you ran the code without parfor, you should be able to see which function and which line report the error, this would be helpful.

We are anyway working at a version independent of the matlab toolbox, to avoid these issues in the future.

ā€” You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/compneuro-da/rsHRF/issues/57#issuecomment-828276648, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE4ZO77RJ4L4PPE3F6XELLLTK7EAPANCNFSM43VK7O7A .

guorongwu commented 3 years ago

@bethlloyd can you try to download this toolbox, and add it (/Examples/wavelet/wavelet) into the path https://github.com/prvn16/ManavMantra/tree/master/Examples/wavelet/wavelet

bethlloyd commented 3 years ago

thanks @guorongwu!

I tried running it with the toolbox in the path, however I get the error that you need a license number to use wavelet toolbox.

What I then tried is just taking the files: 'wavelets.bin'; 'wavelets.ini'; 'wavelets.inf'; 'wavelets.asc'; and putting them in my rsHRF folder.

Now I get the following error: 28-Apr-2021 13:33:50 - Failed 'Voxel-wise HRF deconvolution' Error using prod Invalid data type. First argument must be numeric or logical. In file "C:\Users\lloydb\surfdrive\ExperimentData\toolbox\spm12\spm12\toolbox\rsHRF\wmemutil.m" (???), function "wmemutil" at line 40. In file "C:\Users\lloydb\surfdrive\ExperimentData\toolbox\spm12\spm12\toolbox\rsHRF\wavemngr.m" (???), function "wavemngr" at line 425. In file "C:\Users\lloydb\surfdrive\ExperimentData\toolbox\spm12\spm12\toolbox\rsHRF\wfilters.m" (???), function "wfilters" at line 40. In file "C:\Users\lloydb\surfdrive\ExperimentData\toolbox\spm12\spm12\toolbox\rsHRF\wavedec.m" (???), function "wavedec" at line 36. In file "C:\Users\lloydb\surfdrive\ExperimentData\toolbox\spm12\spm12\toolbox\rsHRF\rsHRF_iterative_wiener_deconv.m" (???), function "rsHRF_iterative_wiener_deconv" at line 22. In file "C:\Users\lloydb\surfdrive\ExperimentData\toolbox\spm12\spm12\toolbox\rsHRF\rsHRF_deconv_job.m" (???), function "rsHRF_deconv_job" at line 107. In file "C:\Users\lloydb\surfdrive\ExperimentData\toolbox\spm12\spm12\toolbox\rsHRF\rsHRF.m" (???), function "rsHRF" at line 113. In file "C:\Users\lloydb\surfdrive\ExperimentData\toolbox\spm12\spm12\toolbox\rsHRF\tbx_cfg_rsHRF.m" (???), function "wgr_vox_ROI_rsHRF_conn" at line 884.

The following modules did not run: Failed: Voxel-wise HRF deconvolution

thanks again for your help

bethlloyd commented 3 years ago

Hi!

So I realised that the student version of Matlab does not come with the wevelet toolbox, but other 'regular' versions do. I will access another Matlab with the wavelet toolbox and it should run then!

Thanks for your help :)

Best, Beth

danielemarinazzo commented 3 years ago

That's great, hopefully it will work for you, but thanks for pointing that out for us. We are currently striving to make the toolbox accessible to anyone, students in this case. Luckily the python version is already šŸ˜‰

bethlloyd commented 3 years ago

Hi Daniele,

Just to let you know everything is up and working now - thanks!! I just have a question about collapsing across two sessions that maybe you could give advice on? I have two 5 minute sessions (150 scans) for each participant and with a threshold of 1, there are on average ~10 'events' per session and participant. I was thinking that it might be better to estimate the HRF based on more events, hence, collapsing across the sessions would equal ~20 events per participant. What would be the best way to do this? Should I include all the images (300) in the input and concatenate the temporal mask? or would you advise to run them separately and average the output HRFs?

Thank you! Beth

danielemarinazzo commented 3 years ago

Dear Beth

that's great to hear!

The tool is GLM-based, so if you are confident enough that we can consider that the characteristics of the signals in the sessions could be drawn from the same distributions, then it's perfectly safe to concatenate them and have a more robust estimate, and this is a better choice than averaging the HRFs for the two sessions.

Of course you could also be interested in the replicability of the measure and look at the test-retest reliability.

Good luck!

danielemarinazzo commented 3 years ago

I am closing this issue since the technical problem is solved, but of course feel free to get in touch again, with a separate issue, or on the NITRC forum.