David Shattuck

Forum Replies Created

Viewing 15 posts - 1 through 15 (of 40 total)
  • Author
    Posts
  • 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

  • in reply to: command line tools in BS 17a? #834

    David Shattuck
    Keymaster

    hi Tod –

    The binaries should have been included — I will repackage them later this week and upload a new version. We made a few final fixes right before release, and it looks like the code wasn’t recompiled before we packaged it.

    What version of the MSVC compiler are you using? The strideiterator file would only affect BSE, and it compiles under MSVC2013 (I think it fails on MSVC2015 or later).

    thanks,
    David

  • in reply to: T1 file #696

    David Shattuck
    Keymaster

    What T1 file are you expecting to see? Are you trying to load your own image?

    We have tutorial data on our website. If you need data to use, you can start here:

    http://brainsuite.org/tutorials/

    perhaps with the Cortical Surface Extraction tutorial:

    http://brainsuite.org/tutorials/cseexcercise/

    thanks,
    David Shattuck


  • David Shattuck
    Keymaster

    Hi Dayana –

    There is a download button at the top of the page. Go there, or use this link:

    Download

    and select the correct version for your operating system.

    thanks,
    David Shattuck

  • in reply to: Command Line: Cerebrum Labeling #549

    David Shattuck
    Keymaster

    Hello –

    There is also cortical_extraction.sh, which can be run from bash on Mac or Linux. It sets all of the parameters to be the same as the GUI. If necessary, you can copy it and edit it if you need to make any changes. If you do edit it, then you will want to make sure that BrainSuiteDir is set to the installation path. If it is not set, then the script will try to find the files based on location of the script.

    thanks,
    David

  • in reply to: BrainSuite GUI compile under debian Linux #548

    David Shattuck
    Keymaster

    Hi Gavin –

    I think you are probably using either the build I sent you in August, or perhaps the current linux release version. In any case, I believe I have resolved this issue with the latest release of BrainSuite (16a1). I think it has to do with differences between the gcc compiler and the clang compiler. Clang didn’t report any errors compiling the 16a source code, but gcc did. I have fixed the few places where there were problems, and I have successfully compiled the source code under gcc 4.8. We still use clang for the official releases.

    thanks,
    David

  • in reply to: nii2nii.gz #450

    David Shattuck
    Keymaster

    Hi Christian –

    That’s great. One thing to make sure is that the order of the volumes is the same as is in your bvec/bval files. I’m not sure how best to do that. It might be safer to re-run dcm2nii on your original DICOM files, and make sure it outputs a 4D volume rather than individual 3D volumes. Are you using the latest version of dcm2nii?

    We do have our own programs for merging DWI files (see here: http://neuroimage.usc.edu/neuro/Resources/BDPAddons#mergeDWIs), which is useful when a set of diffusion data is acquired as two different acquisitions. However, this program expects to have one bvec and one bval file per nii file. I think this would be different from how your data currently are stored.

    thanks,
    David

  • in reply to: nii2nii.gz #392

    David Shattuck
    Keymaster

    Hi Cristian –

    What tool did you use to convert them from DICOM to nifti? We typically use dcm2nii, which is included with MRIcron.

    thanks,
    David

  • in reply to: nii2nii.gz #390

    David Shattuck
    Keymaster

    Hi Cristian –

    How are you generating your .nii files in the first place? Do you have corresponding bvec and bval files already?

    I don’t think we have a tool available from our site for doing this, but if you have FSL installed I believe you can do it with that. Let me know about the bvec/bval files, and I will see how we can help you with this.

    thanks,
    David Shattuck

  • in reply to: Command Line: Cerebrum Labeling #364

    David Shattuck
    Keymaster

    Hello –

    Can you provide the specific command line call that you are making, including all arguments?

    If that stage works in the GUI, the best thing to do is to use the cortical_extraction.cmd script. It is configured to have settings that match those in the GUI, and will produce identical results.

    thanks,
    David Shattuck

  • in reply to: Crash during Topology Correction #354

    David Shattuck
    Keymaster

    Hi Michaela –

    I have recently fixed a bug in the topology correction step, which caused the program to crash in certain cases. Can you download the latest version (16a1) and try again?

    thanks,
    David Shattuck

  • in reply to: Do i need permission to publish my results. #353

    David Shattuck
    Keymaster

    Hello –

    No, you do not need our permission to publish your results. The software is provided freely without any such restrictions. We do appreciate the citations, which help us document that the software is being used.

    thanks,
    David Shattuck

Viewing 15 posts - 1 through 15 (of 40 total)