Segment issue in Osprey

I am working on analysis of a group of spectra obtained with the MEGA-PRESS sequence and am having problems with the segmentation part of the sofware. All other steps in the processing and analysis process work fine. Here is a printout from Matlab that shows what the the error messages look like:.

Timestamp September 15, 2021 18:53:37 Osprey 1.1.0 OspreySeg

Segmenting structural image from dataset 1 out of 4 total datasets…
Error using file2mat
File is smaller than the dimensions say it should be.

Error in file_array/subsref>multifile2mat (line 179)
val(cc(i)+1:cc(i+1)) = file2mat(obj,int64(1),int64(x(y==i)));

Error in file_array/subsref>subfun (line 99)
t = multifile2mat(sobj,varargin{:});

Error in file_array/subsref (line 65)
t = subfun(sobj,args{:});

Error in nifti/subsref>rec (line 221)
t = subsref(t,subs(2:end));

Error in nifti/subsref (line 45)
varargout = rec(opt,subs);

Error in OspreySeg (line 168)
GM_voxmask_vol = GMvol.private.dat(:,:,:slight_smile: .* vol_mask.private.dat(:,:,:);

Error in osp_onSeg (line 46)
MRSCont = OspreySeg(MRSCont);

Error while evaluating UIControl Callback.

Any help on solving this issue would be greatly appreciated.

Hi Jon,

Thanks for reaching out about this!

Looks like a dimension mismatch between the nii file of the coregistered voxel mask and the segmentation map. This shouldn’t be happening as they are both based on the same structural image. But it’s actually hard to figure this out without having the files at hand.

Would you mind sharing the data, including the spectra and images? You can either share them here or mail me directly.


PS: Interesting automated emoji generation in the code :smiley: should always look like this

Thank you for the reply, Helge. Here is a link to the files on my Google drive. Please let me know when you have downloaded the files so I can delete the link,

Best wishes,

I’ve just downloaded the files.

As these are GE data, do you have the DICOM T1 as well or could you tell me what tool you have used to generate the nifti file?


I got the data from my colleague Greger Orädd who also works in Umeå. He has retired recently but I will ask him how he generated the niftii file.


The conversion to niftii was done with Chris Rorden’s dcm2nii. I can dig out the dicom files if needed.


Hi Jon,

I’m currently hunting down another issue with GE/nifti voxel placement issues, and I’ve been looking into your data as well. With my current work-in-progress code (not yet on GitHub), I can run the segmentation with your files. However, I’m not sure if those voxel positions do make sense.

Can you confirm those for me, or do you have any reference images (e.g., from the scanner)

P48128_Voxel_1_OspreyCoregSeg.pdf (606.5 KB)
P45056_Voxel_1_OspreyCoregSeg.pdf (639.4 KB)
P43008_Voxel_1_OspreyCoregSeg.pdf (639.4 KB)
P39936_Voxel_1_OspreyCoregSeg.pdf (606.5 KB)


Voxelplacering till Jon.pdf (176.6 KB)

Here is the information on location of the MRS voxels that I have been able to get so far. Please let me know if this is of any use.


1 Like

Hi @joha09 and @Helge,

I thought it may be helpful to let you know that I have also received this error message (using Siemens data) but it is specific to when the voxel of interest is positioned on an angle not consistent with the slice angle. That is, the segmentation works fine when I position the VOI in line with the slices but when I choose to place the VOI on an angle along the motor cortex for instance, Osprey doesn’t like it (and I get exactly the same error message as Jon). I’m guessing that the matrix isn’t the same size in every dimension (the number of x and y values don’t always match along the z axis) and this is causing problems.

Please let me know how you get on - it would be good to know whether it is the same issue.

Best wishes,

Hello! I know this was posted a while back, but I was wondering if you managed to resolve this issue as I am getting the same error message when trying to segment the data.

All the best,

Hi @stella14,

In my case, this happened during piloting and only happened with one participant so I figured it was something to do with the data itself. I didn’t get the same error again so wasn’t too concerned. Is this happening with all of your participants? I’m afraid I never took if further so can’t be of more help but maybe @Helge or @admin would know what’s going on?

Best of luck,

Hi @CarolynMcNabb,

Thank you so much for the reply. I had only tried with one participant, but my colleague managed to run the same data without issues. I guess it’s true that it could’ve some bad data so I’ll have a go and try it on my other participants to see if I get the same thing! Weirdly enough, I reran the data a couple of weeks later without issues, so perhaps it could be a bug?

All the best,

1 Like