[FieldTrip] Problems with Fieldtrip MR/CT Processing Workflow on PC

Schoffelen, J.M. (Jan Mathijs) jan.schoffelen at donders.ru.nl
Fri Feb 7 09:35:23 CET 2020

Dear Jonathon,

Indeed, Freesurfer typically used to run only on Linux/Mac. However, rumour has it that as of Windows 10 , freesurfer might run on Windows. For this you’d need to check out the Freesurfer documentation. If you need to run the Freesurfer recon-all pipeline to extract cortical meshes and/or a surface hull, you’d need to find out how to execute this processing step yourself.

With respect to the message you get from ft_hastoolbox: this refers to the availability (to matlab) of the relevant freesurfer code that uses Matlab (which are mainly functions related to loading Freesurfer specific file-formats into matlab for further processing). These functions in principle should work also on windows, with one possible exception, and that is the on-the-fly decompression of compressed anatomical images, which seems to be the problem that you are running into. I improved the Windows support for reading in zipped MR-images (*.nii.gz, and *.mgz) last December, and on my end it seems to work with a current version of the FieldTrip code. I should note, however, that I recently ran a training event, where several participants still did not manage to read in the zipped files on their own (Windows) laptops. This could have been due to their strange keyboard layouts (German/French/Asian etc.), but more likely this was the consequence of an interaction between Windows version, Matlab version and the students’ position in the room.

Long story short: could you upgrade to a more recent version of the Fieldtrip code (early January onwards to be safe), and check whether your problem persists?

Best wishes,


J.M.Schoffelen, MD PhD
Associate PI, VIDI-fellow - PI, language in interaction
Telephone: +31-24-3614793
Physical location: room 00.028
Donders Centre for Cognitive Neuroimaging, Nijmegen, The Netherlands

On 7 Feb 2020, at 00:33, Jonathon James Parker <parkerjo at stanford.edu<mailto:parkerjo at stanford.edu>> wrote:

Dear Fieldtrippers:

I am working to setup my imaging analysis pipeline to co-localize my SEEG electrodes from CT with patient-specific MRIs.

I am running fieldtrip August 2019 Build with Matlab 2017a on a Windows 10 machine. I am running into some errors which I suspect are due to the freesurfer dependency.

When I run ft_hastoolbox(‘freesurfer’) it returns 1, which I don’t quite understand as I thought freesurfer was only Mac/Linux? When I look in my fieldtrip external directory there is a freesurfer folder with some matlab files in there.

Are you aware of any work-arounds that will allow me to process the CT/MR images still using fieldtrip?

The specific files I am processing are nii.gz (indentified by field trip as nifti_fsl)

When I call ft_read_mri() I get the following results:
Uncompressing stan2_ct.nii.gz to /tmp/tmp2696491.nii
The system cannot find the path specified.
ERROR: could not read /tmp/tmp2696491.nii
'rm' is not recognized as an internal or external command,
operable program or batch file.
ERROR: loading stan2_ct.nii.gz as analyze
Struct contents reference from a non-struct array object.

Error in ft_read_mri (line 396)
    ndims = numel(size(tmp.vol));

Error in jpImagingPipeline (line 12)
ct = ft_read_mri(ct_filename);

Thanks in advance!

Jonathon J. Parker MD, PhD
Resident in Neurosurgery
Morgridge Endowed Postdoctoral Fellow
Maternal & Child Health Research Institute
Department of Neurosurgery
Stanford University
E: parkerjo at stanford.edu<mailto:parkerjo at stanford.edu>

fieldtrip mailing list

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20200207/7e59d668/attachment.htm>

More information about the fieldtrip mailing list