Image¶
- sekupy.utils.image.afni_converter(afni_fname, output_fname, brick=None)[source]¶
This function converts AFNI *.HEAD / *.BRIK files in nii.gz fortmat.
- Parameters:
afni_fname (string) – Path to the specified HEAD/BRIK file
output_fname (string) – Path to the output file (N.B. specify the extension)
brick (int) – The number of the volume to be converted
- sekupy.utils.image.conjunction_map(a_map, b_map, output_fname, output='mask')[source]¶
This is a function to perform conjunction operation of two maps (a * b). The second map will be considered as a binary image, using nonzero values to mask the first one. If output is ‘mask’ the output will be binary image, in the other case (‘image’) the output will be with image_map values in nonzero mask voxels.
- Parameters:
a_map (string) – The filename of the input image
b_map (string) – The filename of the input image
output_fname (string) – The filename of the output image
output (str, optional | {default='mask', 'image_map'}) – The output type. If ‘mask’ the output will be a binary image, else the values of the conjunction are those of image_map.
- sekupy.utils.image.remove_mean_nifti(img_fname, output_fname, mask_fname=None)[source]¶
This function is used to remove the average value from a nifti file. If a mask is provided, the average is calculated only using the mask nonzero voxels.
- Parameters:
filename (string) – The filename of the input image
output_fname (string) – The output filename of the stored image
mask (
numpy.ndarray, optional) – The mask on which average is calculated (the default is None)
- Returns:
output_image – The nifti image
- Return type:
- sekupy.utils.image.remove_value(image, value, mask=None)[source]¶
This function remove a value from a nibabel image.
- Parameters:
image (ndarray) – The input image array
value (float) – The value that should be subtracted from the image
mask (ndarray, optional) – The mask on which subtraction is performed (the default is None)
- Returns:
image – The array with the value removed.
- Return type:
array
- sekupy.utils.image.remove_value_nifti(img_fname, value, output_fname, mask_fname=None)[source]¶
This function is used to remove a single value from a nifti file. If a mask is provided, the value is removed only in the mask voxels.
- Parameters:
filename (string) – The filename of the input image
output_fname (string) – The output filename of the stored image
value (float) – The value that should be subtracted from the image
mask (ndarray, optional) – The mask on which subtraction is performed (the default is None)
- Returns:
The nifti image
- Return type:
output_image
- sekupy.utils.image.save_map(filename, map_array, affine=None, return_nifti=True)[source]¶
This function saves an a 3D/4D map in nifti format.
- Parameters:
filename (string) – The output filename of the stored image
map_array (ndarray (3D/4D array)) – The array of the map to be stored
affine (matrix (dim x dim), optional) – Affine transformation of the map (the default is None)