- class designer.plotting.snrplot.makesnr(dwilist, noisepath=None, maskpath=None)¶
Bases:
object
Class object that computes and prints SNR plots for any number of input DWIs
- Parameters
dwilist (list of str) – List of 4D DWI (nifti-format) paths to evaluate and plot
noisepath (str) – Path to noise map from “dwidenoise”
maskpath (str, optional) – Path to brain mask
- __init__ : constructs makesnr class
- getuniquebval : creates a list of unique B-values for the purpose of
SNR computation
- computesnr : performs SNR computation
- histcount : bins SNR values
- makeplot : creates and saves SNR plot from bin counts
- computesnr()¶
Computes SNR of all DWIs in class object
- Returns
snr_dwi – Numpy array of SNR across all DWI.
- Return type
ndarray
- getuniquebval()¶
Creates a list of unique B-values for the purpose of SNR computation. In the calculation of SNR, B0 signal can be averaged becase they are not associated to any direction. This is not true for non-B0 values however, because every 3D volume represents a different direction. To compute SNR appropriately, differences in gradients have to be accounted. This function creates a list of B-values in the order they need to appear for the calculation of SNR.
- Returns
b_list – Numpy vector containing list of B-values to be used in SNR calculation
- Return type
ndarray
- histcount(nbins=100)¶
Bins SNR into nbins and returns various counting properties
- Parameters
nbins (int)
Number of bins to plot
- Returns
count (ndarray) – Array of count of voxels in bins
binval (ndarray) – Array of bin values
unibvals (ndarray) – Array containing all unique B-values detected
- makeplot(path, smooth=True, smoothfactor=5)¶
Creates and saves SNR plot to a path as SNR.png
- Parameters
path (str) – Directory to save the plot in
smooth (bool, optional) – Specify whether to interpolate and smooth (Default: True)
smoothfactor (int, optional) – Smoothing factor to apply (Default: 5)
- Returns
None
- Return type
Writes out image into directory as SNR.png
- designer.plotting.snrplot.vectorize(img, mask)¶
Returns vectorized image based on brain mask, requires no input parameters If the input is 1D or 2D, unpatch it to 3D or 4D using a mask If the input is 3D or 4D, vectorize it using a mask Classification: Function
- Parameters
img (ndarray) – 1D, 2D, 3D or 4D image array to vectorize
mask (ndarray) – 3D image array for masking
- Returns
vec (N X number_of_voxels vector or array, where N is the number) – of DWI volumes
Usage
—–
vec = vectorize(img) if there’s no mask
vec = vectorize(img, mask) if there’s a mask