Help with CSI (nii) overlay on structural images (nii) MATLAB

Hi All,

I would want to be able to visualize the CSI grid on structural images. I know this is already possible with fsleyes but would want to be able to do this in the MATLAB environment. And also be able to select and average the voxels for further processing.

Here is code that I have so far, if anyone is interested in this or can help. The transformation is from CSI space to image space. I’m quite confident it works for transversal scans on our Siemens MRI, but maybe not for other orientations or vendors. It also requires pythons nibabal.

I use the spec2nii to convert the CSI, and dcmniix to convert the structural images.

Paul
overlay_grid.m (8.1 KB)

Coding this yourself in Matlab robustly would be a lot of work, with many pitfalls (trust me I have fallen into them). May I suggest you load the images in fsleyes, then use fsleyes’s mask creation tool, to mark the voxels you want to average, then load the resulting mask nifti file into Matlab and then use that mask (in Matlab) to index and average the voxels.

1 Like