help > Origin issues
Showing 1-5 of 5 posts
Results per page:
Sep 13, 2013  12:09 PM | William Hedley Thompson
Origin issues

I am quite new to this/these dataset(s), so I apologise if this is a stupid question.

I have downloaded three datasets so far (Bangor, Oxford and New York b) and have encountered a similar problem in all of them (although new york b is by far the best so far). I plan on using my own batch preprocessing pipeline using SPM and FSL instead of the automated scripts provided here. What I have noticed is the origin is very far off in these datasets. The origin ([0 0 0]mm), in many subjects is set outside the brain. I looked mainly in the Oxford dataset and it appears the origin is off by approximately the same amount in every subject. The origins are so far off that they do not work in my pipeline and have to be corrected manually (which is going to be a real pain to do 1000 times) 

This seems a bit weird to me though. I would have thought that part of the quality control would be making the origin quite central so everyone does not need to review/correct this. It seems like it would take a lot of time correcting for each origin independently.

I guess I have three questions:

1. Is this a known issue? (I've not been able to find anything about it here). 1b. Or am I doing something wrong?
2. Is it taken into account of in the custom preprocessing scripts provided here? (which is the only answer that I can think of for 1)
3. Does anyone know of a way to automatically correct the origin, given that it is a fixed amount for each dataset? (my current guess is to find out approximately how much each dataset is off and try and fix in automatically in SPM.)

Thanks in advance, and my apologies if this question is stupid or me doing something incorrectly.

Sep 16, 2013  02:09 PM | Ged Ridgway
RE: Origin issues
Hi William,

If it's off by a constant amount each time then this should be easy to fix.

In SPM12-beta, click the "Display" button, select one of your images, click around until you have the cursor at or near the anterior commissure, then just click "Set Origin", then click "Reorient..." and select as many images as you would like to apply the same reorientation to, then click "done". You will be prompted whether you want to save the reorientation matrix for future use, which is worth doing if only as record-keeping.

In SPM8, "Display" an image and find the AC, but now you need to make a note of the current mm coordinates of the AC, e.g. [110 35 -49], then enter the negated versions of these three values (i.e. -110, -35, 49) in the "right", "forward" and "up" parameter boxes, then click "Reorient images..." and select all the images.

It's worth using display (or "Check Reg") again afterwards to double check that things look correct.

I hope that helps,

P.S. For more on finding the AC see e.g.

P.P.S. For the record, if the origin is inconsistently wrong in a data-set, you can usually get something close enough by writing a script that matches the intensity-centroid of your images to that of a similar looking template (i.e. same MRI contrast, and similar sequence with similar field of view if possible). This is reasonably easy, though not trivial, to do in MATLAB/SPM using spm_vol, spm_read_vols (with the second XYZ output argument) and spm_get_space. This won't fix wildly wrong orientation though, e.g. 90 or 180 degree rotations (I tried matching second moments once but it didn't work well enough to be worth the trouble), and nothing will reliably fix incorrect handedness, so it's typically better to redo the DICOM to NIfTI conversion correctly if possible.
Sep 16, 2013  03:09 PM | Maarten Mennes
RE: Origin issues
Hello William,

It's a yes/no as to whether this is a know issue with the dataset. It hadn't occurred to us as the pipeline we use is fsl/afni based, which seems to be more robust to origin location compared to SPM. It's a yes, in the sense that I've hear other SPM users complain about this issue (the same is true for instance for the ABIDE dataset). I know that those people had written a tool to manually fix all datasets in a relatively speedy way. The person to contact would be Chao-gan Yan from the Child Mind Institute and developer of the REST-fmri matlab toolobx (

Hope this helps,
Jun 28, 2018  01:06 PM | vania karami
RE: Origin issues
I try to reorient my images (OASIS dataset) in SPM12 but when I open them with canonical images I can not see my images and they are all black. Do you know what is my problem and what should I do?

Jun 28, 2018  02:06 PM | vania karami
RE: Origin issues
This is my Matlab Error
Failed 'Segment'
Error using sqrtm (line 35)
Expected input to be finite.
In file "C:\Program Files\MATLAB\R2017a\toolbox\matlab\matfun\sqrtm.m" (???), function "sqrtm" at line 35.
In file "C:\Users\PC4\Desktop\spm12-Copy\spm_preproc8.m" (v7172), function "spm_preproc8" at line 673.
In file "C:\Users\PC4\Desktop\spm12-Copy\spm_preproc_run.m" (v6365), function "run_job" at line 131.
In file "C:\Users\PC4\Desktop\spm12-Copy\spm_preproc_run.m" (v6365), function "spm_preproc_run" at line 41.
In file "C:\Users\PC4\Desktop\spm12-Copy\config\spm_cfg_preproc8.m" (v6952), function "spm_local_preproc_run" at line 450.

The following modules did not run:
Failed: Segment