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

automatic vectorization and new plots #7

Open
wants to merge 16 commits into
base: master
Choose a base branch
from

Conversation

dowdlelt
Copy link

Been meaning to commit this for a while. I'm not familiar with the whole pull request process, but I figure I need to start somewhere.

I've added a new opt, 'opt.reconmask', which allows the user to provide a binary mask (with the same dimensions as their 3D data) that includes the brain only voxels (i.e. excludes air, perhaps some skull). Depending on the volume reduction, which can be substantial for whole brain data, this can provide substantial speed ups and also conserves RAM.

In addition, I added plots of the PC timecourses below the PC figures, because I just like looking at more of my data. The recon mask is also used to convert the data back to X x Y x Z format for figure creation.

I am not at all a proficient MATLAB user - so I imagine my commits are inelegant, but as far as my testing goes, I don't believe I have broken anything (fingers crossed).

Adding a comment so I can learn a bit about pull requests
If the 4D data is provided in an XYZxTime format, with no zeroes, that is the data was masked and then all the zeros removed the dramatically reduce memory usage:

data1_vec = reshape(data1, [],t_dim);
mask_ind = mask(:,:,:,1) ~= 0;

data1_vec_reduced = data1_vec(mask_ind,:);

and the user provides the original mask image in opt.reconmask, this will now reconstruct the 3d images from the reduced vector at the very end, thus generating all of the pretty plots for quite data evaluation. 

Also, this will now plot the timecourses of the PCs beneath the PC maps - though it is not as elegant as Kendrick's method.
Added a bit about the opt.reconmask to the help section and changed the subplot dimensions so that the PC weight map is larger relative to the PC regressor plot.
If a logical mask is provided in the opt.reconmask field, the code will
now vecotorize the data prior to the heavy lifting, and then, using the
earlier commit, put things back together. This is cheaper than buying
more ram.
Made the PC figures slightly prettier, and tested the auto vectorizer on
my own data. Appears to work, but further validation is needed.
This reverts commit 687fccc.
***WIll break other options that use masks (HRFfitmask, etc)***
Also, uploaded example data by mistake. removed.
If the user provides other mask in opt (hrffitmask, brainexclude,
pcR2cutoffmask) then the code should now vectorize those as well - but I
haven't tested it extensively.
Git isn't hard...its just that I don't know what I'm doing. Now, this
will change add in a few more loops to vectorize masks if they are
provided. As I mentioned previously, not extensively tested.
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

Successfully merging this pull request may close these issues.

1 participant