Skip to main content
. 2021 Feb 1;7(2):22. doi: 10.3390/jimaging7020022
Algorithm 1 Skull Stripping
  • 1:

    input: gray scale image, im

  • 2:

    Calculate Otsu’s Threshold

     Tgraythresh(im)

  • 3:

    Threshold the image

     BWim2bw(im,T)

  • 4:

    Open the binary image using a disk structuring Seed

     BWimopen(BW,se)

  • 5:

    Dilate the binary image

     BWimdilate(BW,se)

  • 6:

    Select the largest binary image

     BWlargest_blob(BW)

  • 7:

    Dilate the binary image

     BWimclose(BW,se)

  • 8:

    Fill holes on the binary image

     BWimfill(BW,se)

  • 9:

    Remove the skull

     strippedim(!BW)=0

  • 10:

    return stripped