Dear Guillaume,
I am using Matlab 2010a which, if I'm correct, is the version used at
UCL for standalone SPM, right? I made this choice especially to avoid
differences.
The toolbox/vbm8 folder in the compiled code contains a compiled
Contents.m but no Contents.txt. Most other SPM toolboxes (DARTEL, etc.)
don't have a Contents.m file. The 2 exceptions are mixture and spectral.
So I guess that this file is not needed in SPM toolboxes (as opposed to
Matlab toolboxes).
If I understand well, Contents.txt is created only for the Contents.m at
the root of the SPM source tree, right? So no toolbox will be identified
in compiled version with spm('Ver'), right?
Maybe the compilation procedure could create Content.txt for all
Contents.m. Would that help?
Any way, it's strange that nobody was hit by this problem. This code has
been in all versions of the VBM8 toolbox. Did anybody successfully
compiled SPM8 + VBM8 ? If so, how ?
Last but not least, for the VBM toolbox, the r_vbm variable could be
hardcoded and automatically set with the SVN revision number (which I
guess is the number used). That would statically solve the problem, right?
Mathieu
On 16/12/2015 15:12, Guillaume Flandin wrote:
> Dear Mathieu,
>
> each toolbox should have its own Contents.m file so it's not surprising
> that the VBM toolbox is not mentioned in SPM's Contents.m.
>
> I would indeed recommend to use
> [v,r] = spm('Ver');
> or
> ver = spm('Version');
> when querying SPM's version.
>
> Something similar could be implemented in the VBM toolbox. Note that it
> is also possible that the Contents.m file is handled differently
> depending on the version of the MATLAB Compiler you are using.
>
> Best regards,
> Guillaume.
>
>
> On 16/12/15 13:02, Mathieu Dubois wrote:
>> Dear Guillaume,
>>
>> I was expecting something like this. Contents.txt in the compiled
>> version is:
>> % Statistical Parametric Mapping
>> % Version 6313 (SPM8) 23-Jan-2015
>> <+ spm text + note to programmers about this >
>> i.e. there is no mention of the VBM toolbox which probably explains why
>> finding the version of the VBM toolbox fails (I guess that Matlab
>> version is hardcoded).
>>
>> If i remember correctly, I compiled SPM from a "cold" folder i.e. I
>> never used it in non-standalone way. (I just decompressed the source and
>> the source of the VBM toolbox, added the folder in matlab path and
>> ran`spm_make_standalone.m`). Maybe this explains why the VBM toolbox was
>> not correctly detected. Does it make sense? In that case, I will have to
>> recompile SPM.
>>
>> On the other hand, the VBM toolbox should probably use `spm('Ver')`
>> instead of `ver`, right?
>>
>> Mathieu
>>
>> On 16/12/2015 13:15, Guillaume Flandin wrote:
>>> Dear Mathieu and Christian,
>>>
>>> the 'ver' command gets its information from files Contents.m that are
>>> not readable when compiled. As a workaround, SPM copies its Contents.m
>>> into a file named Contents.txt that can then be read by spm('Ver'), see
>>> spm12/config/spm_make_standalone.m and spm12/spm.m.
>>> That said, I don't understand why you didn't get an error with variable
>>> r_spm but only with r_vbm instead...
>>>
>>> Best regards,
>>> Guillaume.
>>>
>>>
>>> On 16/12/15 11:14, Mathieu Dubois wrote:
>>>> Dear Prof. Gaser,
>>>>
>>>> Thanks for your answer. (As mentionned,) I tried the command in
>>>> non-standalone Matlab and it works (Matlab 2012 + SPM + VBM).
>>>>
>>>> The problem is in the compiled version. I don't know how can I test the
>>>> output of `ver` in the compiled version (we tried SPM 'Call MATLAB
>>>> function' without success - probably related to the fact that there is
>>>> no interpreter in the compiled version).
>>>> I think that recompiling SPM+VBM with hardcoded values would work but
>>>> maybe there is a more general solution.
>>>>
>>>> Mathieu
>>>>
>>>> On 16/12/2015 09:00, Christian Gaser wrote:
>>>>> Dear Mathieu,
>>>>>
>>>>> looks like your toolbox is not recognized on your system. Try the following at your matlab command line:
>>>>>
>>>>> A = ver;
>>>>> for i=1:length(A)
>>>>> if strcmp(A(i).Name,'Voxel Based Morphometry Toolbox')
>>>>> r_vbm = A(i).Version
>>>>> end
>>>>> end
>>>>>
>>>>> if it's not giving any output for the r_vbm variable there should be some installation issue. You can try to set the variable manually to some value
>>>>> r_vbm='435'
>>>>> before the faulty line and test whether VBM is running at all...
>>>>>
>>>>> Best,
>>>>>
>>>>> Christian
>>>>>
>>>>> On Tue, 15 Dec 2015 22:20:18 +0100, Mathieu Dubois <[log in to unmask]> wrote:
>>>>>
>>>>>> Hello,
>>>>>>
>>>>>> Following the I have compiled SPM 8 (ver. 6313) and VBM 8 (ver. 435)
>>>>>> with Matlab 2010a (same version that is used at UCL).
>>>>>>
>>>>>> In order to test, I tried to segment a simple T1 image. After writing
>>>>>> the warped images, the code fails with the following error:
>>>>>> Failed 'VBM8: Estimate & Write'
>>>>>> Undefined function or variable "r_vbm".
>>>>>> In file
>>>>>> "/home_local/mdiallo/spm_exec/spm8_mcr/Code/matlab/spm8_updates_r6313/to
>>>>>> olbox/vbm8/cg_vbm8_write.m" (???), function "cg_vbm8_write" at line 965.
>>>>>> In file
>>>>>> "/home_local/mdiallo/spm_exec/spm8_mcr/Code/matlab/spm8_updates_r6313/to
>>>>>> olbox/vbm8/cg_vbm8_run.m" (???), function "run_job" at line 248.
>>>>>> In file
>>>>>> "/home_local/mdiallo/spm_exec/spm8_mcr/Code/matlab/spm8_updates_r6313/toolbox/vbm8/cg_vbm8_run.m"
>>>>>> (???), function "cg_vbm8_run" at line 96.
>>>>>> The following modules did not run:
>>>>>> Failed: VBM8: Estimate & Write
>>>>>>
>>>>>> Looking at the source code, the faulty line is.
>>>>>> str = [str struct('name', 'Versions
>>>>>> Matlab/SPM8/VBM8:','value',sprintf('%s / %s / %s',r_matlab,r_spm,r_vbm))];
>>>>>> The "r_vbm" variable is defined just above:
>>>>>> A = ver;
>>>>>> for i=1:length(A)
>>>>>> if strcmp(A(i).Name,'Voxel Based Morphometry Toolbox')
>>>>>> r_vbm = A(i).Version;
>>>>>> end
>>>>>> if strcmp(A(i).Name,'Statistical Parametric Mapping')
>>>>>> r_spm = A(i).Version;
>>>>>> end
>>>>>> if strcmp(A(i).Name,'MATLAB')
>>>>>> r_matlab = A(i).Version;
>>>>>> end
>>>>>> end
>>>>>> The code seems correct (test on Matlab with non-compiled SPM+VBM). As
>>>>>> Matlab doesn't complain about the "r_matlab" and "r_spm" variables, I
>>>>>> guess they are correctly detected in the compiled version.
>>>>>>
>>>>>> Any clue?
>>>>>>
>>>>>> Mathieu
|