Psychedelics align brain activity with context.
The 3 matches
- [1] § Methods › MRI acquisition ↔ functions_matlab/cifti-matlab-master/ft_cifti/private/ft_filetype.m, lines 1164–1223 · score 0.58 · Neuroimaging Informatics Technology, Initiative
- [2] § Methods › EEG acquisition ↔ functions_matlab/cifti-matlab-master/ft_cifti/private/ft_filetype.m, lines 507–562 · score 0.56 · BrainVision, Brain Products, head, EEG
- [3] § Methods › MRI preprocessing and cleaning ↔ demo_eigenmode_calculation.sh, lines 1–51 · score 0.54 · FreeSurfer, cortical surface, template, hemisphere
Paper
Loaded from Europe PMC by your browser, not stored by OSCR: doi.org · Europe PMC
The paper is loaded when this pane is shown.
The authors' code
MATLAB · 1,431 lines · 64 KB · Apache-2.0 · 2 matches
- function [type] = ft_filetype(filename, desired, varargin)
- % FT_FILETYPE determines the filetype of many EEG/MEG/MRI data files by
- % looking at the name, extension and optionally (part of) its contents.
- % It tries to determine the global type of file (which usually
- % corresponds to the manufacturer, the recording system or to the
- % software used to create the file) and the particular subtype (e.g.
- % continuous, average).
- %
- % Use as
- % type = ft_filetype(filename)
- % type = ft_filetype(dirname)
- %
- % This gives you a descriptive string with the data type, and can be
- % used in a switch-statement. The descriptive string that is returned
- % usually is something like 'XXX_YYY'/ where XXX refers to the
- % manufacturer and YYY to the type of the data.
- %
- % Alternatively, use as
- % flag = ft_filetype(filename, type)
- % flag = ft_filetype(dirname, type)
- % This gives you a boolean flag (0 or 1) indicating whether the file
- % is of the desired type, and can be used to check whether the
- % user-supplied file is what your subsequent code expects.
- %
- % Alternatively, use as
- % flag = ft_filetype(dirlist, type)
- % where the dirlist contains a list of files contained within one
- % directory. This gives you a boolean vector indicating for each file
- % whether it is of the desired type.
- %
- % Most filetypes of the following manufacturers and/or software programs are recognized
- % - 4D/BTi
- % - AFNI
- % - ASA
- % - Analyse
- % - Analyze/SPM
- % - BESA
- % - BrainSuite
- % - BrainVisa
- % - BrainVision
- % - Curry
- % - Dataq
- % - EDF
- % - EEProbe
- % - Elektra/Neuromag
- % - FreeSurfer
- % - LORETA
- % - Localite
- % - MINC
- % - Neuralynx
- % - Neuroscan
- % - Plexon
- % - SR Research Eyelink
- % - SensoMotoric Instruments (SMI) *.txt
- % - Tobii *.tsv
- % - Stanford *.ply
- % - Tucker Davis Technology
- % - VSM-Medtech/CTF
- % - Yokogawa
- % - nifti, gifti
- % Copyright (C) 2003-2013 Robert Oostenveld
- %
- % This file is part of FieldTrip, see http://www.fieldtriptoolbox.org
- % for the documentation and details.
- %
- % FieldTrip is free software: you can redistribute it and/or modify
- % it under the terms of the GNU General Public License as published by
- % the Free Software Foundation, either version 3 of the License, or
- % (at your option) any later version.
- %
- % FieldTrip is distributed in the hope that it will be useful,
- % but WITHOUT ANY WARRANTY; without even the implied warranty of
- % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- % GNU General Public License for more details.
- %
- % You should have received a copy of the GNU General Public License
- % along with FieldTrip. If not, see <http://www.gnu.org/licenses/>.
- %
- % $Id$
- % these are for remembering the type on subsequent calls with the same input arguments
- persistent previous_argin previous_argout previous_pwd
- if nargin<2
- % ensure that all input arguments are defined
- desired = [];
- end
- current_argin = {filename, desired, varargin{:}};
- current_pwd = pwd;
- if isequal(current_argin, previous_argin) && isequal(current_pwd, previous_pwd)
- % don't do the detection again, but return the previous value from cache
- type = previous_argout{1};
- return
- end
- if isa(filename, 'memmapfile')
- filename = filename.Filename;
- end
- % % get the optional arguments
- % checkheader = ft_getopt(varargin, 'checkheader', true);
- %
- % if ~checkheader
- % % assume that the header is always ok, e.g when the file does not yet exist
- % % this replaces the normal function with a function that always returns true
- % filetype_check_header = @filetype_true;
- % end
- if iscell(filename)
- if ~isempty(desired)
- % perform the test for each filename, return a boolean vector
- type = false(size(filename));
- else
- % return a string with the type for each filename
- type = cell(size(filename));
- end
- for i=1:length(filename)
- if strcmp(filename{i}(end), '.')
- % do not recurse into this directory or the parent directory
- continue
- else
- if iscell(type)
- type{i} = ft_filetype(filename{i}, desired);
- else
- type(i) = ft_filetype(filename{i}, desired);
- end
- end
- end
- return
- end
- % start with unknown values
- type = 'unknown';
- manufacturer = 'unknown';
- content = 'unknown';
- if isempty(filename)
- if isempty(desired)
- % return the "unknown" outputs
- return
- else
- % return that it is a non-match
- type = false;
- return
- end
- end
- % the parts of the filename are used further down
- if isdir(filename)
- [p, f, x] = fileparts(filename);
- p = filename; % the full path to the directory name
- d = f; % the last part of the directory name
- f = '';
- x = '';
- else
- [p, f, x] = fileparts(filename);
- end
- % prevent this test if the filename resembles an URI, i.e. like "scheme://"
- if isempty(strfind(filename , '://')) && isdir(filename)
- % the directory listing is needed below
- ls = dir(filename);
- % remove the parent directory and the directory itself from the list
- ls = ls(~strcmp({ls.name}, '.'));
- ls = ls(~strcmp({ls.name}, '..'));
- for i=1:length(ls)
- % make sure that the directory listing includes the complete path
- ls(i).name = fullfile(filename, ls(i).name);
- end
- end
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % start determining the filetype
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % this checks for a compressed file (of arbitrary type)
- if filetype_check_extension(filename, 'zip')...
- || (filetype_check_extension(filename, '.gz') && ~filetype_check_extension(filename, '.nii.gz'))...
- || filetype_check_extension(filename, 'tgz')...
- || filetype_check_extension(filename, 'tar')
- type = 'compressed';
- manufacturer = 'undefined';
- content = 'unknown, extract first';
- % these are some streams for asynchronous BCI
- elseif filetype_check_uri(filename, 'fifo')
- type = 'fcdc_fifo';
- manufacturer = 'Donders Centre for Cognitive Neuroimaging';
- content = 'stream';
- elseif filetype_check_uri(filename, 'buffer')
- type = 'fcdc_buffer';
- manufacturer = 'Donders Centre for Cognitive Neuroimaging';
- content = 'stream';
- elseif filetype_check_uri(filename, 'mysql')
- type = 'fcdc_mysql';
- manufacturer = 'Donders Centre for Cognitive Neuroimaging';
- content = 'stream';
- elseif filetype_check_uri(filename, 'tcp')
- type = 'fcdc_tcp';
- manufacturer = 'Donders Centre for Cognitive Neuroimaging';
- content = 'stream';
- elseif filetype_check_uri(filename, 'udp')
- type = 'fcdc_udp';
- manufacturer = 'Donders Centre for Cognitive Neuroimaging';
- content = 'stream';
- elseif filetype_check_uri(filename, 'rfb')
- type = 'fcdc_rfb';
- manufacturer = 'Donders Centre for Cognitive Neuroimaging';
- content = 'stream';
- elseif filetype_check_uri(filename, 'serial')
- type = 'fcdc_serial';
- manufacturer = 'Donders Centre for Cognitive Neuroimaging';
- content = 'stream';
- elseif filetype_check_uri(filename, 'global')
- type = 'fcdc_global';
- manufacturer = 'Donders Centre for Cognitive Neuroimaging';
- content = 'global variable';
- elseif filetype_check_uri(filename, 'shm')
- type = 'ctf_shm';
- manufacturer = 'CTF';
- content = 'real-time shared memory buffer';
- elseif filetype_check_uri(filename, 'empty')
- type = 'empty';
- manufacturer = 'Donders Centre for Cognitive Neuroimaging';
- content = '/dev/null';
- % known CTF file types
- elseif isdir(filename) && filetype_check_extension(filename, '.ds') && exist(fullfile(filename, [f '.res4']), 'file')
- type = 'ctf_ds';
- manufacturer = 'CTF';
- content = 'MEG dataset';
- elseif isdir(filename) && ~isempty(dir(fullfile(filename, '*.res4'))) && ~isempty(dir(fullfile(filename, '*.meg4')))
- type = 'ctf_ds';
- manufacturer = 'CTF';
- content = 'MEG dataset';
- elseif filetype_check_extension(filename, '.res4') && (filetype_check_header(filename, 'MEG41RS') || filetype_check_header(filename, 'MEG42RS') || filetype_check_header(filename, 'MEG4RES') || filetype_check_header(filename, 'MEG3RES')) %'MEG3RES' pertains to ctf64.ds
- type = 'ctf_res4';
- manufacturer = 'CTF';
- content = 'MEG/EEG header information';
- elseif filetype_check_extension(filename, '.meg4') && (filetype_check_header(filename, 'MEG41CP') || filetype_check_header(filename, 'MEG4CPT')) %'MEG4CPT' pertains to ctf64.ds
- type = 'ctf_meg4';
- manufacturer = 'CTF';
- content = 'MEG/EEG';
- elseif strcmp(f, 'MarkerFile') && filetype_check_extension(filename, '.mrk') && filetype_check_header(filename, 'PATH OF DATASET:')
- type = 'ctf_mrk';
- manufacturer = 'CTF';
- content = 'marker file';
- elseif filetype_check_extension(filename, '.mri') && filetype_check_header(filename, 'CTF_MRI_FORMAT VER 2.2')
- type = 'ctf_mri';
- manufacturer = 'CTF';
- content = 'MRI';
- elseif filetype_check_extension(filename, '.mri') && filetype_check_header(filename, 'CTF_MRI_FORMAT VER 4', 31)
- type = 'ctf_mri4';
- manufacturer = 'CTF';
- content = 'MRI';
- elseif filetype_check_extension(filename, '.hdm')
- type = 'ctf_hdm';
- manufacturer = 'CTF';
- content = 'volume conduction model';
- elseif filetype_check_extension(filename, '.hc')
- type = 'ctf_hc';
- manufacturer = 'CTF';
- content = 'headcoil locations';
- elseif filetype_check_extension(filename, '.shape')
- type = 'ctf_shape';
- manufacturer = 'CTF';
- content = 'headshape points';
- elseif filetype_check_extension(filename, '.shape_info')
- type = 'ctf_shapeinfo';
- manufacturer = 'CTF';
- content = 'headshape information';
- elseif filetype_check_extension(filename, '.wts')
- type = 'ctf_wts';
- manufacturer = 'CTF';
- content = 'SAM coefficients, i.e. spatial filter weights';
- elseif filetype_check_extension(filename, '.svl')
- type = 'ctf_svl';
- manufacturer = 'CTF';
- content = 'SAM (pseudo-)statistic volumes';
- % known Micromed file types
- elseif filetype_check_extension(filename, '.trc') && filetype_check_header(filename, '* MICROMED')
- type = 'micromed_trc';
- manufacturer = 'Micromed';
- content = 'Electrophysiological data';
- % known Neuromag file types
- elseif filetype_check_extension(filename, '.fif')
- type = 'neuromag_fif';
- manufacturer = 'Neuromag';
- content = 'MEG header and data';
- elseif filetype_check_extension(filename, '.bdip')
- type = 'neuromag_bdip';
- manufacturer = 'Neuromag';
- content = 'dipole model';
- elseif filetype_check_extension(filename, '.eve') && exist(fullfile(p, [f '.fif']), 'file')
- type = 'neuromag_eve'; % these are being used by Tristan Technologies for the BabySQUID system
- manufacturer = 'Neuromag';
- content = 'events';
- % known Yokogawa file types
- elseif filetype_check_extension(filename, '.ave') || filetype_check_extension(filename, '.sqd')
- type = 'yokogawa_ave';
- manufacturer = 'Yokogawa';
- content = 'averaged MEG data';
- elseif filetype_check_extension(filename, '.con')
- type = 'yokogawa_con';
- manufacturer = 'Yokogawa';
- content = 'continuous MEG data';
- elseif filetype_check_extension(filename, '.raw') && filetype_check_header(filename, char([0 0 0 0])) % FIXME, this detection should possibly be improved
- type = 'yokogawa_raw';
- manufacturer = 'Yokogawa';
- content = 'evoked/trialbased MEG data';
- elseif filetype_check_extension(filename, '.mrk') && filetype_check_header(filename, char([0 0 0 0])) % FIXME, this detection should possibly be improved
- type = 'yokogawa_mrk';
- manufacturer = 'Yokogawa';
- content = 'headcoil locations';
- elseif filetype_check_extension(filename, '.txt') && numel(strfind(filename,'-coregis')) == 1
- type = 'yokogawa_coregis';
- manufacturer = 'Yokogawa';
- content = 'exported fiducials';
- elseif filetype_check_extension(filename, '.txt') && numel(strfind(filename,'-calib')) == 1
- type = 'yokogawa_calib';
- manufacturer = 'Yokogawa';
- elseif filetype_check_extension(filename, '.txt') && numel(strfind(filename,'-channel')) == 1
- type = 'yokogawa_channel';
- manufacturer = 'Yokogawa';
- elseif filetype_check_extension(filename, '.txt') && numel(strfind(filename,'-property')) == 1
- type = 'yokogawa_property';
- manufacturer = 'Yokogawa';
- elseif filetype_check_extension(filename, '.txt') && numel(strfind(filename,'-TextData')) == 1
- type = 'yokogawa_textdata';
- manufacturer = 'Yokogawa';
- elseif filetype_check_extension(filename, '.txt') && numel(strfind(filename,'-FLL')) == 1
- type = 'yokogawa_fll';
- manufacturer = 'Yokogawa';
- elseif filetype_check_extension(filename, '.hsp')
- type = 'yokogawa_hsp';
- manufacturer = 'Yokogawa';
- % Neurosim files; this has to go before the 4D detection
- elseif ~isdir(filename) && (strcmp(f,'spikes') || filetype_check_header(filename,'# Spike information'))
- type = 'neurosim_spikes';
- manufacturer = 'Jan van der Eerden (DCCN)';
- content = 'simulated spikes';
- elseif ~isdir(filename) && (strcmp(f,'evolution') || filetype_check_header(filename,'# Voltages'))
- type = 'neurosim_evolution';
- manufacturer = 'Jan van der Eerden (DCCN)';
- content = 'simulated membrane voltages and currents';
- elseif ~isdir(filename) && (strcmp(f,'signals') || filetype_check_header(filename,'# Internal',2))
- type = 'neurosim_signals';
- manufacturer = 'Jan van der Eerden (DCCN)';
- content = 'simulated network signals';
- elseif isdir(filename) && exist(fullfile(filename, 'signals'), 'file') && exist(fullfile(filename, 'spikes'), 'file')
- type = 'neurosim_ds';
- manufacturer = 'Jan van der Eerden (DCCN)';
- content = 'simulated spikes and continuous signals';
- % known 4D/BTI file types
- elseif filetype_check_extension(filename, '.pdf') && filetype_check_header(filename, 'E|lk') % I am not sure whether this header always applies
- type = '4d_pdf';
- manufacturer = '4D/BTI';
- content = 'raw MEG data (processed data file)';
- elseif exist([filename '.m4d'], 'file') && exist([filename '.xyz'], 'file') % these two ascii header files accompany the raw data
- type = '4d_pdf';
- manufacturer = '4D/BTI';
- content = 'raw MEG data (processed data file)';
- elseif filetype_check_extension(filename, '.m4d') && exist([filename(1:(end-3)) 'xyz'], 'file') % these come in pairs
- type = '4d_m4d';
- manufacturer = '4D/BTI';
- content = 'MEG header information';
- elseif filetype_check_extension(filename, '.xyz') && exist([filename(1:(end-3)) 'm4d'], 'file') % these come in pairs
- type = '4d_xyz';
- manufacturer = '4D/BTI';
- content = 'MEG sensor positions';
- elseif isequal(f, 'hs_file') % the filename is "hs_file"
- type = '4d_hs';
- manufacturer = '4D/BTI';
- content = 'head shape';
- elseif length(filename)>=4 && ~isempty(strfind(filename,',rf'))
- type = '4d';
- manufacturer = '4D/BTi';
- content = '';
- elseif filetype_check_extension(filename, '.el.ascii') && filetype_check_ascii(filename, 20) % assume that there are at least 20 bytes in the file, the example one has 4277 bytes
- type = '4d_el_ascii';
- manufacturer = '4D/BTi';
- content = 'electrode positions';
- elseif length(f)<=4 && filetype_check_dir(p, 'config')%&& ~isempty(p) && exist(fullfile(p,'config'), 'file') %&& exist(fullfile(p,'hs_file'), 'file')
- % this could be a 4D file with non-standard/processed name
- % it will be detected as a 4D file when there is a config file in the
- % same directory as the specified file
- type = '4d';
- manufacturer = '4D/BTi';
- content = '';
- % known EEProbe file types
- elseif filetype_check_extension(filename, '.cnt') && (filetype_check_header(filename, 'RIFF') || filetype_check_header(filename, 'RF64'))
- type = 'eep_cnt';
- manufacturer = 'EEProbe';
- content = 'EEG';
- elseif filetype_check_extension(filename, '.avr') && filetype_check_header(filename, char([38 0 16 0]))
- type = 'eep_avr';
- manufacturer = 'EEProbe';
- content = 'ERP';
- elseif filetype_check_extension(filename, '.trg')
- type = 'eep_trg';
- manufacturer = 'EEProbe';
- content = 'trigger information';
- elseif filetype_check_extension(filename, '.rej')
- type = 'eep_rej';
- manufacturer = 'EEProbe';
- content = 'rejection marks';
- % the yokogawa_mri has to be checked prior to asa_mri, because this one is more strict
- elseif filetype_check_extension(filename, '.mri') && filetype_check_header(filename, char(0)) % FIXME, this detection should possibly be improved
- type = 'yokogawa_mri';
- manufacturer = 'Yokogawa';
- content = 'anatomical MRI';
- % known ASA file types
- elseif filetype_check_extension(filename, '.elc')
- type = 'asa_elc';
- manufacturer = 'ASA';
- content = 'electrode positions';
- elseif filetype_check_extension(filename, '.vol')
- type = 'asa_vol';
- manufacturer = 'ASA';
- content = 'volume conduction model';
- elseif filetype_check_extension(filename, '.bnd')
- type = 'asa_bnd';
- manufacturer = 'ASA';
- content = 'boundary element model details';
- elseif filetype_check_extension(filename, '.msm')
- type = 'asa_msm';
- manufacturer = 'ASA';
- content = 'ERP';
- elseif filetype_check_extension(filename, '.msr')
- type = 'asa_msr';
- manufacturer = 'ASA';
- content = 'ERP';
- elseif filetype_check_extension(filename, '.dip')
- % FIXME, can also be CTF dipole file
- type = 'asa_dip';
- manufacturer = 'ASA';
- elseif filetype_check_extension(filename, '.mri')
- % FIXME, can also be CTF mri file
- type = 'asa_mri';
- manufacturer = 'ASA';
- content = 'MRI image header';
- elseif filetype_check_extension(filename, '.iso')
- type = 'asa_iso';
- manufacturer = 'ASA';
- content = 'MRI image data';
- % known BCI2000 file types
- elseif filetype_check_extension(filename, '.dat') && (filetype_check_header(filename, 'BCI2000') || filetype_check_header(filename, 'HeaderLen='))
- type = 'bci2000_dat';
- manufacturer = 'BCI2000';
- content = 'continuous EEG';
- % known Neuroscan file types
- elseif filetype_check_extension(filename, '.avg') && filetype_check_header(filename, 'Version 3.0')
- type = 'ns_avg';
- manufacturer = 'Neuroscan';
- content = 'averaged EEG';
- elseif filetype_check_extension(filename, '.cnt') && filetype_check_header(filename, 'Version 3.0')
- type = 'ns_cnt';
- manufacturer = 'Neuroscan';
- content = 'continuous EEG';
- elseif filetype_check_extension(filename, '.eeg') && filetype_check_header(filename, 'Version 3.0')
- type = 'ns_eeg';
- manufacturer = 'Neuroscan';
- content = 'epoched EEG';
- elseif filetype_check_extension(filename, '.eeg') && filetype_check_header(filename, 'V3.0')
- type = 'neuroprax_eeg';
- manufacturer = 'eldith GmbH';
- content = 'continuous EEG';
- elseif filetype_check_extension(filename, '.ee_')
- type = 'neuroprax_mrk';
- manufacturer = 'eldith GmbH';
- content = 'EEG markers';
- % known Analyze & SPM file types
- elseif filetype_check_extension(filename, '.hdr')
- type = 'analyze_hdr';
- manufacturer = 'Mayo Analyze';
- content = 'PET/MRI image header';
- elseif filetype_check_extension(filename, '.img')
- type = 'analyze_img';
- manufacturer = 'Mayo Analyze';
- content = 'PET/MRI image data';
- elseif filetype_check_extension(filename, '.mnc')
- type = 'minc';
- content = 'MRI image data';
- elseif filetype_check_extension(filename, '.nii') && filetype_check_header(filename, {[92 1 0 0], [0 0 1 92]}) % header starts with the number 348
- type = 'nifti';
- content = 'MRI image data';
- elseif filetype_check_extension(filename, '.nii') && filetype_check_header(filename, {[28 2 0 0], [0 0 2 28]}) % header starts with the number 540
- type = 'nifti2';
- content = 'MRI image data';
- % known FSL file types
- elseif filetype_check_extension(filename, '.nii.gz')
- type = 'nifti_fsl';
- content = 'MRI image data';
- % known LORETA file types
- elseif filetype_check_extension(filename, '.lorb')
- type = 'loreta_lorb';
- manufacturer = 'old LORETA';
- content = 'source reconstruction';
- elseif filetype_check_extension(filename, '.slor')
- type = 'loreta_slor';
- manufacturer = 'sLORETA';
- content = 'source reconstruction';
- % known AFNI file types
- elseif filetype_check_extension(filename, '.brik') || filetype_check_extension(filename, '.BRIK')
- type = 'afni_brik';
- content = 'MRI image data';
- elseif filetype_check_extension(filename, '.head') || filetype_check_extension(filename, '.HEAD')
- type = 'afni_head';
- content = 'MRI header data';
- % known BrainVison file types
- elseif filetype_check_extension(filename, '.vhdr')
- type = 'brainvision_vhdr';
- manufacturer = 'BrainProducts';
- content = 'EEG header';
- elseif filetype_check_extension(filename, '.vmrk')
- type = 'brainvision_vmrk';
- manufacturer = 'BrainProducts';
- content = 'EEG markers';
- elseif filetype_check_extension(filename, '.vabs')
- type = 'brainvision_vabs';
- manufacturer = 'BrainProducts';
- content = 'Brain Vison Analyzer macro';
- elseif filetype_check_extension(filename, '.eeg') && exist(fullfile(p, [f '.vhdr']), 'file')
- type = 'brainvision_eeg';
- manufacturer = 'BrainProducts';
- content = 'continuous EEG data';
- elseif filetype_check_extension(filename, '.seg')
- type = 'brainvision_seg';
- manufacturer = 'BrainProducts';
- content = 'segmented EEG data';
- elseif filetype_check_extension(filename, '.dat') && exist(fullfile(p, [f '.vhdr']), 'file') &&...
- ~filetype_check_header(filename, 'HeaderLen=') && ~filetype_check_header(filename, 'BESA_SA_IMAGE') &&...
- ~(exist(fullfile(p, [f '.gen']), 'file') || exist(fullfile(p, [f '.generic']), 'file'))
- % WARNING this is a very general name, it could be exported BrainVision
- % data but also a BESA beamformer source reconstruction or BCI2000
- type = 'brainvision_dat';
- manufacturer = 'BrainProducts';
- content = 'exported EEG data';
- elseif filetype_check_extension(filename, '.marker')
- type = 'brainvision_marker';
- manufacturer = 'BrainProducts';
- content = 'rejection markers';
- % known Polhemus file types
- elseif filetype_check_extension(filename, '.pos')
- type = 'polhemus_pos';
- manufacturer = 'BrainProducts/CTF/Polhemus?'; % actually I don't know whose software it is
- content = 'electrode positions';
- % known Blackrock Microsystems file types
- elseif strncmp(x,'.ns',3) && (filetype_check_header(filename, 'NEURALCD') || filetype_check_header(filename, 'NEURALSG'))
- type = 'blackrock_nsx';
- manufacturer = 'Blackrock Microsystems';
- content = 'conintuously sampled data';
- elseif filetype_check_extension(filename, '.nev') && filetype_check_header(filename, 'NEURALEV')
- type = 'blackrock_nev';
- manufacturer = 'Blackrock Microsystems';
- contenct = 'extracellular electrode spike information';
- % known Neuralynx file types
- elseif filetype_check_extension(filename, '.nev') || filetype_check_extension(filename, '.Nev')
- type = 'neuralynx_nev';
- manufacturer = 'Neuralynx';
- content = 'event information';
- elseif filetype_check_extension(filename, '.ncs') && filetype_check_header(filename, '####')
- type = 'neuralynx_ncs';
- manufacturer = 'Neuralynx';
- content = 'continuous single channel recordings';
- elseif filetype_check_extension(filename, '.nse') && filetype_check_header(filename, '####')
- type = 'neuralynx_nse';
- manufacturer = 'Neuralynx';
- content = 'spike waveforms';
- elseif filetype_check_extension(filename, '.nts') && filetype_check_header(filename, '####')
- type = 'neuralynx_nts';
- manufacturer = 'Neuralynx';
- content = 'timestamps only';
- elseif filetype_check_extension(filename, '.nvt')
- type = 'neuralynx_nvt';
- manufacturer = 'Neuralynx';
- content = 'video tracker';
- elseif filetype_check_extension(filename, '.nst')
- type = 'neuralynx_nst';
- manufacturer = 'Neuralynx';
- content = 'continuous stereotrode recordings';
- elseif filetype_check_extension(filename, '.ntt')
- type = 'neuralynx_ntt';
- manufacturer = 'Neuralynx';
- content = 'continuous tetrode recordings';
- elseif strcmpi(f, 'logfile') && strcmpi(x, '.txt') % case insensitive
- type = 'neuralynx_log';
- manufacturer = 'Neuralynx';
- content = 'log information in ASCII format';
- elseif ~isempty(strfind(lower(f), 'dma')) && strcmpi(x, '.log') % this is not a very strong detection
- type = 'neuralynx_dma';
- manufacturer = 'Neuralynx';
- content = 'raw aplifier data directly from DMA';
- elseif filetype_check_extension(filename, '.nrd') % see also above, since Cheetah 5.x the file extension has changed
- type = 'neuralynx_dma';
- manufacturer = 'Neuralynx';
- content = 'raw aplifier data directly from DMA';
- elseif isdir(filename) && (any(filetype_check_extension({ls.name}, '.nev')) || any(filetype_check_extension({ls.name}, '.Nev')))
- % a regular Neuralynx dataset directory that contains an event file
- type = 'neuralynx_ds';
- manufacturer = 'Neuralynx';
- content = 'dataset';
- elseif isdir(filename) && most(filetype_check_extension({ls.name}, '.ncs'))
- % a directory containing continuously sampled channels in Neuralynx format
- type = 'neuralynx_ds';
- manufacturer = 'Neuralynx';
- content = 'continuously sampled channels';
- elseif isdir(filename) && most(filetype_check_extension({ls.name}, '.nse'))
- % a directory containing spike waveforms in Neuralynx format
- type = 'neuralynx_ds';
- manufacturer = 'Neuralynx';
- content = 'spike waveforms';
- elseif isdir(filename) && most(filetype_check_extension({ls.name}, '.nte'))
- % a directory containing spike timestamps in Neuralynx format
- type = 'neuralynx_ds';
- manufacturer = 'Neuralynx';
- content = 'spike timestamps';
- elseif isdir(filename) && most(filetype_check_extension({ls.name}, '.ntt'))
- % a directory containing tetrode recordings in Neuralynx format
- type = 'neuralynx_ds';
- manufacturer = 'Neuralynx';
- content = 'tetrode recordings ';
- elseif isdir(p) && exist(fullfile(p, 'header'), 'file') && exist(fullfile(p, 'samples'), 'file') && exist(fullfile(p, 'events'), 'file')
- type = 'fcdc_buffer_offline';
- manufacturer = 'Donders Centre for Cognitive Neuroimaging';
- content = 'FieldTrip buffer offline dataset';
- elseif isdir(filename) && exist(fullfile(filename, 'info.xml'), 'file') && exist(fullfile(filename, 'signal1.bin'), 'file')
- % this is an OS X package directory representing a complete EEG dataset
- % it contains a Content file, multiple xml files and one or more signalN.bin files
- type = 'egi_mff';
- manufacturer = 'Electrical Geodesics Incorporated';
- content = 'raw EEG data';
- elseif ~isdir(filename) && isdir(p) && exist(fullfile(p, 'info.xml'), 'file') && exist(fullfile(p, 'signal1.bin'), 'file')
- % the file that the user specified is one of the files in an mff package directory
- type = 'egi_mff';
- manufacturer = 'Electrical Geodesics Incorporated';
- content = 'raw EEG data';
- % these are formally not Neuralynx file formats, but at the FCDC we use them together with Neuralynx
- elseif isdir(filename) && filetype_check_neuralynx_cds(filename)
- % a downsampled Neuralynx DMA file can be split into three separate lfp/mua/spike directories
- % treat them as one combined dataset
- type = 'neuralynx_cds';
- manufacturer = 'Donders Centre for Cognitive Neuroimaging';
- content = 'dataset containing separate lfp/mua/spike directories';
- elseif filetype_check_extension(filename, '.tsl') && filetype_check_header(filename, 'tsl')
- type = 'neuralynx_tsl';
- manufacturer = 'Donders Centre for Cognitive Neuroimaging';
- content = 'timestamps from DMA log file';
- elseif filetype_check_extension(filename, '.tsh') && filetype_check_header(filename, 'tsh')
- type = 'neuralynx_tsh';
- manufacturer = 'Donders Centre for Cognitive Neuroimaging';
- content = 'timestamps from DMA log file';
- elseif filetype_check_extension(filename, '.ttl') && filetype_check_header(filename, 'ttl')
- type = 'neuralynx_ttl';
- manufacturer = 'Donders Centre for Cognitive Neuroimaging';
- content = 'Parallel_in from DMA log file';
- elseif filetype_check_extension(filename, '.bin') && filetype_check_header(filename, {'uint8', 'uint16', 'uint32', 'int8', 'int16', 'int32', 'int64', 'float32', 'float64'})
- type = 'neuralynx_bin';
- manufacturer = 'Donders Centre for Cognitive Neuroimaging';
- content = 'single channel continuous data';
- elseif isdir(filename) && any(filetype_check_extension({ls.name}, '.ttl')) && any(filetype_check_extension({ls.name}, '.tsl')) && any(filetype_check_extension({ls.name}, '.tsh'))
- % a directory containing the split channels from a DMA logfile
- type = 'neuralynx_sdma';
- manufacturer = 'Donders Centre for Cognitive Neuroimaging';
- content = 'split DMA log file';
- elseif isdir(filename) && filetype_check_extension(filename, '.sdma')
- % a directory containing the split channels from a DMA logfile
- type = 'neuralynx_sdma';
- manufacturer = 'Donders Centre for Cognitive Neuroimaging';
- content = 'split DMA log file';
- % known Plexon file types
- elseif filetype_check_extension(filename, '.nex') && filetype_check_header(filename, 'NEX1')
- type = 'plexon_nex';
- manufacturer = 'Plexon';
- content = 'electrophysiological data';
- elseif filetype_check_extension(filename, '.plx') && filetype_check_header(filename, 'PLEX')
- type = 'plexon_plx';
- manufacturer = 'Plexon';
- content = 'electrophysiological data';
- elseif filetype_check_extension(filename, '.ddt')
- type = 'plexon_ddt';
- manufacturer = 'Plexon';
- elseif isdir(filename) && most(filetype_check_extension({ls.name}, '.nex')) && most(filetype_check_header({ls.name}, 'NEX1'))
- % a directory containing multiple plexon NEX files
- type = 'plexon_ds';
- manufacturer = 'Plexon';
- content = 'electrophysiological data';
- % known Cambridge Electronic Design file types
- elseif filetype_check_extension(filename, '.smr')
- type = 'ced_son';
- manufacturer = 'Cambridge Electronic Design';
- content = 'Spike2 SON filing system';
- % known BESA file types
- elseif filetype_check_extension(filename, '.avr') && strcmp(type, 'unknown')
- type = 'besa_avr'; % FIXME, can also be EEProbe average EEG
- manufacturer = 'BESA';
- content = 'average EEG';
- elseif filetype_check_extension(filename, '.elp')
- type = 'besa_elp';
- manufacturer = 'BESA';
- content = 'electrode positions';
- elseif filetype_check_extension(filename, '.eps')
- type = 'besa_eps';
- manufacturer = 'BESA';
- content = 'digitizer information';
- elseif filetype_check_extension(filename, '.sfp')
- type = 'besa_sfp';
- manufacturer = 'BESA';
- content = 'sensor positions';
- elseif filetype_check_extension(filename, '.ela')
- type = 'besa_ela';
- manufacturer = 'BESA';
- content = 'sensor information';
- elseif filetype_check_extension(filename, '.pdg')
- type = 'besa_pdg';
- manufacturer = 'BESA';
- content = 'paradigm file';
- elseif filetype_check_extension(filename, '.tfc')
- type = 'besa_tfc';
- manufacturer = 'BESA';
- content = 'time frequency coherence';
- elseif filetype_check_extension(filename, '.mul')
- type = 'besa_mul';
- manufacturer = 'BESA';
- content = 'multiplexed ascii format';
- elseif filetype_check_extension(filename, '.dat') && filetype_check_header(filename, 'BESA_SA') % header can start with BESA_SA_IMAGE or BESA_SA_MN_IMAGE
- type = 'besa_src';
- manufacturer = 'BESA';
- content = 'beamformer source reconstruction';
- elseif filetype_check_extension(filename, '.swf') && filetype_check_header(filename, 'Npts=')
- type = 'besa_swf';
- manufacturer = 'BESA';
- content = 'beamformer source waveform';
- elseif filetype_check_extension(filename, '.bsa')
- type = 'besa_bsa';
- manufacturer = 'BESA';
- content = 'beamformer source locations and orientations';
- elseif exist(fullfile(p, [f '.dat']), 'file') && (exist(fullfile(p, [f '.gen']), 'file') || exist(fullfile(p, [f '.generic']), 'file'))
- type = 'besa_sb';
- manufacturer = 'BESA';
- content = 'simple binary channel data with a separate generic ascii header';
- elseif filetype_check_extension(filename, '.sfh') && filetype_check_header(filename, 'NrOfPoints')
- type = 'besa_sfh';
- manufacturer = 'BESA';
- content = 'electrode and fiducial information';
- elseif filetype_check_extension(filename, '.besa')
- type = 'besa_besa';
- manufacturer = 'BESA';
- content = 'electrophysiological data';
- elseif filetype_check_extension(filename, '.srf') && filetype_check_header(filename, [0 0 0 0], 4)
- type = 'brainvoyager_srf';
- manufacturer = 'BrainVoyager'; % see http://support.brainvoyager.com/installation-introduction/23-file-formats/375-users-guide-23-the-format-of-srf-files.html
- content = 'surface';
- % known Dataq file formats
- elseif filetype_check_extension(upper(filename), '.WDQ')
- type = 'dataq_wdq';
- manufacturer = 'dataq instruments';
- content = 'electrophysiological data';
- % old files from Pascal Fries' PhD research at the MPI
- elseif filetype_check_extension(filename, '.dap') && filetype_check_header(filename, char(1))
- type = 'mpi_dap';
- manufacturer = 'MPI Frankfurt';
- content = 'electrophysiological data';
- elseif isdir(filename) && ~isempty(cell2mat(regexp({ls.name}, '.dap$')))
- type = 'mpi_ds';
- manufacturer = 'MPI Frankfurt';
- content = 'electrophysiological data';
- % Frankfurt SPASS format, which uses the Labview Datalog (DTLG) format
- elseif filetype_check_extension(filename, '.ana') && filetype_check_header(filename, 'DTLG')
- type = 'spass_ana';
- manufacturer = 'MPI Frankfurt';
- content = 'electrophysiological data';
- elseif filetype_check_extension(filename, '.swa') && filetype_check_header(filename, 'DTLG')
- type = 'spass_swa';
- manufacturer = 'MPI Frankfurt';
- content = 'electrophysiological data';
- elseif filetype_check_extension(filename, '.spi') && filetype_check_header(filename, 'DTLG')
- type = 'spass_spi';
- manufacturer = 'MPI Frankfurt';
- content = 'electrophysiological data';
- elseif filetype_check_extension(filename, '.stm') && filetype_check_header(filename, 'DTLG')
- type = 'spass_stm';
- manufacturer = 'MPI Frankfurt';
- content = 'electrophysiological data';
- elseif filetype_check_extension(filename, '.bhv') && filetype_check_header(filename, 'DTLG')
- type = 'spass_bhv';
- manufacturer = 'MPI Frankfurt';
- content = 'electrophysiological data';
- % known Chieti ITAB file types
- elseif filetype_check_extension(filename, '.raw') && (filetype_check_header(filename, 'FORMAT: ATB-BIOMAGDATA') || filetype_check_header(filename, '[HeaderType]'))
- type = 'itab_raw';
- manufacturer = 'Chieti ITAB';
- content = 'MEG data, including sensor positions';
- elseif filetype_check_extension(filename, '.raw.mhd')
- type = 'itab_mhd';
- manufacturer = 'Chieti ITAB';
- content = 'MEG header data, including sensor positions';
- elseif filetype_check_extension(filename, '.asc') && ~filetype_check_header(filename, '**')
- type = 'itab_asc';
- manufacturer = 'Chieti ITAB';
- content = 'headshape digitization file';
- % known Nexstim file types
- elseif filetype_check_extension(filename, '.nxe')
- type = 'nexstim_nxe';
- manufacturer = 'Nexstim';
- content = 'electrophysiological data';
- % known Tucker-Davis-Technology file types
- elseif filetype_check_extension(filename, '.tbk')
- type = 'tdt_tbk';
- manufacturer = 'Tucker-Davis-Technology';
- content = 'database/tank meta-information';
- elseif filetype_check_extension(filename, '.tdx')
- type = 'tdt_tdx';
- manufacturer = 'Tucker-Davis-Technology';
- content = 'database/tank meta-information';
- elseif filetype_check_extension(filename, '.tsq')
- type = 'tdt_tsq';
- manufacturer = 'Tucker-Davis-Technology';
- content = 'block header information';
- elseif filetype_check_extension(filename, '.tev')
- type = 'tdt_tev';
- manufacturer = 'Tucker-Davis-Technology';
- content = 'electrophysiological data';
- % raw audio and video data from https://github.com/andreyzhd/VideoMEG
- % the extension *.aud/*.vid is used at NatMEG and *.audio.dat/*.video.dat seems to be used in Helsinki
- elseif (filetype_check_extension(filename, '.aud') || filetype_check_extension(filename, '.audio.dat')) && filetype_check_header(filename, 'ELEKTA_AUDIO_FILE')
- % this should go before curry_dat
- type = 'videomeg_aud';
- manufacturer = 'VideoMEG';
- content = 'audio';
- elseif (filetype_check_extension(filename, '.vid') || filetype_check_extension(filename, '.video.dat')) && filetype_check_header(filename, 'ELEKTA_VIDEO_FILE')
- % this should go before curry_dat
- type = 'videomeg_vid';
- manufacturer = 'VideoMEG';
- content = 'video';
- elseif (filetype_check_extension(filename, '.dat') || filetype_check_extension(filename, '.Dat')) && (exist(fullfile(p, [f '.ini']), 'file') || exist(fullfile(p, [f '.Ini']), 'file'))
- % this should go before curry_dat
- type = 'deymed_dat';
- manufacturer = 'Deymed';
- content = 'raw eeg data';
- elseif (filetype_check_extension(filename, '.ini') || filetype_check_extension(filename, '.Ini')) && (exist(fullfile(p, [f '.dat']), 'file') || exist(fullfile(p, [f '.Dat']), 'file'))
- type = 'deymed_ini';
- manufacturer = 'Deymed';
- content = 'eeg header information';
- elseif filetype_check_extension(filename, '.dat') && (filetype_check_header(filename, [0 0 16 0 16 0], 8) || filetype_check_header(filename, [0 0 16 0 16 0], 0))
- % this should go before curry_dat
- type = 'jaga16';
- manufacturer = 'Jinga-Hi';
- content = 'electrophysiological data';
- % known Curry V4 file types
- elseif filetype_check_extension(filename, '.dap')
- type = 'curry_dap'; % FIXME, can also be MPI Frankfurt electrophysiological data
- manufacturer = 'Curry';
- content = 'data parameter file';
- elseif filetype_check_extension(filename, '.dat')
- type = 'curry_dat';
- manufacturer = 'Curry';
- content = 'raw data file';
- elseif filetype_check_extension(filename, '.rs4')
- type = 'curry_rs4';
- manufacturer = 'Curry';
- content = 'sensor geometry file';
- elseif filetype_check_extension(filename, '.par')
- type = 'curry_par';
- manufacturer = 'Curry';
- content = 'data or image parameter file';
- elseif filetype_check_extension(filename, '.bd0') || filetype_check_extension(filename, '.bd1') || filetype_check_extension(filename, '.bd2') || filetype_check_extension(filename, '.bd3') || filetype_check_extension(filename, '.bd4') || filetype_check_extension(filename, '.bd5') || filetype_check_extension(filename, '.bd6') || filetype_check_extension(filename, '.bd7') || filetype_check_extension(filename, '.bd8') || filetype_check_extension(filename, '.bd9')
- type = 'curry_bd';
- manufacturer = 'Curry';
- content = 'BEM description file';
- elseif filetype_check_extension(filename, '.bt0') || filetype_check_extension(filename, '.bt1') || filetype_check_extension(filename, '.bt2') || filetype_check_extension(filename, '.bt3') || filetype_check_extension(filename, '.bt4') || filetype_check_extension(filename, '.bt5') || filetype_check_extension(filename, '.bt6') || filetype_check_extension(filename, '.bt7') || filetype_check_extension(filename, '.bt8') || filetype_check_extension(filename, '.bt9')
- type = 'curry_bt';
- manufacturer = 'Curry';
- content = 'BEM transfer matrix file';
- elseif filetype_check_extension(filename, '.bm0') || filetype_check_extension(filename, '.bm1') || filetype_check_extension(filename, '.bm2') || filetype_check_extension(filename, '.bm3') || filetype_check_extension(filename, '.bm4') || filetype_check_extension(filename, '.bm5') || filetype_check_extension(filename, '.bm6') || filetype_check_extension(filename, '.bm7') || filetype_check_extension(filename, '.bm8') || filetype_check_extension(filename, '.bm9')
- type = 'curry_bm';
- manufacturer = 'Curry';
- content = 'BEM full matrix file';
- elseif filetype_check_extension(filename, '.dig')
- type = 'curry_dig';
- manufacturer = 'Curry';
- content = 'digitizer file';
- elseif filetype_check_extension(filename, '.txt') && filetype_check_header(filename, '##')
- type = 'smi_txt';
- manufacturer = 'SensoMotoric Instruments (SMI)';
- content = 'eyetracker data';
- % known SR Research eyelink file formats
- elseif filetype_check_extension(filename, '.asc') && filetype_check_header(filename, '**')
- type = 'eyelink_asc';
- manufacturer = 'SR Research (ascii)';
- content = 'eyetracker data';
- elseif filetype_check_extension(filename, '.edf') && filetype_check_header(filename, 'SR_RESEARCH')
- type = 'eyelink_edf';
- manufacturer = 'SR Research';
- content = 'eyetracker data (binary)';
- elseif filetype_check_extension(filename, '.tsv') && (filetype_check_header(filename, 'Data Properties:') || filetype_check_header(filename, 'System Properties:'))
- type = 'tobii_tsv';
- manufacturer = 'Tobii';
- content = 'eyetracker data (ascii)';
- % known Curry V2 file types
- elseif filetype_check_extension(filename, '.sp0') || filetype_check_extension(filename, '.sp1') || filetype_check_extension(filename, '.sp2') || filetype_check_extension(filename, '.sp3') || filetype_check_extension(filename, '.sp4') || filetype_check_extension(filename, '.sp5') || filetype_check_extension(filename, '.sp6') || filetype_check_extension(filename, '.sp7') || filetype_check_extension(filename, '.sp8') || filetype_check_extension(filename, '.sp9')
- type = 'curry_sp';
- manufacturer = 'Curry';
- content = 'point list';
- elseif filetype_check_extension(filename, '.s10') || filetype_check_extension(filename, '.s11') || filetype_check_extension(filename, '.s12') || filetype_check_extension(filename, '.s13') || filetype_check_extension(filename, '.s14') || filetype_check_extension(filename, '.s15') || filetype_check_extension(filename, '.s16') || filetype_check_extension(filename, '.s17') || filetype_check_extension(filename, '.s18') || filetype_check_extension(filename, '.s19') || filetype_check_extension(filename, '.s20') || filetype_check_extension(filename, '.s21') || filetype_check_extension(filename, '.s22') || filetype_check_extension(filename, '.s23') || filetype_check_extension(filename, '.s24') || filetype_check_extension(filename, '.s25') || filetype_check_extension(filename, '.s26') || filetype_check_extension(filename, '.s27') || filetype_check_extension(filename, '.s28') || filetype_check_extension(filename, '.s29') || filetype_check_extension(filename, '.s30') || filetype_check_extension(filename, '.s31') || filetype_check_extension(filename, '.s32') || filetype_check_extension(filename, '.s33') || filetype_check_extension(filename, '.s34') || filetype_check_extension(filename, '.s35') || filetype_check_extension(filename, '.s36') || filetype_check_extension(filename, '.s37') || filetype_check_extension(filename, '.s38') || filetype_check_extension(filename, '.s39')
- type = 'curry_s';
- manufacturer = 'Curry';
- content = 'triangle or tetraedra list';
- elseif filetype_check_extension(filename, '.pom')
- type = 'curry_pom';
- manufacturer = 'Curry';
- content = 'anatomical localization file';
- elseif filetype_check_extension(filename, '.res')
- type = 'curry_res';
- manufacturer = 'Curry';
- content = 'functional localization file';
- % known MBFYS file types
- elseif filetype_check_extension(filename, '.tri')
- type = 'mbfys_tri';
- manufacturer = 'MBFYS';
- content = 'triangulated surface';
- elseif filetype_check_extension(filename, '.ama') && filetype_check_header(filename, [10 0 0 0])
- type = 'mbfys_ama';
- manufacturer = 'MBFYS';
- content = 'BEM volume conduction model';
- % Electrical Geodesics Incorporated formats
- % the egi_mff format is checked earlier
- elseif (filetype_check_extension(filename, '.egis') || filetype_check_extension(filename, '.ave') || filetype_check_extension(filename, '.gave') || filetype_check_extension(filename, '.raw')) && (filetype_check_header(filename, [char(1) char(2) char(3) char(4) char(255) char(255)]) || filetype_check_header(filename, [char(3) char(4) char(1) char(2) char(255) char(255)]))
- type = 'egi_egia';
- manufacturer = 'Electrical Geodesics Incorporated';
- content = 'averaged EEG data';
- elseif (filetype_check_extension(filename, '.egis') || filetype_check_extension(filename, '.ses') || filetype_check_extension(filename, '.raw')) && (filetype_check_header(filename, [char(1) char(2) char(3) char(4) char(0) char(3)]) || filetype_check_header(filename, [char(3) char(4) char(1) char(2) char(0) char(3)]))
- type = 'egi_egis';
- manufacturer = 'Electrical Geodesics Incorporated';
- content = 'raw EEG data';
- elseif (filetype_check_extension(filename, '.sbin') || filetype_check_extension(filename, '.raw'))
- % note that the Chieti MEG data format also has the extension *.raw
- % but that can be detected by looking at the file header
- type = 'egi_sbin';
- manufacturer = 'Electrical Geodesics Incorporated';
- content = 'averaged EEG data';
- % FreeSurfer file formats, see also http://www.grahamwideman.com/gw/brain/fs/surfacefileformats.htm
- elseif filetype_check_extension(filename, '.mgz')
- type = 'freesurfer_mgz';
- manufacturer = 'FreeSurfer';
- content = 'anatomical MRI';
- elseif filetype_check_extension(filename, '.mgh')
- type = 'freesurfer_mgh';
- manufacturer = 'FreeSurfer';
- content = 'anatomical MRI';
- elseif filetype_check_header(filename, [255 255 254])
- % FreeSurfer Triangle Surface Binary Format
- type = 'freesurfer_triangle_binary'; % there is also an ascii triangle format
- manufacturer = 'FreeSurfer';
- content = 'surface description';
- elseif filetype_check_header(filename, [255 255 255])
- % Quadrangle File
- type = 'freesurfer_quadrangle'; % there is no ascii quadrangle format
- manufacturer = 'FreeSurfer';
- content = 'surface description';
- elseif filetype_check_header(filename, [255 255 253]) && ~exist([filename(1:(end-4)) '.mat'], 'file')
- % "New" Quadrangle File
- type = 'freesurfer_quadrangle_new';
- manufacturer = 'FreeSurfer';
- content = 'surface description';
- elseif filetype_check_extension(filename, '.curv') && filetype_check_header(filename, [255 255 255])
- % "New" Curv File
- type = 'freesurfer_curv_new';
- manufacturer = 'FreeSurfer';
- content = 'surface description';
- elseif filetype_check_extension(filename, '.annot')
- % Freesurfer annotation file
- type = 'freesurfer_annot';
- manufacturer = 'FreeSurfer';
- content = 'parcellation annotation';
- elseif filetype_check_extension(filename, '.txt') && numel(strfind(filename,'_nrs_')) == 1
- % This may be improved by looking into the file, rather than assuming the
- % filename has "_nrs_" somewhere. Also, distinction by the different file
- % types could be made
- type = 'bucn_nirs';
- manufacturer = 'BUCN';
- content = 'ascii formatted nirs data';
- % Homer is MATLAB software for NIRS processing, see http://www.nmr.mgh.harvard.edu/DOT/resources/homer2/home.htm
- elseif filetype_check_extension(filename, '.nirs') && filetype_check_header(filename, 'MATLAB')
- type = 'homer_nirs';
- manufacturer = 'Homer';
- content = '(f)NIRS data';
- % known Artinis file format
- elseif filetype_check_extension(filename, '.oxy3')
- type = 'oxy3';
- manufacturer = 'Artinis Medical Systems';
- content = '(f)NIRS data';
- % known TETGEN file types, see http://tetgen.berlios.de/fformats.html
- elseif any(filetype_check_extension(filename, {'.node' '.poly' '.smesh' '.ele' '.face' '.edge' '.vol' '.var' '.neigh'})) && exist(fullfile(p, [f '.node']), 'file') && filetype_check_ascii(fullfile(p, [f '.node']), 100) && exist(fullfile(p, [f '.poly']), 'file')
- type = 'tetgen_poly';
- manufacturer = 'TetGen, see http://tetgen.berlios.de';
- content = 'geometrical data desribed with piecewise linear complex';
- elseif any(filetype_check_extension(filename, {'.node' '.poly' '.smesh' '.ele' '.face' '.edge' '.vol' '.var' '.neigh'})) && exist(fullfile(p, [f '.node']), 'file') && filetype_check_ascii(fullfile(p, [f '.node']), 100) && exist(fullfile(p, [f '.smesh']), 'file')
- type = 'tetgensmesh';
- manufacturer = 'TetGen, see http://tetgen.berlios.de';
- content = 'geometrical data desribed with simple piecewise linear complex';
- elseif any(filetype_check_extension(filename, {'.node' '.poly' '.smesh' '.ele' '.face' '.edge' '.vol' '.var' '.neigh'})) && exist(fullfile(p, [f '.node']), 'file') && filetype_check_ascii(fullfile(p, [f '.node']), 100) && exist(fullfile(p, [f '.ele']), 'file')
- type = 'tetgen_ele';
- manufacturer = 'TetGen, see http://tetgen.berlios.de';
- content = 'geometrical data desribed with tetrahedra';
- elseif any(filetype_check_extension(filename, {'.node' '.poly' '.smesh' '.ele' '.face' '.edge' '.vol' '.var' '.neigh'})) && exist(fullfile(p, [f '.node']), 'file') && filetype_check_ascii(fullfile(p, [f '.node']), 100) && exist(fullfile(p, [f '.face']), 'file')
- type = 'tetgen_face';
- manufacturer = 'TetGen, see http://tetgen.berlios.de';
- content = 'geometrical data desribed with triangular faces';
- elseif any(filetype_check_extension(filename, {'.node' '.poly' '.smesh' '.ele' '.face' '.edge' '.vol' '.var' '.neigh'})) && exist(fullfile(p, [f '.node']), 'file') && filetype_check_ascii(fullfile(p, [f '.node']), 100) && exist(fullfile(p, [f '.edge']), 'file')
- type = 'tetgen_edge';
- manufacturer = 'TetGen, see http://tetgen.berlios.de';
- content = 'geometrical data desribed with boundary edges';
- elseif any(filetype_check_extension(filename, {'.node' '.poly' '.smesh' '.ele' '.face' '.edge' '.vol' '.var' '.neigh'})) && exist(fullfile(p, [f '.node']), 'file') && filetype_check_ascii(fullfile(p, [f '.node']), 100) && exist(fullfile(p, [f '.vol']), 'file')
- type = 'tetgen_vol';
- manufacturer = 'TetGen, see http://tetgen.berlios.de';
- content = 'geometrical data desribed with maximum volumes';
- elseif any(filetype_check_extension(filename, {'.node' '.poly' '.smesh' '.ele' '.face' '.edge' '.vol' '.var' '.neigh'})) && exist(fullfile(p, [f '.node']), 'file') && filetype_check_ascii(fullfile(p, [f '.node']), 100) && exist(fullfile(p, [f '.var']), 'file')
- type = 'tetgen_var';
- manufacturer = 'TetGen, see http://tetgen.berlios.de';
- content = 'geometrical data desribed with variant constraints for facets/segments';
- elseif any(filetype_check_extension(filename, {'.node' '.poly' '.smesh' '.ele' '.face' '.edge' '.vol' '.var' '.neigh'})) && exist(fullfile(p, [f '.node']), 'file') && filetype_check_ascii(fullfile(p, [f '.node']), 100) && exist(fullfile(p, [f '.neigh']), 'file')
- type = 'tetgen_neigh';
- manufacturer = 'TetGen, see http://tetgen.berlios.de';
- content = 'geometrical data desribed with neighbors';
- elseif any(filetype_check_extension(filename, {'.node' '.poly' '.smesh' '.ele' '.face' '.edge' '.vol' '.var' '.neigh'})) && exist(fullfile(p, [f '.node']), 'file') && filetype_check_ascii(fullfile(p, [f '.node']), 100)
- type = 'tetgen_node';
- manufacturer = 'TetGen, see http://tetgen.berlios.de';
- content = 'geometrical data desribed with only nodes';
- % some BrainSuite file formats, see http://brainsuite.bmap.ucla.edu/
- elseif filetype_check_extension(filename, '.dfs') && filetype_check_header(filename, 'DFS_LE v2.0')
- type = 'brainsuite_dfs';
- manufacturer = 'BrainSuite, see http://brainsuite.bmap.ucla.edu';
- content = 'list of triangles and vertices';
- elseif filetype_check_extension(filename, '.bst') && filetype_check_ascii(filename)
- type = 'brainsuite_dst';
- manufacturer = 'BrainSuite, see http://brainsuite.bmap.ucla.edu';
- content = 'a collection of files with geometrical data'; % it seems to be similar to a Caret *.spec file
- elseif filetype_check_extension(filename, '.dfc') && filetype_check_header(filename, 'LONIDFC')
- type = 'loni_dfc';
- manufacturer = 'LONI'; % it is used in BrainSuite
- content = 'curvature information';
- % some BrainVISA file formats, see http://brainvisa.info
- elseif filetype_check_extension(filename, '.mesh') && (filetype_check_header(filename, 'ascii') || filetype_check_header(filename, 'binarABCD') || filetype_check_header(filename, 'binarDCBA')) % http://brainvisa.info/doc/documents-4.4/formats/mesh.pdf
- type = 'brainvisa_mesh';
- manufacturer = 'BrainVISA';
- content = 'vertices and triangles';
- elseif filetype_check_extension(filename, '.minf') && filetype_check_ascii(filename)
- type = 'brainvisa_minf';
- manufacturer = 'BrainVISA';
- content = 'annotation/metadata';
- % some other known file types
- elseif length(filename)>4 && exist([filename(1:(end-4)) '.mat'], 'file') && exist([filename(1:(end-4)) '.bin'], 'file')
- % this is a self-defined FCDC data format, consisting of two files
- % there is a MATLAB V6 file with the header and a binary file with the data (multiplexed, ieee-le, double)
- type = 'fcdc_matbin';
- manufacturer = 'Donders Centre for Cognitive Neuroimaging';
- content = 'multiplexed electrophysiology data';
- elseif filetype_check_extension(filename, '.lay')
- type = 'layout';
- manufacturer = 'Donders Centre for Cognitive Neuroimaging';
- content = 'layout of channels for plotting';
- elseif filetype_check_extension(filename, '.stl')
- type = 'stl';
- manufacturer = 'various';
- content = 'stereo litography file';
- elseif filetype_check_extension(filename, '.obj')
- type = 'obj';
- manufacturer = 'Wavefront Technologies';
- content = 'Wavefront OBJ';
- elseif filetype_check_extension(filename, '.dcm') || filetype_check_extension(filename, '.ima') || filetype_check_header(filename, 'DICM', 128)
- type = 'dicom';
- manufacturer = 'Dicom';
- content = 'image data';
- elseif filetype_check_extension(filename, '.trl')
- type = 'fcdc_trl';
- manufacturer = 'Donders Centre for Cognitive Neuroimaging';
- content = 'trial definitions';
- elseif filetype_check_extension(filename, '.bdf') && filetype_check_header(filename, [255 'BIOSEMI'])
- type = 'biosemi_bdf';
- manufacturer = 'Biosemi Data Format';
- content = 'electrophysiological data';
- elseif filetype_check_extension(filename, '.edf')
- type = 'edf';
- manufacturer = 'European Data Format';
- content = 'electrophysiological data';
- elseif filetype_check_extension(filename, '.gdf') && filetype_check_header(filename, 'GDF')
- type = 'gdf';
- manufacturer = 'BIOSIG - Alois Schloegl';
- content = 'biosignals';
- elseif filetype_check_extension(filename, '.mat') && filetype_check_header(filename, 'MATLAB') && filetype_check_spmeeg_mat(filename)
- type = 'spmeeg_mat';
- manufacturer = 'Wellcome Trust Centre for Neuroimaging, UCL, UK';
- content = 'electrophysiological data';
- elseif filetype_check_extension(filename, '.mat') && filetype_check_header(filename, 'MATLAB') && filetype_check_gtec_mat(filename)
- type = 'gtec_mat';
- manufacturer = 'Guger Technologies, http://www.gtec.at';
- content = 'electrophysiological data';
- elseif filetype_check_extension(filename, '.mat') && filetype_check_header(filename, 'MATLAB') && filetype_check_ced_spike6mat(filename)
- type = 'ced_spike6mat';
- manufacturer = 'Cambridge Electronic Design Limited';
- content = 'electrophysiological data';
- elseif filetype_check_extension(filename, '.mat') && filetype_check_header(filename, 'MATLAB')
- type = 'matlab';
- manufacturer = 'MATLAB';
- content = 'MATLAB binary data';
- elseif filetype_check_header(filename, 'RIFF', 0) && filetype_check_header(filename, 'WAVE', 8)
- type = 'riff_wave';
- manufacturer = 'Microsoft';
- content = 'audio';
- elseif filetype_check_extension(filename, '.txt') && filetype_check_header(filename, 'Site')
- type = 'easycap_txt';
- manufacturer = 'Easycap';
- content = 'electrode positions';
- elseif filetype_check_extension(filename, '.txt')
- type = 'ascii_txt';
- manufacturer = '';
- content = '';
- elseif filetype_check_extension(filename, '.pol')
- type = 'polhemus_fil';
- manufacturer = 'Functional Imaging Lab, London, UK';
- content = 'headshape points';
- elseif filetype_check_extension(filename, '.set')
- type = 'eeglab_set';
- manufacturer = 'Swartz Center for Computational Neuroscience, San Diego, USA';
- content = 'electrophysiological data';
- elseif filetype_check_extension(filename, '.erp')
- type = 'eeglab_erp';
- manufacturer = 'Swartz Center for Computational Neuroscience, San Diego, USA';
- content = 'electrophysiological data';
- elseif filetype_check_extension(filename, '.t') && filetype_check_header(filename, '%%BEGINHEADER')
- type = 'mclust_t';
- manufacturer = 'MClust';
- content = 'sorted spikes';
- elseif filetype_check_header(filename, 26)
- type = 'nimh_cortex';
- manufacturer = 'NIMH Laboratory of Neuropsychology, http://www.cortex.salk.edu';
- content = 'events and eye channels';
- elseif filetype_check_extension(filename, '.foci') && filetype_check_header(filename, '<?xml')
- type = 'caret_foci';
- manufacturer = 'Caret and ConnectomeWB';
- elseif filetype_check_extension(filename, '.border') && filetype_check_header(filename, '<?xml')
- type = 'caret_border';
- manufacturer = 'Caret and ConnectomeWB';
- elseif filetype_check_extension(filename, '.spec') && (filetype_check_header(filename, '<?xml') || filetype_check_header(filename, 'BeginHeader'))
- type = 'caret_spec';
- manufacturer = 'Caret and ConnectomeWB';
- elseif filetype_check_extension(filename, '.gii') && ~isempty(strfind(filename, '.coord.')) && filetype_check_header(filename, '<?xml')
- type = 'caret_coord';
- manufacturer = 'Caret and ConnectomeWB';
- elseif filetype_check_extension(filename, '.gii') && ~isempty(strfind(filename, '.topo.')) && filetype_check_header(filename, '<?xml')
- type = 'caret_topo';
- manufacturer = 'Caret and ConnectomeWB';
- elseif filetype_check_extension(filename, '.gii') && ~isempty(strfind(filename, '.surf.')) && filetype_check_header(filename, '<?xml')
- type = 'caret_surf';
- manufacturer = 'Caret and ConnectomeWB';
- elseif filetype_check_extension(filename, '.gii') && ~isempty(strfind(filename, '.label.')) && filetype_check_header(filename, '<?xml')
- type = 'caret_label';
- manufacturer = 'Caret and ConnectomeWB';
- elseif filetype_check_extension(filename, '.gii') && ~isempty(strfind(filename, '.func.')) && filetype_check_header(filename, '<?xml')
- type = 'caret_func';
- manufacturer = 'Caret and ConnectomeWB';
- elseif filetype_check_extension(filename, '.gii') && ~isempty(strfind(filename, '.shape.')) && filetype_check_header(filename, '<?xml')
- type = 'caret_shape';
- manufacturer = 'Caret and ConnectomeWB';
- elseif filetype_check_extension(filename, '.gii') && filetype_check_header(filename, '<?xml')
- type = 'gifti';
- manufacturer = 'Neuroimaging Informatics Technology Initiative';
- content = 'tesselated surface description';
- elseif filetype_check_extension(filename, '.v')
- type = 'vista';
- manufacturer = 'University of British Columbia, Canada, http://www.cs.ubc.ca/nest/lci/vista/vista.html';
- content = 'A format for computer vision research, contains meshes or volumes';
- elseif filetype_check_extension(filename, '.tet')
- type = 'tet';
- manufacturer = 'a.o. INRIA, see http://shapes.aimatshape.net/';
- content = 'tetraedral mesh';
- elseif filetype_check_extension(filename, '.nc')
- type = 'netmeg';
- manufacturer = 'Center for Biomedical Research Excellence (COBRE), see http://cobre.mrn.org/megsim/tools/netMEG/netMEG.html';
- content = 'MEG data';
- elseif filetype_check_extension(filename, 'trk')
- type = 'trackvis_trk';
- manufacturer = 'Martinos Center for Biomedical Imaging, see http://www.trackvis.org';
- content = 'fiber tracking data from diffusion MR imaging';
- elseif filetype_check_extension(filename, '.xml') && filetype_check_header(filename, '<EEGMarkerList', 39)
- type = 'localite_pos';
- manufacturer = 'Localite';
- content = 'EEG electrode positions';
- elseif filetype_check_extension(filename, '.mbi')
- type = 'manscan_mbi';
- manufacturer = 'MANSCAN';
- content = 'EEG header';
- elseif filetype_check_extension(filename, '.mb2')
- type = 'manscan_mb2';
- manufacturer = 'MANSCAN';
- content = 'EEG data';
- elseif filetype_check_header(filename, 'ply')
- type = 'ply';
- manufacturer = 'Stanford Triangle Format';
- content = 'three dimensional data from 3D scanners, see http://en.wikipedia.org/wiki/PLY_(file_format)';
- elseif filetype_check_extension(filename, '.csv')
- type = 'csv';
- manufacturer = 'Generic';
- content = 'Comma-separated values, see http://en.wikipedia.org/wiki/Comma-separated_values';
- elseif filetype_check_extension(filename, '.ah5')
- type = 'AnyWave';
- manufacturer = 'AnyWave, http://meg.univ-amu.fr/wiki/AnyWave';
- content = 'MEG/SEEG/EEG data';
- elseif (isdir(filename) && exist(fullfile(p, [d '.EEG.Poly5']), 'file')) || filetype_check_extension(filename, '.Poly5')
- type = 'tmsi_poly5';
- manufacturer = 'TMSi PolyBench';
- content = 'EEG';
- end
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % finished determining the filetype
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- if strcmp(type, 'unknown')
- if ~exist(filename, 'file') && ~exist(filename, 'dir')
- warning('file or directory "%s" does not exist, could not determine fileformat', filename);
- else
- warning('could not determine filetype of %s', filename);
- end
- end
- if ~isempty(desired)
- % return a boolean value instead of a descriptive string
- type = strcmp(type, desired);
- end
- % remember the current input and output arguments, so that they can be
- % reused on a subsequent call in case the same input argument is given
- current_argout = {type};
- if isempty(previous_argin) && ~strcmp(type, 'unknown')
- previous_argin = current_argin;
- previous_argout = current_argout;
- previous_pwd = current_pwd;
- elseif isempty(previous_argin) && (exist(filename,'file') || exist(filename,'dir')) && strcmp(type, 'unknown') % if the type is unknown, but the file or dir exists, save the current output
- previous_argin = current_argin;
- previous_argout = current_argout;
- previous_pwd = current_pwd;
- else
- % don't remember in case unknown
- previous_argin = [];
- previous_argout = [];
- previous_pwd = [];
- end
- return % filetype main()
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % SUBFUNCTION that helps in deciding whether a directory with files should
- % be treated as a "dataset". This function returns a logical 1 (TRUE) if more
- % than half of the element of a vector are nonzero number or are 1 or TRUE.
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- function y = most(x)
- x = x(~isnan(x(:)));
- y = sum(x==0)<ceil(length(x)/2);
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % SUBFUNCTION that always returns a true value
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- function y = filetype_true(varargin)
- y = 1;
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % SUBFUNCTION that checks for CED spike6 mat file
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- function res = filetype_check_ced_spike6mat(filename)
- res = 1;
- var = whos('-file', filename);
- % Check whether all the variables in the file are structs (representing channels)
- if ~all(strcmp('struct', unique({var(:).class})) == 1)
- res = 0;
- return;
- end
- var = load(filename, var(1).name);
- var = struct2cell(var);
- % Check whether the fields of the first struct have some particular names
- fnames = {
- 'title'
- 'comment'
- 'interval'
- 'scale'
- 'offset'
- 'units'
- 'start'
- 'length'
- 'values'
- 'times'
- };
- res = (numel(intersect(fieldnames(var{1}), fnames)) >= 5);
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % SUBFUNCTION that checks for a SPM eeg/meg mat file
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- function res = filetype_check_spmeeg_mat(filename)
- % check for the accompanying *.dat file
- res = exist([filename(1:(end-4)) '.dat'], 'file');
- if ~res, return; end
- % check the content of the *.mat file
- var = whos('-file', filename);
- res = res && numel(var)==1;
- res = res && strcmp('D', getfield(var, {1}, 'name'));
- res = res && strcmp('struct', getfield(var, {1}, 'class'));
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % SUBFUNCTION that checks for a GTEC mat file
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- function res = filetype_check_gtec_mat(filename)
- % check the content of the *.mat file
- var = whos('-file', filename);
- res = length(intersect({'log', 'names'}, {var.name}))==2;
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % SUBFUNCTION that checks the presence of a specified file in a directory
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- function res = filetype_check_dir(p, filename)
- if ~isempty(p)
- d = dir(p);
- else
- d = dir;
- end
- res = any(strcmp(filename,{d.name}));
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % SUBFUNCTION that checks whether the directory is neuralynx_cds
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- function res = filetype_check_neuralynx_cds(filename)
- res=false;
- files=dir(filename);
- dirlist=files([files.isdir]);
- % 1) check for a subdirectory with extension .lfp, .mua or .spike
- haslfp = any(filetype_check_extension({dirlist.name}, 'lfp'));
- hasmua = any(filetype_check_extension({dirlist.name}, 'mua'));
- hasspike = any(filetype_check_extension({dirlist.name}, 'spike'));
- % 2) check for each of the subdirs being a neuralynx_ds
- if haslfp || hasmua || hasspike
- sel=find(filetype_check_extension({dirlist.name}, 'lfp')+...
- filetype_check_extension({dirlist.name}, 'mua')+...
- filetype_check_extension({dirlist.name}, 'spike'));
- neuralynxdirs=cell(1,length(sel));
- for n=1:length(sel)
- neuralynxdirs{n}=fullfile(filename, dirlist(sel(n)).name);
- end
- res=any(ft_filetype(neuralynxdirs, 'neuralynx_ds'));
- end
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % SUBFUNCTION that checks whether the file contains only ascii characters
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- function res = filetype_check_ascii(filename, len)
- % See http://en.wikipedia.org/wiki/ASCII
- if exist(filename, 'file')
- fid = fopen(filename, 'rt');
- bin = fread(fid, len, 'uint8=>uint8');
- fclose(fid);
- printable = bin>31 & bin<127; % the printable characters, represent letters, digits, punctuation marks, and a few miscellaneous symbols
- special = bin==10 | bin==13 | bin==11; % line feed, form feed, tab
- res = all(printable | special);
- else
- % always return true if the file does not (yet) exist, this is important
- % for determining the format to which data should be written
- res = 1;
- end
ft_filetype.m at commit 986543a, under Apache-2.0 · at the source
Overview
17 affiliations
- Turner Institute for Brain and Mental Health, School of Psychological Sciences, Monash University,Melbourne, Victoria Australia
- School of Health Sciences, Swinburne University of Technology,Hawthorn, Victoria Australia
- Orygen, The University of Melbourne,Melbourne, Victoria Australia
- Centre for Youth Mental Health, The University of Melbourne,Melbourne, Victoria Australia
- British Association of Mindfulness-based Approaches (BAMBA) Listed Teacher,Oxford, UK
- Department of Neurobiology, Care Sciences and Society, Karolinska Institute,Solna, Sweden
- Monash Centre for Consciousness and Contemplative Studies, Monash University,Melbourne, Victoria Australia
- Department of Psychiatry and Behavioral Sciences, Center for Psychedelic and Consciousness Research, Johns Hopkins University School of Medicine,Baltimore, MD USA
- Center for Brain and Cognition, Theoretical and Computational Group, Universitat Pompeu Fabra/ICREA,Barcelona, Spain
- Department of Adult Psychiatry and Psychotherapy, Psychiatric University Clinic Zurich and University of Zurich,Zürich, Switzerland
- Centre for Psychedelic Research, Department of Brain Sciences, Imperial College London,London, UK
- Psychedelics Division, Neuroscape, University of California, San Francisco,San Francisco, CA USA
- Sussex Centre for Consciousness Science, Department of Informatics, University of Sussex,Brighton, UK
- Program on Brain, Mind, and Consciousness, Canadian Institute for Advanced Research,Toronto, Ontario Canada
- Department of Psychiatry, School of Clinical Sciences, Monash University,Clayton, Victoria Australia
- Monash Biomedical Imaging, Monash University,Melbourne, Victoria Australia
- CIFAR Global Scholars Program,Toronto, Ontario Canada
Abstract
Psychedelics can profoundly alter consciousness by reorganizing brain connectivity1,2, producing acute experiences that shape lasting psychological change3,4. Psychedelic dynamics are commonly described as desynchronized or entropically disordered5,6, yet the brain organization underlying self-dissolving and boundary-dissolving experiences that participants often report7, and how context shapes that organization8, remain unresolved. To address this, we acquired the largest single-site psychedelic neuroimaging dataset to date. Sixty-two adults underwent functional magnetic resonance imaging (fMRI) and electroencephalography (EEG) during rest and naturalistic stimuli (meditation, music and movie), before and on the day of psilocybin administration (fMRI ~ 80 min post-dose; EEG ~ 150 min post-dose). Half ranked the experience among the most meaningful of their lives7. Here, using machine learning to represent the brain dynamics of each individual as low-dimensional trajectories, we show that psilocybin reorganizes brain activity into structured, context-sensitive patterns that co-vary with the quality of subjective experience, revealing a latent order missed by time-averaged measures. Networks that ordinarily segregate internal and external processing integrated, producing cohesive context-aligned trajectories in participants reporting the felt experience of being continuous with, rather than separate from, the environment, a state we refer to as embeddedness. The strength of this context alignment scaled with both the depth of self-dissolving and boundary-dissolving experience and the next-day mindset change. Our findings recast apparent disorder as latent organization aligned with context, linking neurobiology to subjective experience and behavioural change.
Reproduced under the paper's license (CC BY), from the paper cited above.
Repositories
Its files are read in the Code ↔ Paper reader above, with 3 matches between paragraphs and lines of code.
razilab
Availability: 1 check, the latest on 27 September 2026: the link answers (HTTP 200)
- 27 September 2026: the link answers (HTTP 200)
information-dynamics.github.io/complexity
Availability: 1 check, the latest on 27 September 2026: the link answers (HTTP 200)
- 27 September 2026: the link answers (HTTP 200)
NSBLab/BrainEigenmodes
986543aad2b921e9f51e4a26bec41f147ddf166f, 28 March 2025Availability: 1 check, the latest on 27 September 2026: the link answers
- 27 September 2026: the link answers
297 files
- demo_connectome_eigenmod
e_calculation.m , MATLAB, 214 lines - demo_eigenmode_analysis.
m , MATLAB, 269 lines - demo_eigenmode_calculati
on.sh , Shell, 105 lines, 1 match - demo_eigenmode_visualiza
tion.m , MATLAB, 143 lines - demo_wave_model_simulati
on.m , MATLAB, 223 lines - functions_matlab/
bluewhitered.m , MATLAB, 101 lines - functions_matlab/
calc_LaplacianMatrix.m , MATLAB, 22 lines - functions_matlab/
calc_eigendecomposition. , MATLAB, 43 linesm - functions_matlab/
calc_lag_projection.m , MATLAB, 174 lines - functions_matlab/
calc_network_eigenmode.m , MATLAB, 33 lines - functions_matlab/
calc_normalize_timeserie , MATLAB, 18 liness.m - functions_matlab/
calc_parcellate.m , MATLAB, 31 lines - functions_matlab/
calc_power_spectrum.m , MATLAB, 22 lines - functions_matlab/
calc_surface_connectivit , MATLAB, 44 linesy.m - functions_matlab/
calc_triu_ind.m , MATLAB, 17 lines - functions_matlab/
cbrewer/ , MATLAB, not shown herecbrewer/ cbrewer/ ._cbrewer.m - functions_matlab/
cbrewer/ , MATLAB, not shown herecbrewer/ cbrewer/ ._interpolate_cbrewer.m - functions_matlab/
cbrewer/ , MATLAB, not shown herecbrewer/ cbrewer/ ._plot_brewer_cmap.m - functions_matlab/
cbrewer/ , MATLAB, 128 linescbrewer/ cbrewer/ cbrewer.m - functions_matlab/
cbrewer/ , MATLAB, 64 linescbrewer/ cbrewer/ change_jet.m - functions_matlab/
cbrewer/ , MATLAB, 36 linescbrewer/ cbrewer/ interpolate_cbrewer.m - functions_matlab/
cbrewer/ , MATLAB, 50 linescbrewer/ cbrewer/ plot_brewer_cmap.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 50 lines@xmltree/ Contents.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 90 lines@xmltree/ add.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 111 lines@xmltree/ attributes.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 49 lines@xmltree/ branch.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 14 lines@xmltree/ char.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 26 lines@xmltree/ children.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 129 lines@xmltree/ convert.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 44 lines@xmltree/ copy.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 31 lines@xmltree/ delete.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 19 lines@xmltree/ display.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 396 lines@xmltree/ editor.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 165 lines@xmltree/ find.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 37 lines@xmltree/ flush.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 37 lines@xmltree/ get.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 14 lines@xmltree/ getfilename.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 20 lines@xmltree/ isfield.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 31 lines@xmltree/ length.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 16 lines@xmltree/ move.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 14 lines@xmltree/ parent.m - functions_matlab/
cifti-matlab-master/ , Shell, 41 lines@xmltree/ private/ compile_mex.sh - functions_matlab/
cifti-matlab-master/ , MATLAB, 91 lines@xmltree/ private/ struct2xml.m - functions_matlab/
cifti-matlab-master/ , C, 111 lines@xmltree/ private/ xml_findstr.c - functions_matlab/
cifti-matlab-master/ , MATLAB, 30 lines@xmltree/ private/ xml_findstr.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 411 lines@xmltree/ private/ xml_parser.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 31 lines@xmltree/ root.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 129 lines@xmltree/ save.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 100 lines@xmltree/ save_string.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 21 lines@xmltree/ set.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 13 lines@xmltree/ setfilename.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 62 lines@xmltree/ xmltree.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 21 linescifti_diminfo_dense_get_ structures.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 21 linescifti_diminfo_dense_get_ surface_info.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 52 linescifti_diminfo_dense_get_ volume_all_info.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 44 linescifti_diminfo_dense_get_ volume_structure_info.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 47 linescifti_diminfo_make_scala rs.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 30 linescifti_diminfo_make_serie s.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 14 linescifti_metadata_get.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 14 linescifti_metadata_remove.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 19 linescifti_metadata_set.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 160 linescifti_read.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 110 linescifti_struct_create_from _template.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 25 linescifti_struct_create_sdse ries.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 40 linescifti_struct_dense_extra ct_surface_data.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 59 linescifti_struct_dense_extra ct_volume_all_data.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 59 linescifti_struct_dense_extra ct_volume_structure_data .m - functions_matlab/
cifti-matlab-master/ , MATLAB, 46 linescifti_struct_dense_repla ce_surface_data.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 64 linescifti_struct_dense_repla ce_volume_all_data.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 64 linescifti_struct_dense_repla ce_volume_structure_data .m - functions_matlab/
cifti-matlab-master/ , MATLAB, 17 linescifti_vox2ind.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 206 linescifti_write.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 38 linescifti_write_from_templat e.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 18 linescifti_write_sdseries.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 11 linesciftiopen.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 22 linesciftisave.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 28 linesciftisavereset.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 39 linesft_cifti/ @gifti/ Contents.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 25 linesft_cifti/ @gifti/ display.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 53 linesft_cifti/ @gifti/ export.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 16 linesft_cifti/ @gifti/ fieldnames.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 111 linesft_cifti/ @gifti/ gifti.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 13 linesft_cifti/ @gifti/ isfield.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 67 linesft_cifti/ @gifti/ plot.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 81 linesft_cifti/ @gifti/ private/ base64decode.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 157 linesft_cifti/ @gifti/ private/ base64encode.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 26 linesft_cifti/ @gifti/ private/ getdict.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 116 linesft_cifti/ @gifti/ private/ isintent.m - functions_matlab/
cifti-matlab-master/ , C, 4,214 linesft_cifti/ @gifti/ private/ miniz.c - functions_matlab/
cifti-matlab-master/ , MATLAB, 564 linesft_cifti/ @gifti/ private/ mvtk_write.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 25 linesft_cifti/ @gifti/ private/ read_freesurfer_file.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 236 linesft_cifti/ @gifti/ private/ read_gifti_file_standalo ne.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 429 linesft_cifti/ @gifti/ private/ xml_parser.m - functions_matlab/
cifti-matlab-master/ , C, 77 linesft_cifti/ @gifti/ private/ zstream.c - functions_matlab/
cifti-matlab-master/ , MATLAB, 49 linesft_cifti/ @gifti/ private/ zstream.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 253 linesft_cifti/ @gifti/ save.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 365 linesft_cifti/ @gifti/ saveas.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 18 linesft_cifti/ @gifti/ struct.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 139 linesft_cifti/ @gifti/ subsasgn.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 60 linesft_cifti/ @gifti/ subsref.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 54 linesft_cifti/ @xmltree/ Contents.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 94 linesft_cifti/ @xmltree/ add.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 117 linesft_cifti/ @xmltree/ attributes.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 55 linesft_cifti/ @xmltree/ branch.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 18 linesft_cifti/ @xmltree/ char.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 31 linesft_cifti/ @xmltree/ children.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 149 linesft_cifti/ @xmltree/ convert.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 50 linesft_cifti/ @xmltree/ copy.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 36 linesft_cifti/ @xmltree/ delete.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 22 linesft_cifti/ @xmltree/ display.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 401 linesft_cifti/ @xmltree/ editor.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 174 linesft_cifti/ @xmltree/ find.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 43 linesft_cifti/ @xmltree/ flush.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 43 linesft_cifti/ @xmltree/ get.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 17 linesft_cifti/ @xmltree/ getfilename.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 26 linesft_cifti/ @xmltree/ isfield.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 37 linesft_cifti/ @xmltree/ length.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 22 linesft_cifti/ @xmltree/ move.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 17 linesft_cifti/ @xmltree/ parent.m - functions_matlab/
cifti-matlab-master/ , Shell, 41 linesft_cifti/ @xmltree/ private/ compile_mex.sh - functions_matlab/
cifti-matlab-master/ , C, 110 linesft_cifti/ @xmltree/ private/ xml_findstr.c - functions_matlab/
cifti-matlab-master/ , MATLAB, 54 linesft_cifti/ @xmltree/ private/ xml_findstr.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 421 linesft_cifti/ @xmltree/ private/ xml_parser.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 36 linesft_cifti/ @xmltree/ root.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 135 linesft_cifti/ @xmltree/ save.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 27 linesft_cifti/ @xmltree/ set.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 16 linesft_cifti/ @xmltree/ setfilename.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 61 linesft_cifti/ @xmltree/ xmltree.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 1,016 linesft_cifti/ ft_read_cifti.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 849 linesft_cifti/ ft_write_cifti.m - functions_matlab/
cifti-matlab-master/ , Shell, 126 linesft_cifti/ package.sh - functions_matlab/
cifti-matlab-master/ , MATLAB, 52 linesft_cifti/ private/ copyfields.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 49 linesft_cifti/ private/ fetch_url.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 62 linesft_cifti/ private/ filetype_check_extension .m - functions_matlab/
cifti-matlab-master/ , MATLAB, 99 linesft_cifti/ private/ filetype_check_header.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 263 linesft_cifti/ private/ filetype_check_uri.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 52 linesft_cifti/ private/ find_outermost_boundary. m - functions_matlab/
cifti-matlab-master/ , MATLAB, 51 linesft_cifti/ private/ fixname.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 76 linesft_cifti/ private/ fixpos.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 267 linesft_cifti/ private/ ft_convert_units.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 292 linesft_cifti/ private/ ft_datatype.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 454 linesft_cifti/ private/ ft_datatype_sens.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 59 linesft_cifti/ private/ ft_estimate_units.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 1,431 lines, 2 matchesft_cifti/ private/ ft_filetype.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 106 linesft_cifti/ private/ ft_getopt.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 561 linesft_cifti/ private/ ft_hastoolbox.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 2,352 linesft_cifti/ private/ ft_read_header.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 1,010 linesft_cifti/ private/ ft_read_headshape.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 474 linesft_cifti/ private/ ft_read_mri.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 378 linesft_cifti/ private/ ft_read_sens.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 71 linesft_cifti/ private/ ft_read_vol.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 256 linesft_cifti/ private/ ft_scalingfactor.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 457 linesft_cifti/ private/ ft_senstype.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 87 linesft_cifti/ private/ ft_struct2double.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 138 linesft_cifti/ private/ ft_voltype.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 257 linesft_cifti/ private/ ft_warning.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 203 linesft_cifti/ private/ ft_warp_apply.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 237 linesft_cifti/ private/ ft_write_headshape.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 611 linesft_cifti/ private/ getdimord.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 70 linesft_cifti/ private/ getdimsiz.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 104 linesft_cifti/ private/ hasyokogawa.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 145 linesft_cifti/ private/ individual2sn.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 84 linesft_cifti/ private/ inflate_file.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 42 linesft_cifti/ private/ istrue.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 44 linesft_cifti/ private/ keepfields.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 123 linesft_cifti/ private/ ndgrid.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 34 linesft_cifti/ private/ pos2transform.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 168 linesft_cifti/ private/ read_asa.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 40 linesft_cifti/ private/ read_besa_sfp.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 56 linesft_cifti/ private/ read_bti_hs.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 107 linesft_cifti/ private/ read_bv_srf.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 110 linesft_cifti/ private/ read_caret_spec.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 190 linesft_cifti/ private/ read_ctf_hc.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 72 linesft_cifti/ private/ read_ctf_pos.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 41 linesft_cifti/ private/ read_ctf_shape.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 165 linesft_cifti/ private/ read_neuromag_hc.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 110 linesft_cifti/ private/ read_nifti2_hdr.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 57 linesft_cifti/ private/ read_off.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 211 linesft_cifti/ private/ read_ply.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 101 linesft_cifti/ private/ read_polhemus_fil.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 136 linesft_cifti/ private/ read_stl.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 48 linesft_cifti/ private/ read_vtk.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 223 linesft_cifti/ private/ read_yokogawa_header.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 232 linesft_cifti/ private/ read_yokogawa_header_new .m - functions_matlab/
cifti-matlab-master/ , MATLAB, 186 linesft_cifti/ private/ refine.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 44 linesft_cifti/ private/ removefields.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 56 linesft_cifti/ private/ renamefields.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 64 linesft_cifti/ private/ sn2individual.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 65 linesft_cifti/ private/ surf_to_tetgen.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 83 linesft_cifti/ private/ tokenize.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 82 linesft_cifti/ private/ write_nifti2_hdr.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 58 linesft_cifti/ private/ write_off.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 120 linesft_cifti/ private/ write_ply.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 60 linesft_cifti/ private/ write_stl.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 54 linesft_cifti/ private/ write_vtk.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 15 linesprivate/ child_match.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 19 linesprivate/ cifti_diminfo_length.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 603 linesprivate/ cifti_parse_xml.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 309 linesprivate/ cifti_write_xml.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 6 linesprivate/ fread_excepting.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 6 linesprivate/ fwrite_excepting.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 41 linesprivate/ make_nifti2_hdr.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 25 linesprivate/ my_system.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 20 linesprivate/ myargparse.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 10 linesprivate/ myattrs.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 9 linesprivate/ mydelete.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 8 linesprivate/ myendswith.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 14 linesprivate/ mygettext.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 182 linesprivate/ read_nifti2_hdr.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 27 linesprivate/ sanity_check_cdata.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 9 linesprivate/ str2vec.m - functions_matlab/
cifti-matlab-master/ , MATLAB, 95 linesprivate/ write_nifti2_hdr.m - functions_matlab/
construct_SH_basis.m , MATLAB, 87 lines - functions_matlab/
coord2freq_1D.m , MATLAB, 34 lines - functions_matlab/
corr_col.m , MATLAB, 53 lines - functions_matlab/
ctfft.m , MATLAB, 26 lines - functions_matlab/
draw_surface_bluewhitere , MATLAB, 82 linesd.m - functions_matlab/
draw_surface_bluewhitere , MATLAB, 88 linesd_dull.m - functions_matlab/
draw_surface_bluewhitere , MATLAB, 94 linesd_gallery.m - functions_matlab/
draw_surface_bluewhitere , MATLAB, 100 linesd_gallery_dull.m - functions_matlab/
draw_surface_parcellated , MATLAB, 178 lines_data_dull.m - functions_matlab/
draw_surface_parcellatio , MATLAB, 165 linesn_dull.m - functions_matlab/
draw_volume_bluewhitered , MATLAB, 55 lines.m - functions_matlab/
draw_volume_bluewhitered , MATLAB, 63 lines_gallery.m - functions_matlab/
extract_pvalue_text.m , MATLAB, 26 lines - functions_matlab/
freq2coord_1D.m , MATLAB, 34 lines - functions_matlab/
get_HCP_task_contrasts.m , MATLAB, 73 lines - functions_matlab/
gifti-master/ , MATLAB, 42 lines@gifti/ Contents.m - functions_matlab/
gifti-master/ , MATLAB, 25 lines@gifti/ display.m - functions_matlab/
gifti-master/ , MATLAB, 58 lines@gifti/ export.m - functions_matlab/
gifti-master/ , MATLAB, 16 lines@gifti/ fieldnames.m - functions_matlab/
gifti-master/ , MATLAB, 148 lines@gifti/ gifti.m - functions_matlab/
gifti-master/ , MATLAB, 13 lines@gifti/ isfield.m - functions_matlab/
gifti-master/ , MATLAB, 68 lines@gifti/ plot.m - functions_matlab/
gifti-master/ , C, 136 lines@gifti/ private/ base64.c - functions_matlab/
gifti-master/ , MATLAB, 30 lines@gifti/ private/ base64.m - functions_matlab/
gifti-master/ , MATLAB, 81 lines@gifti/ private/ base64decode.m - functions_matlab/
gifti-master/ , MATLAB, 157 lines@gifti/ private/ base64encode.m - functions_matlab/
gifti-master/ , MATLAB, 189 lines@gifti/ private/ freesurfer_read.m - functions_matlab/
gifti-master/ , MATLAB, 30 lines@gifti/ private/ getdict.m - functions_matlab/
gifti-master/ , MATLAB, 249 lines@gifti/ private/ gifti_read.m - functions_matlab/
gifti-master/ , MATLAB, 116 lines@gifti/ private/ isintent.m - functions_matlab/
gifti-master/ , C, 4,327 lines@gifti/ private/ miniz.c - functions_matlab/
gifti-master/ , MATLAB, 168 lines@gifti/ private/ mvtk_read.m - functions_matlab/
gifti-master/ , MATLAB, 569 lines@gifti/ private/ mvtk_write.m - functions_matlab/
gifti-master/ , MATLAB, 114 lines@gifti/ private/ mz3_read.m - functions_matlab/
gifti-master/ , MATLAB, 72 lines@gifti/ private/ mz3_write.m - functions_matlab/
gifti-master/ , MATLAB, 85 lines@gifti/ private/ obj_read.m - functions_matlab/
gifti-master/ , MATLAB, 40 lines@gifti/ private/ off_read.m - functions_matlab/
gifti-master/ , MATLAB, 55 lines@gifti/ private/ ply_read.m - functions_matlab/
gifti-master/ , MATLAB, 83 lines@gifti/ private/ stl_read.m - functions_matlab/
gifti-master/ , C, 223 lines@gifti/ private/ xml_parser.c - functions_matlab/
gifti-master/ , MATLAB, 37 lines@gifti/ private/ xml_parser.m - functions_matlab/
gifti-master/ , C, 1,063 lines@gifti/ private/ yxml.c - functions_matlab/
gifti-master/ , C/C++, 167 lines@gifti/ private/ yxml.h - functions_matlab/
gifti-master/ , C, 87 lines@gifti/ private/ zstream.c - functions_matlab/
gifti-master/ , MATLAB, 53 lines@gifti/ private/ zstream.m - functions_matlab/
gifti-master/ , MATLAB, 253 lines@gifti/ save.m - functions_matlab/
gifti-master/ , MATLAB, 555 lines@gifti/ saveas.m - functions_matlab/
gifti-master/ , MATLAB, 18 lines@gifti/ struct.m - functions_matlab/
gifti-master/ , MATLAB, 146 lines@gifti/ subsasgn.m - functions_matlab/
gifti-master/ , MATLAB, 60 lines@gifti/ subsref.m - functions_matlab/
gifti-master/ , MATLAB, 32 linestests/ gifti_runtests.m - functions_matlab/
gifti-master/ , MATLAB, 25 linestests/ test_gifti.m - functions_matlab/
loadParameters_balloon_f , MATLAB, 65 linesunc.m - functions_matlab/
loadParameters_wave_func , MATLAB, 45 lines.m - functions_matlab/
model_BOLD_balloon.m , MATLAB, 211 lines - functions_matlab/
model_neural_waves.m , MATLAB, 143 lines - functions_matlab/
plotSurfaceROIBoundary-m , MATLAB, 65 linesaster_v2/ ExampleSurfacePlotFuncti on.m - functions_matlab/
plotSurfaceROIBoundary-m , MATLAB, 182 linesaster_v2/ demo_ExampleSurfacePlotF unction.m - functions_matlab/
plotSurfaceROIBoundary-m , MATLAB, 141 linesaster_v2/ demo_plotSurfaceROIBound ary.m - functions_matlab/
plotSurfaceROIBoundary-m , MATLAB, 936 linesaster_v2/ findROIboundaries.m - functions_matlab/
plotSurfaceROIBoundary-m , MATLAB, 62 linesaster_v2/ graphComponents.m - functions_matlab/
plotSurfaceROIBoundary-m , MATLAB, 237 linesaster_v2/ makeFaceVertexCData.m - functions_matlab/
plotSurfaceROIBoundary-m , MATLAB, 306 linesaster_v2/ makeFaceVertexCData_old. m - functions_matlab/
plotSurfaceROIBoundary-m , MATLAB, 177 linesaster_v2/ plotSurfaceROIBoundary.m - functions_matlab/
plotSurfaceROIBoundary-m , MATLAB, 183 linesaster_v2/ read_annotation.m - functions_matlab/
plotSurfaceROIBoundary-m , MATLAB, 274 linesaster_v2/ turbo.m - functions_matlab/
process_volume_gradients , MATLAB, 133 lines_eigenmodes.m - functions_matlab/
read_vtk.m , MATLAB, 90 lines - functions_matlab/
rotate_parcellation-mast , MATLAB, 33 lineser/ Matlab/ centroid_extraction_sphe re.m - functions_matlab/
rotate_parcellation-mast , MATLAB, 93 lineser/ Matlab/ perm_sphere_p.m - functions_matlab/
rotate_parcellation-mast , MATLAB, 167 lineser/ Matlab/ rotate_parcellation.m - functions_matlab/
rotate_parcellation-mast , R, 52 lineser/ R/ perm.sphere.p.R - functions_matlab/
rotate_parcellation-mast , R, 185 lineser/ R/ rotate.parcellation.R - functions_matlab/
threshold_edges_proporti , MATLAB, 49 linesonal.m - functions_matlab/
turbo.m , MATLAB, 287 lines - functions_matlab/
video_surface_activity.m , MATLAB, 227 lines - generate_paper_figures_e
xtended_Nature.m , MATLAB, 1,491 lines - generate_paper_figures_m
ain_Nature.m , MATLAB, 1,866 lines - generate_paper_figures_m
ain_bioRxiv.m , MATLAB, 1,864 lines - generate_paper_figures_s
upp_Nature.m , MATLAB, 1,020 lines - generate_paper_figures_s
upp_bioRxiv.m , MATLAB, 2,306 lines - surface_eigenmodes.py, Python, 246 lines
- volume_eigenmodes.py, Python, 376 lines
- LICENSE, License, 201 lines
- README.md, Text, 76 lines
Code availability
Open-source code for all data analysis pipelines is available on GitHub (https://
Reproduced under the paper's license (CC BY), from the paper cited above.
Tracing map
Proposed by the machine: these links were found in the paper and verified at the source, without human review. The map will receive a Zenodo DOI once one of the paper's authors has validated it with their ORCID.
What the map holds:
- 3 repositories of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
- 295 scripts, each with its path and the digest of its content;
- 3 matches between paragraphs of the paper and lines of the code (method lexical-v1);
- neither the text of the paper nor the code itself.
Its JSON (tracing-map.json) is deposited on Zenodo with its DOI once the map is validated.
Data
Datasets cited
- openneuro:ds006110, at OpenNeuro; found in “Data availability”
Data availability
All data reported are open access and available through OpenNeuro (https://
Reproduced under the paper's license (CC BY), from the paper cited above.
Versions
The history of this record: each version stored by the harvester or made by a correction of its authors or of the maintainers of its code, and what changed in its facts. The texts of the paper (its abstract, its availability statements) are not part of it; versions that changed only those are not listed.
Version 2, 28 September 2026
- Publisher: n/a → Nature Portfolio
Version 1, 27 September 2026: the first record
Recorded: type, language, journal, volume, issue, pages, dates, 19 authors, 5 keywords, 14 MeSH terms, 2 funders, 118 references.
Cite
This paper
Stoliker, D., Novelli, L., Khajehnejad, M., Biabani, M., Greaves, M. D., Barta, T., Williams, M., Chopra, S., Bazin, O., Simonsson, O., Chambers, R., Barrett, F. S., Deco, G., Preller, K. H., Carhart-Harris, R. L., Seth, A. K., Sundram, S., Egan, G. F., & Razi, A. (2026). Psychedelics align brain activity with context. Nature, 656(8129), 936-947. https://
BibTeX
@article{stoliker2026psy
author = {Stoliker, Devon and Novelli, Leonardo and Khajehnejad, Moein and Biabani, Mana and Greaves, Matthew D. and Barta, Tamrin and Williams, Martin and Chopra, Sidhant and Bazin, Olivier and Simonsson, Otto and Chambers, Richard and Barrett, Frederick S. and Deco, Gustavo and Preller, Katrin H. and Carhart-Harris, Robin L. and Seth, Anil K. and Sundram, Suresh and Egan, Gary F. and Razi, Adeel},
title = {{Psychedelics align brain activity with context}},
journal = {Nature},
year = {2026},
month = aug,
volume = {656},
number = {8129},
pages = {936--947},
publisher = {Nature Portfolio},
issn = {0028-0836},
doi = {10.1038/
url = {https://
pmid = {42618786},
pmcid = {PMC13518247}
}
RIS
TY - JOUR
AU - Stoliker, Devon
AU - Novelli, Leonardo
AU - Khajehnejad, Moein
AU - Biabani, Mana
AU - Greaves, Matthew D.
AU - Barta, Tamrin
AU - Williams, Martin
AU - Chopra, Sidhant
AU - Bazin, Olivier
AU - Simonsson, Otto
AU - Chambers, Richard
AU - Barrett, Frederick S.
AU - Deco, Gustavo
AU - Preller, Katrin H.
AU - Carhart-Harris, Robin L.
AU - Seth, Anil K.
AU - Sundram, Suresh
AU - Egan, Gary F.
AU - Razi, Adeel
TI - Psychedelics align brain activity with context
T2 - Nature
J2 - Nature
PY - 2026
DA - 2026/
VL - 656
IS - 8129
SP - 936
EP - 947
SN - 0028-0836
PB - Nature Portfolio
DO - 10.1038/
UR - https://
LA - en
ER -
CSL-JSON
{
"id": "10.1038/
"type": "article-journal",
"title": "Psychedelics align brain activity with context",
"container-title": "Nature",
"author": [
{
"family": "Stoliker",
"given": "Devon"
},
{
"family": "Novelli",
"given": "Leonardo"
},
{
"family": "Khajehnejad",
"given": "Moein"
},
{
"family": "Biabani",
"given": "Mana"
},
{
"family": "Greaves",
"given": "Matthew D."
},
{
"family": "Barta",
"given": "Tamrin"
},
{
"family": "Williams",
"given": "Martin"
},
{
"family": "Chopra",
"given": "Sidhant"
},
{
"family": "Bazin",
"given": "Olivier"
},
{
"family": "Simonsson",
"given": "Otto"
},
{
"family": "Chambers",
"given": "Richard"
},
{
"family": "Barrett",
"given": "Frederick S."
},
{
"family": "Deco",
"given": "Gustavo"
},
{
"family": "Preller",
"given": "Katrin H."
},
{
"family": "Carhart-Harris",
"given": "Robin L."
},
{
"family": "Seth",
"given": "Anil K."
},
{
"family": "Sundram",
"given": "Suresh"
},
{
"family": "Egan",
"given": "Gary F."
},
{
"family": "Razi",
"given": "Adeel"
}
],
"container-title-short":
"volume": "656",
"issue": "8129",
"page": "936-947",
"DOI": "10.1038/
"PMID": "42618786",
"PMCID": "PMC13518247",
"ISSN": "0028-0836",
"publisher": "Nature Portfolio",
"URL": "https://
"language": "en",
"issued": {
"date-parts": [
[
2026,
8,
19
]
]
}
}
The tracing map gets a citation of its own once an author has validated it and it has a DOI.
Similar papers
The papers with a page that share the most with this one: the tools found in their code, their categories, datasets, cited references and authors, the rarest counting most.
- [1] doi:10.1038/s41591-026-04287-9 [code]
- An international mega-analysis of psychedelic drug effects on brain circuit function.Journal: Nature medicineIn common: NiBabel, SciPy, NumPy, fMRI, 16 references, 2 authors
- [2] doi:10.1038/s41467-026-74215-5 [code]
- Multi-metric evaluations of acute psychedelic effects on fMRI brain entropy.Journal: Nature communicationsIn common: Image Processing Toolbox, Statistics and Machine Learning Toolbox, SciPy, 1 other tool, fMRI, 14 references
- [3] doi:10.1038/s41467-026-71151-2 [code]
- Common and distinct neural correlates of social interaction processing and theory of mind in narratives.Journal: Nature communicationsIn common: cifti-matlab, GIfTI library for MATLAB, FieldTrip, 7 other tools, cognitive, 3 references
- [4] doi:10.1038/s41586-026-10631-3 [code]
- A prognostic human brain network for diffuse midline glioma.Journal: NatureIn common: cifti-matlab, BrainSpace, GIfTI library for MATLAB, 8 other tools, 1 reference
- [5] doi:10.1002/hbm.70596 [code]
- Modeled Long-Term Effects of Psilocybin on Dynamic Activity and Effective Connectivity of Fronto-Striatal-Thalamic
Circuits. Journal: Human brain mappingIn common: 8 references, author Gustavo Deco - [6] doi:10.1038/s41467-026-76011-7 [code]
- Human cortex organizes dynamic co-fluctuations along the sensorimotor-association
axis. Journal: Nature communicationsIn common: BrainSpace, GIfTI library for MATLAB, FieldTrip, 7 other tools, 3 references - [7] doi:10.1002/hbm.70483 [code]
- Untamed: Unconstrained Tensor Decomposition and Graph Node Embedding for Cortical Parcellation.Journal: Human brain mappingIn common: cifti-matlab, GIfTI library for MATLAB, FieldTrip, 7 other tools, fMRI, 2 references
- [8] doi:10.1038/s41593-026-02359-0 [code]
- The cross-site reproducibility of MRI morphometric phenotypes in psychiatric disorders.Journal: Nature neuroscienceIn common: FreeSurfer, SPM, Image Processing Toolbox, 4 other tools, 3 references, author Sidhant Chopra
- [9] doi:10.1162/imag.a.1262 [code]
- Frame-wise multi-echo distortion correction for superior functional MRI.Journal: Imaging neuroscience (Cambridge, Mass.)In common: GIfTI library for MATLAB, FieldTrip, FreeSurfer, 6 other tools, fMRI, 3 references
- [10] doi:10.3389/fnhum.2026.1874178
- Longitudinal neural and psychological changes following psilocybin under compassion imagery priming.Journal: Frontiers in human neuroscienceIn common: fMRI, cognitive, 10 references
Contribute
The authors of this paper can claim it, correct its record and validate its tracing map, and the maintainers of its code (its owner, or a public member of its organization) correct what it says of their repository; anyone signed in can ask for its removal. Every request goes to OSCR's own machine, which answers it; your account page follows them.
Sign in with ORCID to claim this paper as one of its authors, correct its record or validate its tracing map: when the paper's metadata lists your ORCID iD, you are recognized at once. Maintainers of its code: sign in with GitHub, then claim the repository on your account page.
Claim this paper
Correct its record
Say what each link of this record is, remove the ones that are not the paper's, add the ones that are missing. The correction becomes a new version of the record, in its Versions section.
Validate its tracing map
You validate the map as this page shows it: 3 repositories of the authors' code, each at its verified commit and with its license, 295 scripts, and 3 matches between paragraphs and code (see the Code and Map sections). It then receives a DOI on Zenodo, with you (your ORCID iD) and OSCR as its creators; the code itself is not deposited.
The map's fingerprint: sha256:506d30aa2df5e840…
Add the badge to its README
The badge links the code to this page. Copy one of these into the README of the paper's code: only you decide where it goes, and nothing is changed for you.
Markdown
[, paste the snippet at the top, then “Commit changes…” and, to review it first, “Create a new branch and start a pull request”. You open the pull request; OSCR asks for no permission.
Request its removal
To ask OSCR to remove this record, the copies of its authors' scripts or its tracing map, use the removal request page: signed in, you say who you are, what to remove and why, then review and confirm the request. Published rules decide every request (how).
Discussion, reproductions, activity
Discussion: questions and error reports about this paper and its code, from signed-in readers and its authors. It opens with sign-in.
Reproductions: reports from readers who ran the authors' code: what they reproduced, with which environment, commit and data. It opens with sign-in.
Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.
