Dear Stephen,
the SPM batch system needs to know the available configuration options
at startup to be able to load and run batch jobs. Therefore the
configuration is sourced at startup time.
For toolboxes that wish to modify SPM code, there are two options which
both don't interfere with main SPM:
1) copy & rename the SPM routines that need to be modified (e.g. VBM and
Anatomy toolbox do this)
2) place modified files in a "private/" folder in the toolbox folder.
This folder doesn't need to be added to the path. MATLAB will look for
functions there first if the current .m file is within the toolbox
folder. Thus, toolbox functions will pick up modified code there, while
standard SPM will not.
Hope this helps,
Volkmar
Am Montag, den 02.02.2009, 09:20 -0500 schrieb Fromm, Stephen (NIH/NIMH)
[C]:
> That's fine, but why should the config files be run by SPM
> automatically at startup?
>
> I modify SPM *.m files all the time and put them into the path only
> when needed with scripts for that purpose. Any processing pipeline
> could easily do the same. I haven't thought about it in depth, but
> presumably calls to toolboxes could even use code similar to that in
> spm.m to locate the toolbox and then add it to the path without
> intervention by the user.
>
> The problem with the suggestion that toolbox authors themselves avoid
> name collisisions is that they are then prohibited from modifying SPM
> code. If they give a code file a different name, then it won't be
> called by code in the unmodified, non-toolbox part of SPM.
>
> Of course, I understand that there are tradeoffs here and that perhaps
> the current code maintainers have made the better choice.
>
> Best,
>
> Stephen J. Fromm, PhD
> Contractor, NIMH/MAP
> (301) 451--9265
>
>
>
> ______________________________________________________________________
> From: Volkmar Glauche
> Sent: Mon 2009-02-02 8:07 AM
> To: Stephen J. Fromm
> Cc: [log in to unmask]
> Subject: Re: [SPM] SPM5 toolboxes and matlab path
>
>
> Hi Stephen,
>
> the reason for toolboxes to add their path is that the SPM5/8 batch
> system doesn't use the SPM2 style dropdown menu to invoke a toolbox.
> Instead, toolboxes that have their own config files can be integrated
> into any SPM processing pipeline. This requires that the toolbox .m
> files can be found by MATLAB, even if the toolbox doesn't have its own
> GUI or the toolbox GUI has not been opened. Most toolboxes (at least
> their most recent versions) should be aware of the problems of name
> collisions.
>
> Hope this helps,
>
> Volkmar
>
> Am Montag, den 02.02.2009, 12:47 +0000 schrieb Stephen J. Fromm:
> > On Sun, 1 Feb 2009 20:32:37 -0600, Darren Gitelman
> > <[log in to unmask]> wrote:
> >
> > >Stephen
> > >
> > >You are correct. Any toolboxes that are available through the batch system
> > >and use xx_config_yy files are added to the path at the time SPM is started.
> > >See spm_config.m around line 259.
> >
> > Right, I saw that line of code.
> >
> > However, as far as I can tell that's not how SPM originally dealt with
> > toolboxes. spm.m has code which adds the toolbox to the matlabpath upon
> > its selection from the dropdown menu.
> >
> > That's the way SPM2 apparently dealt with it. For SPM5, some toolboxes do it
> > that way; others do it through spm_config.m.
> >
> > Adding paths without the users having selected the toolbox can lead to
> > unwanted name collisions. There's already one example of that, the VBM5
> > toolbox with spm_getSPM, spm_list, and spm_results_ui.
>
>
> > >-----
> > >Darren Gitelman
> > >
> > >
> > >On Sun, Feb 1, 2009 at 7:22 PM, Stephen J. Fromm
> > <[log in to unmask]>wrote:
> > >
> > >> I noticed that in my most recent copy of SPM5 and its updates, many
> > >> toolboxes were adding themselves to the matlab path after I started SPM
> > and
> > >> pushed the "fMRI" button. (Equivalently, after I started SPM by typing spm
> > >> ('fmri') in matlab.)
> > >>
> > >> For a toolbox named "X", the line that caused this was in the file
> > >> .../toolbox/X/spm_config_x.m
> > >> and the line is of the form
> > >> addpath(fullfile(spm('dir'),'toolbox','X'));
> > >>
> > >> My impression is that that line shouldn't be there, and it seems that
> > >> that's the
> > >> line that puts the toolboxes in the matlab path even before any toolbox has
> > >> been selected using the menu on the main SPM5 window.
> > >>
> > >
> >
> --
> Volkmar Glauche
> -
> Department of Neurology [log in to unmask]
> Universitaetsklinikum Freiburg Phone 49(0)761-270-5331
> Breisacher Str. 64 Fax 49(0)761-270-5416
> 79106 Freiburg http://fbi.uniklinik-freiburg.de/
>
>
>
--
Volkmar Glauche
-
Department of Neurology [log in to unmask]
Universitaetsklinikum Freiburg Phone 49(0)761-270-5331
Breisacher Str. 64 Fax 49(0)761-270-5416
79106 Freiburg http://fbi.uniklinik-freiburg.de/
|