brain-life / encode

Method for encoding brain connectomes in multidimensional arrays (tensors).
https://github.com/brain-life/encode
38 stars 25 forks source link

Error using demo_LiFE.m #98

Open sarwart opened 3 years ago

sarwart commented 3 years ago

Hi!

I downloaded the recommended dataset and ran demo_LiFE.m without making any change to the code or dataset. But I have received the following error

Error using histc
Edge vector must be monotonically non-decreasing.

Error in hist (line 126)
    nn = histc(y,edgesc,1);

Error in feComputeEvidence (line 25)
[se.lesion.hist,   se.lesion.xhist]   = hist(se.lesion.rmse.all,  se.bins);

Error in demo_LiFE (line 252)
se = feComputeEvidence(prob.rmse,det.rmse); 

When I checked the values of "y" and "edgesc", both contained NaNs. Can you please guide what am I doing wrong? I am using MATLAB 2018a on Windows OS. "rmse", "rmsexv", "rrmse" and "w" all are also NaNs.

sarwart commented 3 years ago

Hi!

I downloaded the recommended dataset and ran demo_LiFE.m without making any change to the code or dataset. But I have received the following error

Error using histc
Edge vector must be monotonically non-decreasing.

Error in hist (line 126)
    nn = histc(y,edgesc,1);

Error in feComputeEvidence (line 25)
[se.lesion.hist,   se.lesion.xhist]   = hist(se.lesion.rmse.all,  se.bins);

Error in demo_LiFE (line 252)
se = feComputeEvidence(prob.rmse,det.rmse); 

When I checked the values of "y" and "edgesc", both contained NaNs. Can you please guide what am I doing wrong? I am using MATLAB 2018a on Windows OS.

Can anyone help me with this?

francopestilli commented 3 years ago

dear @sarwart unfortunately i am back from medical leave only now. The routines that do the groundwork are not compiled for Windows. The code should work on Mac OSX and Linux (Ubuntu/Fedora).

If you are interested, it would be great if you wanted to try to compile them for Windows systems and make a pull request. You can find the files in this folder: https://github.com/brain-life/encode/tree/master/mexfiles

@bcmcpher

francopestilli commented 3 years ago

@sarwart one option for you could be to try the containerized version of the code: https://doi.org/10.25663/bl.app.1 or https://doi.org/10.25663/bl.app.104

sarwart commented 3 years ago

dear @sarwart unfortunately i am back from medical leave only now. The routines that do the groundwork are not compiled for Windows. The code should work on Mac OSX and Linux (Ubuntu/Fedora).

If you are interested, it would be great if you wanted to try to compile them for Windows systems and make a pull request. You can find the files in this folder: https://github.com/brain-life/encode/tree/master/mexfiles

@bcmcpher

Thanks @francopestilli , I will run this on Linux platform and may try to run the containerized version too.

sarwart commented 3 years ago

I tried to run the code on HPC system (high performance computing) but it ended up with the same error (linux based system). I simply tried running demo_LiFE.m. I tried using the Matlab 2019 and 2020 (the only available options on the HPC system)

Do I need to perform any preprocessing which I have missed?

sarwart commented 3 years ago

I also compiled the files for windows but it didn't work. Currently, I have successfully used the containerized version but there are some 'NaN' weights for the streamlines e.g.

0 0.000883973242981022 0 NaN 0 0.000146038590699469 0 0 3.41404364868276e-05 0

I have used the demo dataset (dwi and tracks only- without t1). Why are there 'NaN' for the streamline weights? Can I consider them as zero weights?

bcmcpher commented 3 years ago

Hi @sarwart

Are you still having issues? I didn't produce any nan weights when I checked the tutorial data. Is this still the unmodified script?

Was this result with encode cloned from github or the container?

sarwart commented 3 years ago

Hi @sarwart

Are you still having issues? I didn't produce any nan weights when I checked the tutorial data. Is this still the unmodified script?

Was this result with encode cloned from github or the container?

The result was from the container (https://doi.org/10.25663/bl.app.104)

bcmcpher commented 3 years ago

So I was able to run the Stanford tutorial data with MATLAB 2020a and the container (compiled from MATLAB 2019a) in Linux with no errors and I didn't get any NaN weights. This most likely means something is different in your overall MATLAB environment.

Can you give some more details about how you're set up? You said you were running in Windows, correct?

sarwart commented 3 years ago

For Linux, I used HPC for running the code so I don't have any control on the overall setting of the environment. I loaded the MATLAB module, added the specified folder and dataset to the current path and executed the demo_LiFE.m scripts. For this I received NaN weights

For windows, I generated the mex files and repeated the above process but still I received the same NaN weights

mex -v Mtransp_times_b.c  Mtransp_times_b_sub.c
mex -v compute_diag.c compute_diag_sub
mex -v M_times_w.c M_times_w_sub.c

Using the containerised version, some of the streamlines had 'NaN' weights but not all of them like the previous cases. This was for the dataset provided for the demo. When I checked it with another HCP data, I didn't receive any NaNs for the weights