SlicerDMRI / whitematteranalysis

White matter tractography clustering and more...
https://dmri.slicer.org/whitematteranalysis/
Other
69 stars 34 forks source link

Memory Issues: Unable to locate 25,7 GiB #124

Open AlbertoImg opened 1 year ago

AlbertoImg commented 1 year ago

Hi whitematteranalysis team,

I am having RAM issues running the wm_apply_ORG_atlas_to_subject.sh script with dMRI data. I get "Unable to locate 25,7 Gib for an array with shape (2500, 1379526) and data type float64" during "wm_cluster_from_atlas.py".

The computer has available 44 GB RAM + 48 GB swap, but still the program crushes. Other servers we have available dont allow us to run xvbf-run (xauth applications) required by the script.

Our input: dMRI data: 144x144x92x214(AP-PA) cmrr mb sequence whole brain tracks from ukf: 9.93 GB Slicer 5.2 Time running until failure: 1h30min Program crushes using n =4 or n=8, num of cores. code: wm_apply_ORG_atlas_to_subject.sh -i dwi/ukf_out/tracts.vtk -a $Atlas_PATH \ -s $Slicer_PATH -m "$Slicer_PATH --launch $FiberTractMeasurements_PATH/FiberTractMeasurements" -n 8 \ -o dwi/wma800 -x 1 -d 1

I would like to ask you whether you have any advice on how to handle this memory issue. Why is so much memory required? Am I missing /doing something wrong here? is there a way to split the whole brain tracks analysis?

Thanks in advance Best Alberto

ljod commented 1 year ago

Hi I believe we have scripts to split up the tractography into subfiles that will work for you. Fan Zhang is the best person to provide information on this @zhangfanmark

zhangfanmark commented 1 year ago

Hi @AlbertoImg

The first thing I suggest is the set n=1, just using one thread, which will reduce the memory usage.

In addition, you have about 1.5m streamlines in your tractography data. This is larger than what is needed to identify white matter tracts defined in our atlas. Usually, 0.5m is sufficient if you are using our UKF tractography, and probably other algorithms such as ifod2. So you could consider downsample the tractography data if possible. We have a script wm_preprocessing_all.py to do that.

Then, if the above two solutions did not work, you can try what Lauren suggested. In this case, you will need to split the tractography data into severals parts (maybe 3 or 4) and process them individually, and later combine the results together for final output. But there are several details need to be considered. We can provide further details and help if you choose to do this.

Regards, Fan

AlbertoImg commented 1 year ago

Thanks both! I will take a look at the tools you mentioned to pre-process the tracks Thanks again! Best Alberto

AlbertoImg commented 1 year ago

Hi again, I ran the "wm_preprocessing_all.py" with -f 500000, and wm_apply_ORG_atlas_to_subject and it worked!! It reduced the number of fibers 500000/1539970. Thanks!

I would like to ask you what the potential issues of reducing from 1.5M to 0.5M the number of fiber are, and whether 0.5M is an optimal value or if I should try to find a higher value (that our VM + RAM system tolerates).

Thanks again Best Alberto