Tagged: installation, matlab, version
-
AuthorPosts
-
12/06/2019 at 2:48 PM #8811tsiegerParticipant
Hi,
this is just a friendly notice that the current Lead-dbs v2.2.3 requires Matlab R2016b and higher, because it makes use of thecontains()
function, which was introduced in R2016b. This is in contrast to Lead-dbs installation instructions and prerequisites that declare that Lead-dbs requires Matlab 2015b and >R1014b, respectively.In an attempt to make Lead-dbs 2.2.3 run on Matlab R2016a, I introduced a quick-and-dirty hacked version of
contains.m
like this:function c=contains(a,b) c=~isempty(strfind(a,b)); end
This workarounds the issue of undefined
contains()
, but Lead-dbs does not seem to work properly, even though I do not know whether it is related to thecontains
issue. E.g., I ended up in debug mode in theea_normalize_spmshoot
function (see thekeyboard
keyword) when trying to normalize:% check if darteltemplate is available, if not generate one if exist([ea_space(options,'dartel'),'shootmni_6.nii'],'file') % There is a DARTEL-Template. Check if it will match: Vt=spm_vol([ea_space(options,'dartel'),'shootmni_6.nii']); Vp=spm_vol([directory,'rc1',options.prefs.prenii_unnormalized]); if ~isequal(Vp.dim,Vt(1).dim) || ~isequal(Vp.mat,Vt(1).mat) % Dartel template not matching. -> create matching one. ea_create_tpm_darteltemplate; %([directory,'rc1',options.prefs.prenii_unnormalized]); end else % no dartel template present. -> Create matching dartel templates from highres version. keyboard ea_create_tpm_darteltemplate; %([directory,'rc1',options.prefs.prenii_unnormalized]); end
Best wishes,
Tomas12/06/2019 at 4:35 PM #8814andreashornKeymasterHi Thomas,
Great, thanks for catching this one. Would you like to submit a pull request that fixes the contains issue?
Re shoot haven’t used it in a while, would recommend to use ANTs.
But can have a look at it if I don’t forget.Best, Andy
12/06/2019 at 4:36 PM #8815andreashornKeymaster…based on the code, the keyboard should be deleted, so you can just run the next line to create TPMs.
12/06/2019 at 5:33 PM #8816tsiegerParticipantRegarding the
contains()
issue: I’m afraid my hack was too hacky and could not be used as a proper replacement for the original function, as it e.g. does not support patterns consisting of several strings, which the original function does support. Also,contains()
can be used in both case-sensitive and insensitive modes, whilestrfind
cannot. However, looking in the Lead-DBS code, multiple-string patterns seem not to be used, and possibly neither case-insensitive search.
So, I suppose there are three possible solutions:
i) put the hacked version ofcontains()
in the code *only* for Matlab <R12016b (I can’t see a way how to do this when there is no installation process and users can get the code directly from github),
ii) put the hacked version ofcontains()
in the code regardless of Matlab version (this would IMHO produce tons of warnings, I would not go this way),
iii) put a differently named function (e.g.mycontains()
in the code and update all the calls tocontains()
tomycontains()
– this would affect quite many people and much code, but would be quite clean IMHO.
What’s your opinion?Regarding the normalization issue: ignoring the
keyboard
did not help, the process failed with------------------------------------------------------------------------ Running job #1 ------------------------------------------------------------------------ Running 'Run Shoot (existing Templates)' Failed 'Run Shoot (existing Templates)' Error using read_hdr (line 32) Error reading header file "/home/sieger/src/matlab/leaddbs-2.2.3/templates/space/MNI_ICBM_2009b_NLIN_ASYM/dartel/shootmni_1.nii". In file "/home/sieger/src/matlab/spm12/@nifti/private/read_hdr.m" (v4967), function "read_hdr" at line 32. In file "/home/sieger/src/matlab/spm12/@nifti/nifti.m" (v4986), function "nifti" at line 26. In file "/mnt/hdd/home/sieger/src/matlab/spm12/toolbox/Shoot/spm_shoot_warp.m" (v6024), function "load_template" at line 195. In file "/mnt/hdd/home/sieger/src/matlab/spm12/toolbox/Shoot/spm_shoot_warp.m" (v6024), function "spm_shoot_warp" at line 104. The following modules did not run: Failed: Run Shoot (existing Templates) Error using MATLABbatch system Job execution failed. The full log of this run can be found in MATLAB command window, starting with the lines (look for the line showing the exact #job as displayed in this error message) ------------------ Running job #1 ------------------
The problem was that the
.../MNI_ICBM_2009b_NLIN_ASYM/dartel/shootmni_1.nii
is missing.
There are only these files in the directory:dartelmni_6.mat dartelmni_6.nii dartelmni_6_hires_00001.nii dartelmni_6_hires_00002.nii dartelmni_6_hires_00003.nii dartelmni_6_hires_00004.nii dartelmni_6_hires_00005.nii dartelmni_6_hires_00006.nii s0dartelmni_6_hires_00001.nii s0dartelmni_6_hires_00002.nii s0dartelmni_6_hires_00003.nii
12/06/2019 at 5:43 PM #8817andreashornKeymasterHi Tomasz,
re contains: Would use a function called ea_contains and replace the calls to that. Should never name a function the same as built-in matlab functions. There aren’t many calls of contains in Lead-DBS.
Re Shoot, not sure, cannot debug right now. However wouldn’t really recommend shoot for DBS based on the Ewert 2019 Neuroimage article. Is there a particular reason you have to use it?
Can look into it somewhen but currently am on holidays.
Best, Andy
12/06/2019 at 5:46 PM #8818andreashornKeymaster…one thing you could try re Shoot is to run DARTEL (which also builds the TPMs if they are not present). If that works, afterwards, Shoot should also work.
Have asked Ningfei & Simon to look into this, maybe one of them has some time for it.Best, Andy
12/09/2019 at 11:09 AM #8832tsiegerParticipantRe contains: I’ve issued this PR: https://github.com/netstim/leaddbs/pull/320
Re Shoot: I had no specific reason to use it, but it seems that ‘SPM12 Shoot’ is the default normalization option.
12/09/2019 at 11:43 AM #8836ningfeiKeymasterHi Tomas,
From the contents in your
MNI_ICBM_2009b_NLIN_ASYM/dartel
folder as you showed, it seems the functionea_create_tpm_darteltemplate
(which will generate all the dartel and shoot files) didn’t run through. Maybe you can delete the folderMNI_ICBM_2009b_NLIN_ASYM/dartel
and the fileMNI_ICBM_2009b_NLIN_ASYM/TPM.nii
, and runea_create_tpm_darteltemplate
again from MATLAB command window. You can then send me the full log. I will check out what’s happening during the template generation.Best,
Ningfei12/09/2019 at 11:49 AM #8838andreashornKeymasterGreat, thanks for the PR
12/09/2019 at 3:19 PM #8844tsiegerParticipantHi Ningfei,
I tracked the issue down. This is also a Matlab dependency problem. The problem is inea_delete.m
, which makes use of the.folder
field in the return value from thedir
function.
In the current Matlab 2019b, the entries returned contain the following fields:name folder date bytes isdir datenum
but in R2016a, they contain only:
name date bytes isdir datenum
This problem demonstrates in
ea_create_tpm_darteltemplate
, where a loop is made (l.147-194), cleaning usingea_delete
on each iteration, and crashing at the end of the first iteration, never reaching the others, such that not all templates get created.12/09/2019 at 5:10 PM #8845tsiegerParticipantHi, I ran into another Matlab dependency problem with the
newline
function and create a PR fix for it: https://github.com/netstim/leaddbs/pull/321.12/09/2019 at 5:51 PM #8846tsiegerParticipantAnother problem in interactive 3d viewer control:
Error in ea_mouse_camera/motion_callback (line 63) pt = matlab.graphics.interaction.internal.getPointInPixels(hfig,currpt(1:2)); Error while evaluating Figure WindowButtonMotionFcn
this unfortunatelly also does not work on R2016a :-(.
12/09/2019 at 6:00 PM #8847tsiegerParticipantAnother problem in
vecnorm
, which was introduced in R2017b.
https://github.com/netstim/leaddbs/pull/322Please note that this PR also fixed the problem with incompatible matrix sizes:
Error using - Matrix dimensions must agree. Error in ea_genvat_horn>jr_remove_electrode (line 678) tra = elstruct.trajectory{1,side} - org; Error in ea_genvat_horn (line 355) vat = jr_remove_electrode(vat,elstruct,mesh,side,elspec); Error in ea_stimparams>stimulate_Callback (line 950) [stimparams(1,side).VAT(el).VAT,volume]=feval(ea_genvat,elstruct(el).coords_mm,getappdata(handles.stimfig,'S'),side,options,stimname,options.prefs.machine.vatsettings.horn_ethresh,handles.stimfig); Error in gui_mainfcn (line 95) feval(varargin{:}); Error in ea_stimparams (line 42) gui_mainfcn(gui_State, varargin{:}); Error in matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)ea_stimparams('stimulate_Callback',hObject,eventdata,guidata(hObject)) Error while evaluating UIControl Callback
(I’ve used an explicit
repmat
to fix this.)12/09/2019 at 6:04 PM #8848tsiegerParticipantHowever, now I run into a problem with:
Subscripted assignment dimension mismatch. Error in ea_genvat_horn>jr_remove_electrode (line 712) r_pos(:,r_pos(2,:)>0) = cr_pos; Error in ea_genvat_horn (line 355) vat = jr_remove_electrode(vat,elstruct,mesh,side,elspec); Error in ea_stimparams>stimulate_Callback (line 950) [stimparams(1,side).VAT(el).VAT,volume]=feval(ea_genvat,elstruct(el).coords_mm,getappdata(handles.stimfig,'S'),side,options,stimname,options.prefs.machine.vatsettings.horn_ethresh,handles.stimfig); Error in gui_mainfcn (line 95) feval(varargin{:}); Error in ea_stimparams (line 42) gui_mainfcn(gui_State, varargin{:}); Error in matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)ea_stimparams('stimulate_Callback',hObject,eventdata,guidata(hObject)) Error while evaluating UIControl Callback
size of
rpos
:
3 98658size of
r_pos(:,r_pos(2,:)>0)
:
3 89817size of
crpos
:
3 179622 -
AuthorPosts
- The forum ‘Support Forum (ARCHIVED – Please use Slack Channel instead)’ is closed to new topics and replies.