David Shattuck

Forum Replies Created

Viewing 15 posts - 16 through 30 (of 66 total)
  • Author
    Posts
  • in reply to: Automation of multiple Fibertrack saves #4751
    David Shattuck
    Keymaster

    If you send an email to support at brainsuite.org, I’ll see what I can do. Let me know what platform (Mac/Win/Linux) you are using.

    thanks,
    David

    in reply to: Automation of multiple Fibertrack saves #4749
    David Shattuck
    Keymaster

    Hello –

    I have written some command-line tools that can probably do this. I thought we were distributing them, but I just checked and they aren’t in the public release yet.

    Can you be more specific about what you are trying to do and what steps you are taking? Are you trying to give it pairs of ROIs and save out a .dft file?

    thanks,
    David

    in reply to: question for matlab installation and version #4673
    David Shattuck
    Keymaster

    You will need to install Matlab Runtime 2019b if you don’t have Matlab 2019b installed. The programs for BDP and SVReg are built using the Matlab Compiler for version 2019b, so they require that specific version of the runtime libraries.

    There won’t be a conflict with your existing installation. The files are located in a separate directory and the different versions of Matlab products will load the appropriate libraries.

    -David

    in reply to: Export File to .stl #3841
    David Shattuck
    Keymaster

    Hi — it’s actually very easy. When you have a surface file loaded in BrainSuite, you can just save it and use a .stl extension. From the Surface Display toolbox, you would select the surface you want to save, click on the save icon, and type a filename ending in .stl.

    However, I just tried this on my Mac running Monterey (12.6) and it now won’t let me do that. I think this is a recent change with the OS, so I’ll fix that in the next release. It should still work on Linux or Windows.

    Give that a try and let me know how it goes. What surface are you trying to print?

    thanks,
    David Shattuck

    in reply to: Access Denied after CMC command for BDP #3248
    David Shattuck
    Keymaster

    If you want to show exact commands, I think you can use html code blocks. Unfortunately, WordPress converts double dashes into a single em dash character (em dashes are the width of an m character, en dashes are the width of an n character).

    For example, if you type

    <code>--flag</code>

    Wordpress will display

    --flag

    You can also use back ticks in place of the code tags.

    If you want to show a command line, please put try the code tags.

    in reply to: Access Denied after CMC command for BDP #3228
    David Shattuck
    Keymaster

    Can you provide more details on how you are running it?

    Have you installed the Matlab Runtime 2019b?

    We developed and tested the latest release extensively on Windows 10, so it should run provided you have the Matlab Runtime installed. It has to be 2019b specifically. Mathworks link here: https://ssd.mathworks.com/supportfiles/downloads/R2019b/Release/3/deployment_files/installer/complete/win64/MATLAB_Runtime_R2019b_Update_3_win64.zip

    thanks,
    David Shattuck

    in reply to: Cannot launch BrainSuite #3094
    David Shattuck
    Keymaster

    hi –

    For use with BrainSuite, you can usually skip adding the environment variables to your path. We have done this in the shell scripts that we use to call the compiled MATLAB programs. If you look, for example, at the bdp.sh script, you can see this bit:

    # Set up path for MCR applications.
    LD_LIBRARY_PATH=.:${BrainSuiteMCR}/runtime/glnxa64 ;
    LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${BrainSuiteMCR}/bin/glnxa64 ;
    LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${BrainSuiteMCR}/sys/os/glnxa64;
    MCRJRE=${BrainSuiteMCR}/sys/java/jre/glnxa64/jre/lib/amd64 ;
    LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${MCRJRE}/native_threads ; 
    LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${MCRJRE}/server ;
    LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${MCRJRE}/client ;
    LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${MCRJRE} ;  
    XAPPLRESDIR=${BrainSuiteMCR}/X11/app-defaults ;
    export LD_LIBRARY_PATH;
    export XAPPLRESDIR;
    
    BDPEXEDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)" ;
    export BDPEXEDIR;
    
    "${exe_dir}/bdp" "$@"

    which sets the library paths before calling bdp. BrainSuiteMCR gets set at the start of the script based on standard installation locations, or you can set it as an environment variable (useful for you install it in a non-default location). This strategy should reduce the impact of the installation.

    You can undo the changes you made to your .bashrc file and give it a try.

    thanks,
    David

    in reply to: Cannot launch BrainSuite #3083
    David Shattuck
    Keymaster

    hi –

    Which version of Linux are you using?

    Can you try installing xinerama? On some platforms, this will fix the issue. Specifically, this fixed that issue on Ubuntu 16.04.

    sudo apt-get install -y libxcb-xinerama0

    For BrainSuite21a, the version of Matlab Runtime to use is 19b. Direct link: https://ssd.mathworks.com/supportfiles/downloads/R2019b/Release/3/deployment_files/installer/complete/glnxa64/MATLAB_Runtime_R2019b_Update_3_glnxa64.zip

    That isn’t causing the launch problem, but it is necessary to run some of the programs in BrainSuite.

    Let us know if that fixes the problem — if not we can get some further information and help you resolve this.

    thanks,
    David Shattuck

    in reply to: Cortical surface file conversion #2962
    David Shattuck
    Keymaster

    hi Gonzalo –

    The obj format used in BrainSuite is the MNI obj format, which was more widely used when we first developed BrainSuite.

    There is a way to get a Wavefront obj file from BrainSuite — if you save out a surface file using .wfo as the extension (I used wfo to represent WaveFront Obj) and then change the extension to .obj, you should be able to use it in programs that read Wavefront Obj files. I do this sometimes when I want to look at BrainSuite surfaces in Meshlab, and it works fine.

    You can also use a .stl extension, and the surface will be saved in STL format. Some of our users have used this to 3D print brain models made in BrainSuite.

    Just one note — both of these formats lose some of the information that BrainSuite uses in its different functions.

    Give it a try and let us know if it works for you.

    thanks,
    David Shattuck

    in reply to: bdp 18b source code link shows “not found” #2873
    David Shattuck
    Keymaster

    We have updated the source code links for 19b and 21a.

    thanks,
    David

    in reply to: Brainsuite crashes #2465
    David Shattuck
    Keymaster

    Better yet, can you provide an example subject/file ID for which this happens, and one of us can retrieve it from the ADNI database?

    in reply to: multiple bdp.sh commands in bash #1579
    David Shattuck
    Keymaster

    hi Dahyun –

    I don’t know why the semicolon isn’t working — the bash shell should be separating them into separate commands. It looks like you are only using one dash for the –nii flag, though. That could just be how our forum software translated it into text (it sometimes converts two dashes into a single emdash).

    In any case, for multiple subjects, I would typically use a for loop, like this:

    for SubjID in subj1 subj2 subj3; do
    	/Applications/BrainSuite18a/bdp/bdp.sh ${SubjID}.bfc.nii.gz --nii ${SubjID}.dwi.nii.gz -g ${SubjID}.bvec -b ${SubjID}.bval
    done

    For this, you only type the BDP command once, and you can add subjects to the for loop as you like. If you put this in a bash script, you can reuse it, something like:

    #!/bin/bash
    for SubjID in $@; do
    	/Applications/BrainSuite18a/bdp/bdp.sh ${SubjID}.bfc.nii.gz --nii ${SubjID}.dwi.nii.gz -g ${SubjID}.bvec -b ${SubjID}.bval
    done

    If you save that into a file, let’s say runBDPsubjs.sh, make it executable (using chmod +x runBDPsubjs.sh), then you can run it from the command line and pass it the subject IDs that you want to process, e.g.,

    runBDPsubjs.sh subj1 subj2 subj3

    It will run the commands you are trying to call. The $@ in the script contains the arguments that you passed to the script on the command line.

    Hope that helps.

    -David Shattuck

    in reply to: Curve Toolbox – Curve lenght #1524
    David Shattuck
    Keymaster

    hi Davide –

    We don’t have tools for that as part of the package, but if you are familiar with Matlab or C++ you can calculate these lengths pretty easily. If you save out the curves as a .dfc file, you can then read them with one of our file readers.

    You can find a Matlab function for reading the dfc file at the bottom of this page: http://brainsuite.org/formats/dfc/. (I think it is out

    function [curves,hdr,xml]=readdfc(filename)
    % READDFC reads a BrainSuite curve file.
    %
    % Author : David Shattuck, UCLA Brain Mapping Center
    fid=fopen(filename,'rb');
    if (fid<0)
        error(['unable to open file ' filename(:)']);
    end;
    hdr.magic=char(fread(fid,8,'char')');
    hdr.version=fread(fid,4,'uchar');
    hdr.headerSize=fread(fid,1,'uint32');
    hdr.dataStart=fread(fid,1,'uint32');
    hdr.metadataOffset=fread(fid,1,'int32');
    hdr.subjectDataOffset=fread(fid,1,'int32');
    hdr.nCurves=fread(fid,1,'int32');
    fseek(fid,hdr.metadataOffset,'bof');
    xml=char(fread(fid,hdr.dataStart-hdr.metadataOffset,'char')');
    curves=cell(hdr.nCurves,1);
    fseek(fid,hdr.dataStart,'bof');
    for i=1:hdr.nCurves;
        nPoints=fread(fid,1,'uint32');
        curves{i}=fread(fid,[3 nPoints],'float32')';
    end;
    fclose(fid);

    The curves are represented as a series of points in mm coordinates, so you can compute the path lengths very easily:

    function curvelength=curvelength(curve)
    curvelength=sum(sqrt(sum((curve(2:size(curve,1),:)-curve(1:size(curve,1)-1,:)).^2,2)));

    If you then read in a dfc, you can easily compute the length of any of the curves:

    curveset=readdfc('/Applications/BrainSuite18a/svreg/BCI-DNI_brain_atlas/BCI-DNI_brain.right.dfc');
    curvelength(curveset{1})
    

    Let us know if that does what you need.

    thanks,
    David Shattuck

    in reply to: combine and delete labels #970
    David Shattuck
    Keymaster

    One way you can do this is by using the LabelMask tool, which is in the Delineation Panel. If you press ‘Update List’ you will see all of the labels that are in the label volume. Select all of the ones you want to keep, then press Make Mask. If you then load the label file as the primary volume, you can then apply the mask to the volume (press ‘Apply’), and it will set all of the labels outside of the mask to 0. Save the primary volume as your new label volume, and then load it. It should only have the labels that you want.

    in reply to: Show one ROI only #919
    David Shattuck
    Keymaster

    Hi Leo –

    There isn’t a direct way, but you can easily create a mask from the label file. There is a tool in the Delineation Toolbox called “Label Mask Tool” (it’s at the bottom of the toolbox). If you first press “Update List” and then select your structure, you can press “Make Mask” to generate a mask volume for just that object (this will overwrite whatever is currently in the mask buffer). If you then save this mask out, you could load it in as a label. It would be set to 255 for your structure, and 0 for everywhere else.

    Will that give you what you need?

    thanks,
    David Shattuck

Viewing 15 posts - 16 through 30 (of 66 total)