Lead-DBS
  • Home
  • About
    • Deep Brain Stimulation
    • Quickstart Primer (Post-OP CT-Scans)
    • Quickstart Primer (Post-OP MR-Scans)
    • Publications
    • Citing Lead-DBS
    • Data & Code inclusion philosophy
    • List of Lead-DBS dependencies
    • Lead Connectome
  • News
  • Help/Support
    • Slack User Channel
    • Forum
    • Knowledge Base
      • Lead-DBS Methods
        • AC/PC to MNI conversion
        • DBS Network Mapping
        • Subcortical Electrophysiology Mapping (SEM)
      • Atlases/Resources
        • Cortical Atlas Parcellations (MNI-Space)
        • Subcortical Atlases (MNI-Space)
        • The DISTAL atlas
        • Macaque Atlases (MNI-Space)
        • Normative Connectomes
        • FEM-based VTA model
      • Walkthrough-Videos
      • Other Videos
      • Screenshots
  • Manual
  • Workshops
    • Brisbane February 2020
    • Machine Learning – Berlin September 2019
    • Berlin September 2019
    • Past workshops
      • Hamburg February 2019
      • Shanghai September 2018
      • Berlin 2016
  • Download
  • Contact
  • Search
  • Menu Menu

Matlab version dependency

You are here: Home1 / Forums2 / Support Forum (ARCHIVED – Please use Slack Channel instead)3 / Matlab version dependency4

Tagged: installation, matlab, version

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • 12/06/2019 at 2:48 PM #8811
    tsieger
    Participant

    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 the contains() 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 the contains issue. E.g., I ended up in debug mode in the ea_normalize_spmshoot function (see the keyboard 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,
    Tomas

    12/06/2019 at 4:35 PM #8814
    andreashorn
    Keymaster

    Hi 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 #8815
    andreashorn
    Keymaster

    …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 #8816
    tsieger
    Participant

    Regarding 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, while strfind 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 of contains() 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 of contains() 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 to contains() to mycontains() – 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 #8817
    andreashorn
    Keymaster

    Hi 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 #8818
    andreashorn
    Keymaster

    …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 #8832
    tsieger
    Participant

    Re 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 #8836
    ningfei
    Keymaster

    Hi Tomas,

    From the contents in your MNI_ICBM_2009b_NLIN_ASYM/dartel folder as you showed, it seems the function ea_create_tpm_darteltemplate (which will generate all the dartel and shoot files) didn’t run through. Maybe you can delete the folder MNI_ICBM_2009b_NLIN_ASYM/dartel and the file MNI_ICBM_2009b_NLIN_ASYM/TPM.nii, and run ea_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,
    Ningfei

    12/09/2019 at 11:49 AM #8838
    andreashorn
    Keymaster

    Great, thanks for the PR

    12/09/2019 at 3:19 PM #8844
    tsieger
    Participant

    Hi Ningfei,
    I tracked the issue down. This is also a Matlab dependency problem. The problem is in ea_delete.m, which makes use of the .folder field in the return value from the dir 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 using ea_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 #8845
    tsieger
    Participant

    Hi, 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 #8846
    tsieger
    Participant

    Another 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 #8847
    tsieger
    Participant

    Another problem in vecnorm, which was introduced in R2017b.
    https://github.com/netstim/leaddbs/pull/322

    Please 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 #8848
    tsieger
    Participant

    However, 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 98658

    size of r_pos(:,r_pos(2,:)>0):
    3 89817

    size of crpos:
    3 179622

  • Author
    Posts
Viewing 14 posts - 1 through 14 (of 14 total)
  • The forum ‘Support Forum (ARCHIVED – Please use Slack Channel instead)’ is closed to new topics and replies.

Forum Statistics

Registered Users
130
Forums
1
Topics
185
Replies
607
Topic Tags
81

Subscribe to our newsletter

Latest Tweets

  • Tweet Avatar
    leaddbs
    @leaddbs
    RT @MichaelOkun: Congrats to @DBSThinkTank for the new Frontiers ebook of 26 articles and so far over 100,000 views.… https://t.co/BB5xZQsYr7

    1 year
  • Tweet Avatar
    leaddbs
    @leaddbs
    An automated programming algorithm building on top of Lead-DBS! 🎉😀🎈 https://t.co/2NxaVs9K9z

    1 year
  • Tweet Avatar
    leaddbs
    @leaddbs
    There will be a live demo of @leaddbs in Workshop #5! https://t.co/JCvSGZrkuH

    1 year

Recent Posts

  • Lead-OR out now
  • Bug in Lead-DBS v2.5
  • Lead-DBS v2.5 out now!
  • Lead-DBS on the cover of NeuroImage
  • Lead-DBS on the cover of Biological Psychiatry

Archives

  • August 2021
  • July 2021
  • March 2021
  • September 2020
  • June 2019
  • November 2018
  • September 2018
  • August 2018
  • March 2018
  • November 2017
  • September 2017
  • July 2017
  • April 2017
  • July 2016
  • June 2016
  • May 2016
  • March 2016
  • December 2015
  • November 2015
  • April 2015
  • January 2015
  • December 2014
  • October 2014
  • September 2014
  • July 2014
  • June 2014

Imprint | Privacy Policy

Scroll to top
We use cookies to ensure that we give you the best experience on our website. You may “Accept All” or visit "Cookie Settings" to provide a controlled consent.
Cookie SettingsAccept All
Manage consent

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
CookieDurationDescription
cookielawinfo-checkbox-analytics11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional11 monthsThe cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
PHPSESSIDsessionThis cookie is native to PHP applications. The cookie is used to store and identify a users' unique session ID for the purpose of managing user session on the website. The cookie is a session cookies and is deleted when all the browser windows are closed.
viewed_cookie_policy11 monthsThe cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
Analytics
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
CookieDurationDescription
_ga2 yearsThis cookie is installed by Google Analytics. The cookie is used to calculate visitor, session, campaign data and keep track of site usage for the site's analytics report. The cookies store information anonymously and assign a randomly generated number to identify unique visitors.
_gat_gtag_UA_52019623_11 minuteThis cookie is set by Google and is used to distinguish users.
_gid1 dayThis cookie is installed by Google Analytics. The cookie is used to store information of how visitors use a website and helps in creating an analytics report of how the website is doing. The data collected including the number visitors, the source where they have come from, and the pages visted in an anonymous form.
Third-party
Cookies from third-party contents on the website.
CookieDurationDescription
CONSENT16 years 5 months 17 days 13 hoursThese cookies are set via embedded youtube-videos. They register anonymous statistical data on for example how many times the video is displayed and what settings are used for playback.No sensitive data is collected unless you log in to your google account, in that case your choices are linked with your account, for example if you click “like” on a video.
IDE1 year 24 daysUsed by Google DoubleClick and stores information about how the user uses the website and any other advertisement before visiting the website. This is used to present users with ads that are relevant to them according to the user profile.
test_cookie15 minutesThis cookie is set by doubleclick.net. The purpose of the cookie is to determine if the user's browser supports cookies.
VISITOR_INFO1_LIVE5 months 27 daysThis cookie is set by Youtube. Used to track the information of the embedded YouTube videos on a website.
vuid2 yearsThis domain of this cookie is owned by Vimeo. This cookie is used by vimeo to collect tracking information. It sets a unique ID to embed videos to the website.
YSCsessionThis cookies is set by Youtube and is used to track the views of embedded videos.
yt-remote-connected-devicesneverNo description available.
yt-remote-device-idneverNo description available.
SAVE & ACCEPT
Powered by CookieYes Logo