Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
/ bet2 Public
forked from liangfu/bet2

MATLAB mex interface and Python wrapper for standalone Brain Extraction Tool (bet2),

License

Notifications You must be signed in to change notification settings

aghaeifar/bet2

Repository files navigation

bet2

standalone Brain Extraction Tool (bet2) with python wrapper, released by http://fsl.fmrib.ox.ac.uk/

The following features are added:

  • The program is reconfigured using CMake
  • CMake configures MATLAB mex target as well.
  • Building static and dynamic library (dll or so) of BET
  • Support Windows and Linux

To build:

git clone https://github.com/aghaeifar/bet2.git
cd bet2
mkdir build
cd build
cmake ..
make -j4

To use MATLAB mex interface:

bet2_mex(input)

where input is a 3D single real array.

To use in Python:

import ctypes
handle = ctypes.CDLL(os.path.join(dir_path, "lib", "libbet2.so"))
handle.runBET.argtypes = [np.ctypeslib.ndpointer(np.float32, ndim=self.img_mag.ndim, flags='F'),
 np.ctypeslib.ndpointer(np.float32, ndim=len(mask_size), flags='F'),
 ctypes.c_int, ctypes.c_int, ctypes.c_int]
mask_size = mag.shape
mag = self.img_mag.copy(order='F')
mask = np.zeros(mask_size, dtype=mag.dtype, order='F')
handle.runBET(mag, mask, *mask_size)

where input is a 3D float32 real numpy array.

Precompiled mex files for Windows and Linux can be downloaded in the repository releases.

About

MATLAB mex interface and Python wrapper for standalone Brain Extraction Tool (bet2),

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 62.6%
  • C 29.1%
  • HTML 5.1%
  • Makefile 1.7%
  • Shell 0.7%
  • Tcl 0.5%
  • Other 0.3%

AltStyle によって変換されたページ (->オリジナル) /