Importing ROIs

Viewing 4 reply threads
  • Author
    Posts
    • #86
      burgewk
      Participant

      Hi BrainSuite community,

      Is there any way to import a set of regions of interest into BS to extract the cortical thickness values from that specified region? I have the current regions of interest in freesurfer .label files as well as converted to .nii volume based regions.

      Also, if I use the label painter tool, can I create a region on a template brain that can be used for the rest of my subjects?

      Thanks for your help with this,

      Wes

    • #87
      Anand Joshi
      Moderator

      Hi Wes,
      I can help you with this.
      There is matlab script to use a different list of ROIs to compute the statistical measures. (item 6). You can specify the list of ROIs, names of surface and volume label files to this script and the script will output all the cortical and volumetric measures.

      http://neuroimage.usc.edu/neuro/Resources/BST_SVReg_Utilities
      \
      Also you can create their own atlas with you own ROIs (item 7) and then compute statistics on those.

      Please give it a try and let me know if it works.

      Anand

      • #88
        burgewk
        Participant

        Hi Anand,

        Thanks for getting back to me. I have a few more questions:

        What sort of registration should I be doing to get my regions into BS space?

        We are trying to confirm our findings from Freesurfer in a separate analysis stream. So we will have both a Freesurfer based reconstruction and a Brain Suite based reconstruction for each participant. The end goal is to extract the thickness values for each region that we are interested in. All of our regions are hand drawn in Freesurfer as labels which we can convert to volumes (.nii) easily enough. Should I be registering their Freesurfer based anatomy to one of the outputs from the ‘Cortical surface extraction sequence’? If so, which output should I aim for.

        I hope the above was clear. Please let me know if you need additional info.

        Best,

        Wes

      • #89
        Anonymous
        Inactive

        Hi Wes, For correct computation of ROI-wise statistics, the hand-drawn labels should overlay correctly with *.bfc.nii.gz file in BrainSuite GUI.

        In order to achieve that you can co-register the anatomical image (converted to .nii) on which the labels were drawn to the *.bfc.nii.gz file generated by BrainSuite. This registration should be done in rigid fashion, with 6 DOF, and following registration tool can be used for the purpose:

        http://neuroimage.usc.edu/neuro/Resources/BDPAddons#affineReg

        Next, you should apply the same transformation to the hand-drawn label file itself (converted to .nii) using transform_data_affine() function with ‘nearest’ interpolation method. Please see the html file in the registration-tool zip/folder for detailed documentation.

    • #90
      burgewk
      Participant

      Hi Brain Suite community,

      Things are going along well with this. I am now at the stage where I would like to extract the information from my ROIs that have now been registered and put into BS space. This is where I run into an error.

      Anand suggested I use the utilities file: main.generate_stats_xls_manual.m which has this at line 28:

      l=readdfs([subbasename,’.left.mid.cortex.’,surf_ext]);

      However, after my cortical extraction I did not have a .mid in my folder. I tried to run the svreg but it also was looking for the .mid files. Is there some other step I should do to generate the .mid files?

      Here is an ls of my output folder:

      mprage.air mprage.left.pial.cortex.dfs
      mprage.bfc.nii.gz mprage.mask.nii.gz
      mprage.brain.dfs mprage.nii.gz
      mprage.bse.nii.gz mprage.outer_skull.dfs
      mprage.cerebrum.mask.nii.gz mprage.pial.cortex.dfs
      mprage.cortex.dewisp.mask.nii.gz mprage.pvc.frac.nii.gz
      mprage.cortex.scrubbed.mask.nii.gz mprage.pvc.label.nii.gz
      mprage.cortex.tca.mask.nii.gz mprage.right.inner.cortex.dfs
      mprage.hemi.label.nii.gz mprage.right.pial.cortex.dfs
      mprage.init.cortex.mask.nii.gz mprage.scalp.dfs
      mprage.inner.cortex.dfs mprage.skull.label.nii.gz
      mprage.inner_skull.dfs mprage.warp

      I appreciate the help!

      Wes

      • #91
        burgewk
        Participant

        Here is the output when trying to run the GUI based svreg

        Executing: /Applications/BrainSuite15b/svreg/bin/svreg_label_surf_hemi.sh /Volumes/Storage_backup/session_1/anat_1/mprage /Applications/BrainSuite15b/svreg/BCI-DNI_brain_atlas/BCI-DNI_brain left -v1
        Executing: /Applications/BrainSuite15b/svreg/bin/svreg_label_surf_hemi.sh /Volumes/Storage_backup/session_1/anat_1/mprage /Applications/BrainSuite15b/svreg/BCI-DNI_brain_atlas/BCI-DNI_brain right -v1
        Finished surface labeling 0:00
        error reading /Volumes/Storage_backup/session_1/anat_1/mprage.left.mid.cortex.svreg.init.dfs
        error reading /Volumes/Storage_backup/session_1/anat_1/mprage.right.mid.cortex.svreg.init.dfs

      • #92
        burgewk
        Participant

        I think I figured it out. I tried to run it from the command line and found it to be a X11 issue. I had to download xquartz and it appears to be running the svreg now. I am using OSX v 10.10.5 for anyone else who might encounter this.

        Wes

    • #93
      Anand Joshi
      Moderator

      Great! Good that things are working. Please let me know if there are any more issues.

      • #94
        burgewk
        Participant

        Ok I got through the svreg pipeline without error. I have also run my test subject through the thicknessPVC.sh pipeline.

        I tried to run through the generate_stats_xls_manual file and it works, but I’m not really sure what I should be feeding it.

        subbasename=’/Storage/session_1/anat_1/mprage’;
        vol_label_file=’/Storage/1_LH_V1.label.nii’; % binary volume file registered to .bfc
        ROI_IDs= [1];
        surf_ext=’svreg.dfs’; %[subbasename,’.left.mid.cortex.’,surf_ext]
        output_ext=’testout’; %[subbasename,’.roiwise.’,output_ext,’.stats.txt’]
        generate_stats_xls_manual(subbasename,vol_label_file,ROI_IDs,surf_ext,output_ext);

        I’m not really sure what I should be putting for ROI_IDS. I’ve tried several different combinations of numbers. I thought 1 would be correct as the mask is binary. For ROI_IDs = 1 I get:

        ROI_ID Mean_Thickness(mm) GM_Volume(mm^3) CSF_Volume(mm^3) WM_Volume(mm^3) Total_Volume(GM+WM)(mm^3) Cortical_Area_mid(mm^2) Cortical_Area_inner(mm^2) Cortical_Area_pial(mm^2)
        1 NaN 219.089869 7.097567 9.160284 228.250153 0.000000 0.000000 0.000000

        So it has a GM volume, but no thickness value?

        Should I be setting my binary mask not equal to 1? I had a look around the xml file with ROI Ids but I don’t really know what I should be setting it to.

        Thanks for the help,

        Wes

        • This reply was modified 9 years, 2 months ago by burgewk.
    • #97
      burgewk
      Participant

      It worked, thanks!!

    • #96
      Anand Joshi
      Moderator

      Hi Wes,
      1 is a fine value for the script. The problem is that the volume is labeled, but these labels are not transferred to the surfaces, so the thickness values are not computed.

      You can follow these steps

      1. run Brainsuite + SVReg
      2. run thicknessPVC.sh
      3. run the following commands
      subbasename=’/Storage/session_1/anat_1/mprage’;
      vol_label_file=’/Storage/1_LH_V1.label.nii’;
      slt=readdfs([subbasename, ‘.pvc-thickness_0-6mm.left.mid.cortex.dfs’]);
      sl=readdfs([subbasename, ‘.left.mid.cortex.svreg.dfs’]);

      sl.attributes=slt.attributes;

      vl=load_untouch_nii(vol_label_file);
      res=vl.hdr.dim.pixdim(2:4);
      % copy volumetric labels to surfaces;
      sl.labels=interp3(double(vl.img),sl.vertices(:,2)/res(2)+1,sl.vertices(:,1)/res(1)+1,sl.vertices(:,3)/res(3)+1,’nearest’);

      slin=readdfs([subbasename, ‘.left.inner.cortex.svreg.dfs’]);
      slpial=readdfs([subbasename, ‘.left.pial.cortex.svreg.dfs’]);

      slin.labels=sl.labels;
      slin.attributes=sl.attributes;

      slpial.labels=sl.labels;
      slpial.attributes=sl.attributes;

      writedfs([subbasename, ‘.left.inner.cortex.svreg2.dfs’],slin);
      writedfs([subbasename, ‘.left.mid.cortex.svreg2.dfs’],sl);
      writedfs([subbasename, ‘.left.pial.cortex.svreg2.dfs’],slpial);

      %% Do the same for the right hemisphere
      slt=readdfs([subbasename, ‘.pvc-thickness_0-6mm.right.mid.cortex.dfs’]);
      sl=readdfs([subbasename, ‘.right.mid.cortex.svreg.dfs’]);

      sl.attributes=slt.attributes;

      vl=load_untouch_nii(vol_label_file);
      res=vl.hdr.dim.pixdim(2:4);
      % copy volumetric labels to surfaces;
      sl.labels=interp3(double(vl.img),sl.vertices(:,2)/res(2)+1,sl.vertices(:,1)/res(1)+1,sl.vertices(:,3)/res(3)+1,’nearest’);

      slin=readdfs([subbasename, ‘.right.inner.cortex.svreg.dfs’]);
      slpial=readdfs([subbasename, ‘.right.pial.cortex.svreg.dfs’]);

      slin.labels=sl.labels;
      slin.attributes=sl.attributes;

      slpial.labels=sl.labels;
      slpial.attributes=sl.attributes;

      writedfs([subbasename, ‘.right.inner.cortex.svreg2.dfs’],slin);
      writedfs([subbasename, ‘.right.mid.cortex.svreg2.dfs’],sl);
      writedfs([subbasename, ‘.right.pial.cortex.svreg2.dfs’],slpial);

      4. now run

      ROI_IDs= [1];
      surf_ext=’svreg2.dfs’;
      output_ext=’testout’; %[subbasename,’.roiwise.’,output_ext,’.stats.txt’]
      generate_stats_xls_manual(subbasename,vol_label_file,ROI_IDs,surf_ext,output_ext);

      This should work. Please let me know if there is any problem.

      • This reply was modified 9 years, 2 months ago by Anand Joshi.
Viewing 4 reply threads
  • You must be logged in to reply to this topic.