Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory Error in group_binfile_parcellation #6

Open
mehrshadg opened this issue Feb 14, 2017 · 4 comments
Open

Memory Error in group_binfile_parcellation #6

mehrshadg opened this issue Feb 14, 2017 · 4 comments

Comments

@mehrshadg
Copy link

Hey,

I am using this package to parcellate 60 fMRI data. When I run the group_binfile_parcellation script, I get Memory Error. My computer has 16 GB of RAM. I read the code and the line in which you are calculating:
W=W + csc_matrix((ones(len(sparse_i)),(sparse_i,sparse_j)), (n_voxels,n_voxels),dtype=double)
raises Memory Error after about 4 data are processed. So I changed it to
W+=csc_matrix((ones(len(sparse_i)),(sparse_i,sparse_j)), (n_voxels,n_voxels),dtype=double)
to prevent numpy from creating another array. But again the error occurred after 7 data.

Is there a way to workaround this issue? Somehow optimizing the code? I am not familiar with Python and its optimization techniques.

@ccraddock
Copy link
Owner

ccraddock commented Feb 14, 2017 via email

@mehrshadg
Copy link
Author

Yes I used a gray matter mask. I created an average binary gray matter mask and then standard it to the MNI 152. Each of my functional data are also standardized to MNI 152. For functional TR is 2.2. The mask contains 181676 non-zero and 720953 zero voxels. I used (nibabel.load(gm_mask_standard).get_data().flatten() > 0).sum() to calculate total number of non-zero voxels

@ccraddock
Copy link
Owner

ccraddock commented Feb 16, 2017 via email

@mehrshadg
Copy link
Author

The original structural and functional voxel sizes are 1mm and 3mm isometric, but when I created the structural mask I standardized both my mask and my functional data to MNI 152 with 2mm isometric voxels. So based on what I have understand, you are telling my to down sample my mask to 3mm voxels, and standardize both the data and mask with 3mm voxels?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants