Dear list,
I have successfully compiled SPM 8 with VBM v445.
However, I ran into another problem with this version (using the
compiled and non-compiled versions) in Estimate and Write batch. With
the default parameters, it works but where I tried to save all the
files, it fails. See the attached log (I can send the batch file if
necessary). AFAIU job #2 is just display. The following files were
correctly written:
- segmented images (p0, p1, p2, p3 and the corresponding text file)
- DARTEL warped segmented images (rp0, rp1, rp2, rp3)
- warped segmented images (wp1, wp2, wp3)
- modulated warped segmented images (mwp1, mwp2, mwp3)
- bias corrected and warped bias corrected images (m, wm)
It worked with version 435.
Any idea?
Thanks in advance,
Mathieu
On 17/12/2015 14:34, Christian Gaser wrote:
> Dear Mathieu,
>
> I have overseen that you are working with a compiled version of SPM where I have no experiences with. I have modified vbm8 according to Guillaumes suggestions (thanks!). There is still a call to the "ver" command to get the right matlab version. I hope that this still works for the compiled version.
>
> Please update your vbm8 toolbox to version 445. For any other users, please note that since the last final relase 435 there were only minor bug fixes that will not affect any results. Thus, there is no reason to again preprocess your data if you have already used version 435.
>
> Best,
>
> Christian
>
>
> and On Thu, 17 Dec 2015 02:45:14 +0100, Mathieu Dubois<[log in to unmask]> wrote:
>
>> Thanks Guillaume for the support.
>>
>> I will try to recompile SPM + VBM with a hardcoded value to test that.
>> If anybody has a better solution, don't hesitate.
>>
>> I'm rather optimistic about the absence of other errors because
>> segmentation almost ran (so the hard job is done correctly).
>>
>> In the long run, the code of the VBM toolbox should probably change. I
>> think it's more simple to simply use SVN revision number to hard-code
>> the value (at least when isdeployed is True): this is the value that
>> will be returned anyway. The solution with Contents.txt is elegant but
>> require more work.
>>
>> Mathieu
>>
>> On 16/12/2015 19:22, Guillaume Flandin wrote:
>>> Dear Mathieu,
>>>
>>> On 16/12/15 15:16, Mathieu Dubois wrote:
>>>> 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.
>>> R2010a is indeed the version I have been using so far. I plan to switch
>>> to a more recent version at some point, now that the MCRs are available
>>> online:
>>> http://www.mathworks.com/products/compiler/mcr/
>>>
>>>> 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?
>>> There is only one relevant Contents.m for SPM and all core toolboxes and
>>> that's the one in spm/Contents.m. That's the only one that spm('Ver')
>>> will look into (Contents.m with MATLAB and Contents.txt with standalone
>>> SPM).
>>> If you want to use the same strategy for the VBM toolbox, there should
>>> be a function in that toolbox to would parse its Contents.txt file when
>>> compiled.
>>>
>>>> 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 ?
>>> Christian might know more but it's actually possible that not so many
>>> people tried to compile the VBM8 toolbox yet (or they hardcoded the
>>> version number as you suggest - it is possible that this is the only
>>> compilation problem you will encounter).
>>>
>>>> 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?
>>> Maybe you can use 'isdeployed':
>>> if isdeployed
>>> % don't use 'ver'
>>> else
>>> % use 'ver'
>>> end
>>>
>>> Best regards,
>>> Guillaume.
>>>
>>>
>>>> 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
------------------------------------------------------------------------
Running job #1
------------------------------------------------------------------------
Running 'VBM8: Estimate & Write'
Initial Coarse Affine Registration..
Fine Affine Registration..
VBM8 r445: /lena13/home_users/users/dubois/Code/matlab/test_vbm4/0040043MACL.nii
NLM-Filter with multi-threading
Skull-stripping using graph-cut
Amap with Kmeans
Final masking
Warning: Jacobian can only be saved if dartel normalization was used.
> In cg_vbm8_write at 824
In cg_vbm8_run>run_job at 248
In cg_vbm8_run at 96
In matlabbatch/private/cfg_run_cm at 29
In cfg_util>local_runcj at 1510
In cfg_util at 830
In cfg_ui>MenuFileRun_Callback at 1186
In gui_mainfcn at 96
In cfg_ui at 53
.......................................................................................................................
------------------------------------------------------------------------
Running job #2
------------------------------------------------------------------------
Running 'Print'
Printing to
/lena13/home_users/users/dubois/Code/matlab/test_vbm4/spm_2016Jan06.ps
Done 'Print'
Done
Failed 'VBM8: Estimate & Write'
Index exceeds matrix dimensions.
In file "/lena13/home_users/users/dubois/Code/matlab/spm8_updates_r6313/toolbox/vbm8/cg_vbm8_write.m" (v443), function "cg_vbm8_write" at line 1093.
In file "/lena13/home_users/users/dubois/Code/matlab/spm8_updates_r6313/toolbox/vbm8/cg_vbm8_run.m" (v411), function "run_job" at line 248.
In file "/lena13/home_users/users/dubois/Code/matlab/spm8_updates_r6313/toolbox/vbm8/cg_vbm8_run.m" (v411), function "cg_vbm8_run" at line 96.
The following modules did not run:
Failed: VBM8: Estimate & Write
|