Utilities for extracting masks from EPI images and applying them to time series.
Compute a mask file from fMRI data in 3D or 4D ndarrays.
Compute and write the mask of an image based on the grey level This is based on an heuristic proposed by T.Nichols: find the least dense point of the histogram, between fractions m and M of the total image histogram.
In case of failure, it is usually advisable to increase m.
Parameters : | mean_volume : 3D ndarray
reference_volume: 3D ndarray, optional :
m : float, optional
M: float, optional :
cc: boolean, optional :
|
---|---|
Returns : | mask : 3D boolean ndarray
|
Compute a mask file from fMRI nifti file(s)
Compute and write the mask of an image based on the grey level This is based on an heuristic proposed by T.Nichols: find the least dense point of the histogram, between fractions m and M of the total image histogram.
In case of failure, it is usually advisable to increase m.
Parameters : | input_filename : string
output_filename : string or None, optional
return_mean : boolean, optional
m : float, optional
M: float, optional :
cc: boolean, optional :
|
---|---|
Returns : | mask : 3D boolean array
mean_image : 3d ndarray, optional
|
Compute a common mask for several sessions of fMRI data.
Uses the mask-finding algorithmes to extract masks for each session, and then keep only the main connected component of the a given fraction of the intersection of all the masks.
Parameters : | session_files : list of list of strings
threshold : float, optional
m : float, optional
M: float, optional :
cc: boolean, optional :
|
---|---|
Returns : | mask : 3D boolean ndarray
|
Function to get image, data without scalefactor applied
If the image is of Analyze type, and is integer format, and has single scalefactor that is usually applied, then read the raw integer data from disk, rather than using the higher-level get_data method, that would apply the scalefactor. We do this because there seemed to be images for which the integer binning in the raw file data was needed for the histogram-like mask calculation in compute_mask_files.
By loading the image in this function we can guarantee that the image as loaded from disk is the source of the current image data.
Parameters : | fname : str
|
---|---|
Returns : | img : imageformats Image object arr : ndarray |
Given a list of input mask images, generate the output image which is the the threshold-level intersection of the inputs
Parameters : | input_masks: list of strings or ndarrays :
output_filename, string: :
threshold: float within [0, 1], optional :
cc: bool, optional :
|
---|---|
Returns : | grp_mask, boolean array of shape the image shape : |
Return the largest connected component of a 3D mask array.
Parameters : | mask: 3D boolean array :
|
---|---|
Returns : | mask: 3D boolean array :
|
Read the time series from the given sessions filenames, using the mask.
Parameters : | filenames: list of 3D nifti file names, or 4D nifti filename. :
mask: 3d ndarray :
smooth: False or float, optional :
|
---|---|
Returns : | session_series: ndarray :
header: header object :
|
Given a map with some coefficients set to zero, segment the connect components with number of voxels smaller than the threshold and set them to 0.
Parameters : | map: ndarray :
threshold: :
copy: bool, optional :
|
---|