Hi, I am trying to learn nipy / python tools for analyzing fMRI data. In the past I’ve always used MATLAB. I have >15yrs experience with Matlab, including with MRI data, and not a lot of experience with Python, to set the scene…
Anyways, once I got a dataset of my own pre-processed using some of the tutorial code from nipype, I started computing some basic statistical stuff to get more familiar just with the environment. My first mistake, it seems was this:
for data in dataset:
D = nb.load_img
dat.append(nb.load(fpath + data.fname).get_fdata())
dat is now a list of EPI series in the form of numpy arrays, i.e. dat = [[64x64x24x188], [64x64x24x188], …]
Now I can treat numerically it to my heart’s delight. I am basically using Python as a MATLAB.
But then, I think, I’d like to visualize some of this, or start to make use of some tools. Nilearn.plotting has some things I’d like to try, e.g. plotting.plot_stat_map().
But now I am stuck, because the input to plot_stat_map(img), or just about anything else interesting, is a nifti object, not a numpy array.
I thought that perhaps I could take a nifti image of the dataset, e.g.:
D = nb.load(fpath + fname)
and switch out (with adjustments) the raw data for my processed numbers, and then view this. But I don’t understand how to even start. So, perhaps, I could have been processing it from the start while keeping the object format? Or… how should I be going about this?
Is it possible to ‘synthesize’ a nifti object, e.g. using an existing one (and all that it knows about the alignment, scale, etc, of the raw data) and processed numerical data? Or is this stupid or illegal to consider?
Basically, I want to do whatever I like with the numbers in the volume, but still interact with the environment. That’s my level. If my situation is clear to anyone I would appreciate any pointers or suggestions, relevant tutorials etc.
Thanks!
-andrew