
The following files are from different authors and have their own licenses

niftilib (updated to support NIfTI 2) and znzlib are public domain
  https://nifti.nimh.nih.gov/pub/dist/src/nifti2/
  http://sourceforge.net/projects/niftilib/files/latest/download

zlib is optional and includes a simple license
 https://www.zlib.net/zlib_license.html

The project can optionally be compiled with the accelerated CloudFlare zlib. This is fully compatible with the BSD license.
 https://github.com/cloudflare/zlib

The project can optionally be compiled to support the Butterworth filter (bw.c). The Recursive digital filter functions are provided under LGPL from Exstrom Laboratories.
 http://www.exstrom.com/journal/sigproc/
 https://www.gnu.org/licenses/lgpl-3.0.en.html

The bwlabel.c file is Jesper Andersson's connected component labeling, which he has provided under the BSD 2-Clause license.

On January 7, 2020 Matthew Webster said that direct copies of the fslmaths text and error messages were permitted and are not copyrighted. This allows users to have a common interface and error detection routines.

This code was written without access to fslmaths routines, and is largely based on reverse engineering. Over the years, the fsl team has done an outstanding job of describing their algorithms on the jiscmail website. In a couple instances, no public data was available to describe the algorithms, and Taylor Hanayik from the FSL group was gracious enough to write psuedo-code that allowed accurate emulation of the fslmaths functions.

The project can optionally be compiled with tensor decomposition code by Daniel Glen (2004). This was developed at the US National Institutes of Health and is not copyrighted but is provided with permission from the author.
  https://github.com/afni/afni

The rest of the code was written by Chris Rorden (2020) and is distributed using the 2-Clause BSD license. 

----------

Copyright <2020> <Chris Rorden>

Redistribution and use in source and binary forms, with or without modification, are 
permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of 
conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of 
conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 
THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.