API details.
def binarize_mask(input_image):
'''
Main function for creating nifti image.
Takes a nifti image, binarizes it and transforms to uint8 and outputs a new image.
'''
transform_formula = '((i > 0) * 1).astype(np.uint8)'
out_image = image.math_img(transform_formula, i=input_image)
return out_image
Main Function
Mask transform handles the file I/O and applies binarize_mask
on the image.
CLI
nifti_binarizer
is the CLI for mask_transform
and will be accessible after installing the package from pip.