Skip to content

binary_roi_files

Mandy Renfro edited this page Apr 8, 2018 · 1 revision

Creating an ROI Mask Using AFNI

  1. Create new folder for masks
  2. Navigate to your new folder containing the copied underlay image
  3. Create a copy of the underlay image for the mask:
mri_convert /home/data/madlab/surfaces/{experiment}/{sub ID}/mri/brainmask.mgz 
brainmask.nii.gz
  1. Open AFNI by typing "afni" in terminal
  2. Open the "Define Datamode ->" menu, then click "Plugins"
    • Select "Draw Dataset" from the drop-down menu
  3. If you are making the mask for the first time, make sure the "Copy Dataset" box above is yellow and the drop-down to the right says "zero".
    • This will create a matrix of zeros on which you will trace your mask
  4. Click "Choose dataset for copying", then select the structural image
    • Double-click the file name, then hit "Set"
    • The new file will bear the word "COPY-" plus the name of the original file
  5. Immediately exit AFNI and rename the new copy according to your intended mask region:
    • e.g. "lh_caudate_anat_mask.nii.gz"
  6. Open AFNI and again set the underlay as the original structural image
  7. Open the "Define Datamode ->" menu, then click "Plugins"
    • This time, make sure to uncheck the "Copy Dataset" option
  8. Click on "Choose dataset to change directly" and select your newly named matrix of zeros
    • Double-click the file name, then hit "Set"
    • Ensure "Value" on the AFNI Editor [A] is set to "1"
    • DO NOT HIT "DONE" ON THE CURRENT WINDOW TITLED "AFNI Editor [A]". Doing so will close the editor function and you will not be able to access the pen function!
  9. Click on "Underlay", then select the structural image
    • Double-click on name, then "Set"
  10. Click on "Overlay", then select the newly named copy
    • Make sure "See Overlay" is yellow (or it won't be displayed)
    • You are now finally ready to begin drawing your masks!
  11. Of the three views, select the window that allows you the best view of the region you wish to mask
    • Enlarge the window for ease of viewing by clicking the bottom right corner and dragging diagonally
    • The bar below the image represents the number of slices in the volume (~255) and serves as a way to keep track of where you are in space. Drag the gray boxes or use the arrow keys to navigate
  12. On the right side of the window, you'll see options:
    • Adjusting the color overlay opacity will help you apply the borders of the masked area properly
    • You must select the "pen" option to begin drawing on the image
  13. Cycle through the slices until you are finished, then click "Save" on the AFNI Editor [A] window