3D Pulse-coupled Neural Networks (PCNN) for rodent brain extraction

The 3D PCNN method allows automatic brain extraction of rodent brain. It is optimized for T2-weighted MRI (eg, 2D multislice or 3D Fast Spin-Echo). The default setting is for mouse brain. It can be adapted to rat brain by changing the threshold of brain volume to account for the larger brain. This software is free for academic and non-commercial use.


(1) Binary (compiled on CentOS 5 64-bit)

(2) Matlab


  1. Binary:

    Simply typing in command line:

                ./PCNNBrainExtract -i input.img -o output -od /output_folder/ -bm 2 –k

    To see more options, type


    Some important parameters are:

                -k : keep brain mask of each iteration

                -minv : min brain volume (mm3)

                -maxv : max brain volume

    The default brain volume limit is for mouse brain. If you are applying to rat brain, add settings like –minv 1200 –maxv 4400.

  2. Matlab:

    First load the image data as a 3D matrix into Matlab. For Analyze format, one can use the read_analyze.m in the package.

    Then use the following command to generate the brain mask:

    [I_border, G_I] = PCNN3D(I, p, voxeldim, BrSize, maxiter)


    Where the inputs are:

           I: 3D matrix of the brain image

           p: radius of the structural element (in pixel)

           voxeldim: [x, y, z] voxel dimensions of the data set (in mm)

          BrSize: [min max] brain volume sizes (in mm3) for estimating optimal iteration; default values [100 550] is for mouse brain. For adult rat brain, one may try [1200 4400]

      maxiter: maximum iteration. Default is 200

          The outputs:

            I_border: A cell array that stores the binary mask at each iteration.

      G_I: the plot of volume of mask (in mm3) vs. iterations, like the following.

    For example, if the optimal iteration is #37, I_border{37} will be the binary mask which can be multiplied with the input image, I, to produce the extracted brain.

    For more information of each command, type help command in Matlab command line. For example, type help PCNN3D will show all the adjustable options.


N Chou, J Wu, J Bai, A Qiu, KH Chuang. “Robust automatic rodent brain extraction using 3D Pulse-coupled Neural Networks (PCNN).” IEEE Trans Imag Proc 20(9):2554-64, 2011.