Back to the main page.

Bug 1365 - extend the "spm double installation" path check to other toolboxes

Reported 2012-03-10 08:44:00 +0100
Modified 2019-08-10 12:36:54 +0200
Product: FieldTrip
Component: core
Version: unspecified
Hardware: All
Operating System: All
Importance: P5 enhancement
Assigned to: Eelke Spaak
Depends on:
See also:

Robert Oostenveld - 2012-03-10 08:44:13 +0100

Somewhere in the code there is a check on spm5 and spm8 beint installed multiple times. That check issues a warning if multiple instances are found. The same can be done with the other toolboxes that fieldtrip auto-adds, and even with fieldtrip itself. e.g. give a warning if two copies of ft_preprocessing are on the path, or two copies of sopen (from biosig).

Arjen Stolk - 2012-03-14 13:42:15 +0100

also see 1372

Eelke Spaak - 2012-03-28 12:31:10 +0200

Fixed in revision 5551. I needed to determine a 'key' file for each of the external toolboxes, and am not sure I always took the most appropriate one. Perhaps Robert should check this? The relevant code: checkMultipleToolbox('FieldTrip', 'ft_defaults'); checkMultipleToolbox('mne', 'fiff_copy_tree'); checkMultipleToolbox('eeglab', 'eeglab2fieldtrip.m'); checkMultipleToolbox('dipoli', 'write_tri.m'); checkMultipleToolbox('eeprobe', 'read_eep_avr.mexa64'); checkMultipleToolbox('yokogawa', 'GetMeg160ChannelInfoM.p'); checkMultipleToolbox('simbio', 'sb_compile_vista'); checkMultipleToolbox('fns', 'fns_region_read.m'); checkMultipleToolbox('bemcp', 'bem_Cii_cst'); checkMultipleToolbox('bci2000', 'load_bcidat.m'); checkMultipleToolbox('openmeeg', 'openmeeg_helper'); checkMultipleToolbox('freesurfer', 'vox2ras_ksolve.m'); checkMultipleToolbox('fastica', 'fastica'); checkMultipleToolbox('besa', 'readBESAmul.m'); checkMultipleToolbox('neuroshare', 'ns_GetAnalogData'); checkMultipleToolbox('ctf', 'setCTFDataBalance.m'); checkMultipleToolbox('afni', 'WriteBrikHEAD.m'); checkMultipleToolbox('gifti', '@gifti/display'); checkMultipleToolbox('sqdproject', 'sqdread'); checkMultipleToolbox('xml4mat', 'xml2mat'); checkMultipleToolbox('cca', 'ccabss.m'); checkMultipleToolbox('bsmart', 'armorf.m'); checkMultipleToolbox('iso2mesh', 'iso2meshver'); checkMultipleToolbox('bct', 'degrees_und.m'); checkMultipleToolbox('yokogawa_meg_reader', 'getYkgwHdrEvent.p'); checkMultipleToolbox('biosig', 'sopen');

Robert Oostenveld - 2012-03-28 12:47:14 +0200

(In reply to comment #2) in ft_hastoolbox we have a similar issue in checking the presence of a toolbox on the basis of one or multiple files. E.g. case 'DENOISE' status = (exist('tsr', 'file') && exist('sns', 'file')); case 'CTF' status = (exist('getCTFBalanceCoefs') && exist('getCTFdata')); case 'BCI2000' status = exist('load_bcidat'); case 'NLXNETCOM' status = (exist('MatlabNetComClient', 'file') && exist('NlxConnectToServer', 'file') && exist('NlxGetNewCSCData', 'file')); case 'DIPOLI' status = exist('dipoli.maci', 'file'); case 'MNE' status = (exist('fiff_read_meas_info', 'file') && exist('fiff_setup_read_raw', 'file')); case 'TCP_UDP_IP' status = (exist('pnet', 'file') && exist('pnet_getvar', 'file') && exist('pnet_putvar', 'file')); case 'BEMCP' I suggest that we try to make this definition of the key file or key files common. E.g. ft_toolboxfunctions('DENOISE') returns {'tsr', 'sns'} and ft_toolboxfunctions('NLXNETCOM') returns {'MatlabNetComClient', 'NlxConnectToServer') The ft_hastoolbox code then simplifies to case 'NLXNETCOM' status = all(@existfile, ft_toolboxfunctions('NLXNETCOM')); where I use a subfunction with function status = existfile(file) status = exist(file, 'file'); or where you could also absorb the handling of the cell-array with multiple files in the subfunction like this function status = existfile(file) if ischar(file) status = exist(file, 'file'); else status = exist(file{1}, 'file'); for i=2:length(file) status = status && exist(file{i}, 'file'); end end

Robert Oostenveld - 2012-03-28 12:48:58 +0200

(In reply to comment #2) Something to think about is mex files and p-files. I think that we should check for the presence of a function, not whether it is a mex or p implementation. So checkMultipleToolbox('eeprobe', 'read_eep_avr.mexa64'); checkMultipleToolbox('yokogawa', 'GetMeg160ChannelInfoM.p'); might have to be checkMultipleToolbox('eeprobe', 'read_eep_avr); checkMultipleToolbox('yokogawa', 'GetMeg160ChannelInfoM'); hmm, how to deal with both the m-file and the mex file being present...

Robert Oostenveld - 2018-07-13 10:00:41 +0200

the current implementation (already in place for quite some years) seems to be working just fine. I hear/see on workshops it helps resolving path issues, so I would say it is functional.

Robert Oostenveld - 2019-08-10 12:36:54 +0200

This closes a whole series of bugs that have been resolved (either FIXED/WONTFIX/INVALID) for quite some time. If you disagree, please file a new issue on