9.1.4. Markers¶
Markers for feature extraction.
- class junifer.markers.ALFFParcels(parcellation, using, highpass=0.01, lowpass=0.1, tr=None, agg_method='mean', agg_method_params=None, masks=None, name=None)¶
Class for ALFF / fALFF on parcels.
- Parameters:
- parcellation
str
orlist
ofstr
The name(s) of the parcellation(s). Check valid options by calling
list_parcellations()
.- using{“junifer”, “afni”}
Implementation to use for computing ALFF:
“junifer” : Use
junifer
’s own ALFF implementation“afni” : Use AFNI’s
3dRSFC
- highpasspositive
float
, optional The highpass cutoff frequency for the bandpass filter. If 0, it will not apply a highpass filter (default 0.01).
- lowpasspositive
float
, optional The lowpass cutoff frequency for the bandpass filter (default 0.1).
- trpositive
float
, optional The Repetition Time of the BOLD data. If None, will extract the TR from NIfTI header (default None).
- agg_method
str
, optional The method to perform aggregation using. Check valid options in
get_aggfunc_by_name()
(default “mean”).- agg_method_params
dict
, optional Parameters to pass to the aggregation function. Check valid options in
get_aggfunc_by_name()
(default None).- masks
str
,dict
orlist
ofdict
orstr
, optional The specification of the masks to apply to regions before extracting signals. Check Using Masks for more details. If None, will not apply any mask (default None).
- name
str
, optional The name of the marker. If None, will use the class name (default None).
- parcellation
Notes
The
tr
parameter is crucial for the correctness of fALFF/ALFF computation. If a dataset is correctly preprocessed, thetr
should be extracted from the NIfTI without any issue. However, it has been reported that some preprocessed data might not have the correcttr
in the NIfTI header.ALFF/fALFF are computed using a bandpass butterworth filter. See
scipy.signal.butter()
andscipy.signal.filtfilt()
for more details.- compute(input, extra_input=None)¶
Compute.
- Parameters:
- Returns:
dict
The computed result as dictionary. This will be either returned to the user or stored in the storage by calling the store method with this as a parameter. The dictionary has the following keys:
alff
: dictionary with the following keys:data
: ROI values asnumpy.ndarray
col_names
: ROI labels as list of str
falff
: dictionary with the following keys:data
: ROI values asnumpy.ndarray
col_names
: ROI labels as list of str
- class junifer.markers.ALFFSpheres(coords, using, radius=None, allow_overlap=False, highpass=0.01, lowpass=0.1, tr=None, agg_method='mean', agg_method_params=None, masks=None, name=None)¶
Class for computing ALFF / fALFF on spheres.
- Parameters:
- coords
str
The name of the coordinates list to use. See
list_coordinates()
for options.- using{“junifer”, “afni”}
Implementation to use for computing ALFF:
“junifer” : Use
junifer
’s own ALFF implementation“afni” : Use AFNI’s
3dRSFC
- radius
float
, optional The radius of the sphere in mm. If None, the signal will be extracted from a single voxel. See
nilearn.maskers.NiftiSpheresMasker
for more information (default None).- allow_overlapbool, optional
Whether to allow overlapping spheres. If False, an error is raised if the spheres overlap (default is False).
- highpasspositive
float
, optional The highpass cutoff frequency for the bandpass filter. If 0, it will not apply a highpass filter (default 0.01).
- lowpasspositive
float
, optional The lowpass cutoff frequency for the bandpass filter (default 0.1).
- trpositive
float
, optional The Repetition Time of the BOLD data. If None, will extract the TR from NIfTI header (default None).
- agg_method
str
, optional The method to perform aggregation using. Check valid options in
get_aggfunc_by_name()
(default “mean”).- agg_method_params
dict
, optional Parameters to pass to the aggregation function. Check valid options in
get_aggfunc_by_name()
.- masks
str
,dict
orlist
ofdict
orstr
, optional The specification of the masks to apply to regions before extracting signals. Check Using Masks for more details. If None, will not apply any mask (default None).
- name
str
, optional The name of the marker. If None, will use the class name (default None).
- coords
Notes
The
tr
parameter is crucial for the correctness of fALFF/ALFF computation. If a dataset is correctly preprocessed, thetr
should be extracted from the NIfTI without any issue. However, it has been reported that some preprocessed data might not have the correcttr
in the NIFTI header.ALFF/fALFF are computed using a bandpass butterworth filter. See
scipy.signal.butter()
andscipy.signal.filtfilt()
for more details.- compute(input, extra_input=None)¶
Compute.
- Parameters:
- Returns:
dict
The computed result as dictionary. This will be either returned to the user or stored in the storage by calling the store method with this as a parameter. The dictionary has the following keys:
alff
: dictionary with the following keys:data
: ROI values asnumpy.ndarray
col_names
: ROI labels as list of str
falff
: dictionary with the following keys:data
: ROI values asnumpy.ndarray
col_names
: ROI labels as list of str
- class junifer.markers.BaseMarker(on=None, name=None)¶
Abstract base class for all markers.
For every interface that is required, one needs to provide a concrete implementation of this abstract class.
- Parameters:
- Raises:
AttributeError
If the marker does not have _MARKER_INOUT_MAPPINGS attribute.
ValueError
If required input data type(s) is(are) not found.
- abstract compute(input, extra_input=None)¶
Compute.
- Parameters:
- input
dict
A single input from the pipeline data object in which to compute the marker.
- extra_input
dict
, optional The other fields in the pipeline data object. Useful for accessing other data kind that needs to be used in the computation. For example, the functional connectivity markers can make use of the confounds if available (default None).
- input
- Returns:
dict
The computed result as dictionary. This will be either returned to the user or stored in the storage by calling the store method with this as a parameter.
- get_output_type(input_type, output_feature)¶
Get output type.
- get_valid_inputs()¶
Get valid data types for input.
- store(type_, feature, out, storage)¶
Store.
- validate_input(input)¶
Validate input.
- Parameters:
- Returns:
- Raises:
ValueError
If the input does not have the required data.
- class junifer.markers.BrainPrint(num=50, skip_cortex=False, keep_eigenvectors=False, norm='none', reweight=False, asymmetry=False, asymmetry_distance='euc', use_cholmod=False, name=None)¶
Class for BrainPrint.
- Parameters:
- numpositive
int
, optional Number of eigenvalues to compute (default 50).
- skip_cortexbool, optional
Whether to skip cortical surface or not (default False).
- keep_eigenvectorsbool, optional
Whether to also return eigenvectors or not (default False).
- norm
str
, optional Eigenvalues normalization method (default “none”).
- reweightbool, optional
Whether to reweight eigenvalues or not (default False).
- asymmetrybool, optional
Whether to calculate asymmetry between lateral structures (default False).
- asymmetry_distance{“euc”}, optional
Distance measurement to use if
asymmetry=True
:"euc"
: Euclidean
(default “euc”).
- use_cholmodbool, optional
If True, attempts to use the Cholesky decomposition for improved execution speed. Requires the
scikit-sparse
library. If it cannot be found, an error will be thrown. If False, will use slower LU decomposition (default False).- name
str
, optional The name of the marker. If None, will use the class name (default None).
- numpositive
- compute(input, extra_input=None)¶
Compute.
- Parameters:
- Returns:
dict
The computed result as dictionary. This will be either returned to the user or stored in the storage by calling the store method with this as a parameter. The dictionary has the following keys:
eigenvalues
: dictionary with the following keys:data
: eigenvalues asnp.ndarray
col_names
: surface labels as list of strrow_names
: eigenvalue count labels as list of strrow_header_col_name
“eigenvalue”()
areas
: dictionary with the following keys:data
: areas asnp.ndarray
col_names
: surface labels as list of str
volumes
: dictionary with the following keys:data
: volumes asnp.ndarray
col_names
: surface labels as list of str
distances
dictionary with the following keysif
asymmetry = True
:data
: distances asnp.ndarray
col_names
: surface labels as list of str
References
[1]Wachinger, C., Golland, P., Kremen, W. et al. (2015) BrainPrint: A discriminative characterization of brain morphology. NeuroImage, Volume 109, Pages 232-248. https://doi.org/10.1016/j.neuroimage.2015.01.032.
[2]Reuter, M., Wolter, F.E., Peinecke, N. (2006) Laplace-Beltrami spectra as ‘Shape-DNA’ of surfaces and solids. Computer-Aided Design, Volume 38, Issue 4, Pages 342-366. https://doi.org/10.1016/j.cad.2005.10.011.
- class junifer.markers.CrossParcellationFC(parcellation_one, parcellation_two, agg_method='mean', agg_method_params=None, corr_method='pearson', masks=None, name=None)¶
Class for calculating parcel-wise correlations with 2 parcellations.
- Parameters:
- parcellation_one
str
The name of the first parcellation.
- parcellation_two
str
The name of the second parcellation.
- agg_method
str
, optional The method to perform aggregation using. See
get_aggfunc_by_name()
for options (default “mean”).- agg_method_params
dict
, optional Parameters to pass to the aggregation function. See
get_aggfunc_by_name()
for options (default None).- corr_method
str
, optional Any method that can be passed to
pandas.DataFrame.corr()
(default “pearson”).- masks
str
,dict
orlist
ofdict
orstr
, optional The specification of the masks to apply to regions before extracting signals. Check Using Masks for more details. If None, will not apply any mask (default None).
- name
str
, optional The name of the marker. If None, will use
BOLD_CrossParcellationFC
(default None).
- parcellation_one
- compute(input, extra_input=None)¶
Compute.
Take a timeseries, parcellate them with two different parcellation schemes, and get parcel-wise correlations between the two different parcellated time series. Shape of output matrix corresponds to number of ROIs in (parcellation_two, parcellation_one).
- Parameters:
- Returns:
dict
The computed result as dictionary. This will be either returned to the user or stored in the storage by calling the store method with this as a parameter. The dictionary has the following keys:
functional_connectivity
: dictionary with the following keys:data
correlation between the two parcellations asnumpy.ndarray
col_names
ROI labels for first parcellation as list ofstr
row_names
ROI labels for second parcellation as list ofstr
- class junifer.markers.EdgeCentricFCParcels(parcellation, agg_method='mean', agg_method_params=None, conn_method='correlation', conn_method_params=None, masks=None, name=None)¶
Class for edge-centric FC using parcellations.
- Parameters:
- parcellation
str
orlist
ofstr
The name(s) of the parcellation(s) to use. See
list_parcellations()
for options.- agg_method
str
, optional The method to perform aggregation using. See
get_aggfunc_by_name()
for options (default “mean”).- agg_method_params
dict
, optional Parameters to pass to the aggregation function. See
get_aggfunc_by_name()
for options (default None).- conn_method
str
, optional The method to perform connectivity measure using. See
JuniferConnectivityMeasure
for options (default “correlation”).- conn_method_params
dict
, optional Parameters to pass to
JuniferConnectivityMeasure
. If None,{"empirical": True}
will be used, which would meansklearn.covariance.EmpiricalCovariance
is used to compute covariance. If usage ofsklearn.covariance.LedoitWolf
is desired,{"empirical": False}
should be passed (default None).- masks
str
,dict
orlist
ofdict
orstr
, optional The specification of the masks to apply to regions before extracting signals. Check Using Masks for more details. If None, will not apply any mask (default None).
- name
str
, optional The name of the marker. If None, will use
BOLD_EdgeCentricFCParcels
(default None).
- parcellation
References
[1]Jo et al. (2021) Subject identification using edge-centric functional connectivity. https://doi.org/10.1016/j.neuroimage.2021.118204
- aggregate(input, extra_input=None)¶
Perform parcel aggregation and ETS computation.
- Parameters:
- input
dict
A single input from the pipeline data object in which to compute the marker.
- extra_input
dict
, optional The other fields in the pipeline data object. Useful for accessing other data kind that needs to be used in the computation. For example, the functional connectivity markers can make use of the confounds if available (default None).
- input
- Returns:
dict
The computed result as dictionary. This will be either returned to the user or stored in the storage by calling the store method with this as a parameter. The dictionary has the following keys:
aggregation
: dictionary with the following keys:data
: ROI values asnumpy.ndarray
col_names
: ROI labels as list of str
- class junifer.markers.EdgeCentricFCSpheres(coords, radius=None, allow_overlap=False, agg_method='mean', agg_method_params=None, conn_method='correlation', conn_method_params=None, masks=None, name=None)¶
Class for edge-centric FC using coordinates (spheres).
- Parameters:
- coords
str
The name of the coordinates list to use. See
list_coordinates()
for options.- radiuspositive
float
, optional The radius of the sphere around each coordinates in millimetres. If None, the signal will be extracted from a single voxel. See
JuniferNiftiSpheresMasker
for more information (default None).- allow_overlapbool, optional
Whether to allow overlapping spheres. If False, an error is raised if the spheres overlap (default False).
- agg_method
str
, optional The method to perform aggregation using. See
get_aggfunc_by_name()
for options (default “mean”).- agg_method_params
dict
, optional Parameters to pass to the aggregation function. See
get_aggfunc_by_name()
for options (default None).- conn_method
str
, optional The method to perform connectivity measure using. See
JuniferConnectivityMeasure
for options (default “correlation”).- conn_method_params
dict
, optional Parameters to pass to
JuniferConnectivityMeasure
. If None,{"empirical": True}
will be used, which would meansklearn.covariance.EmpiricalCovariance
is used to compute covariance. If usage ofsklearn.covariance.LedoitWolf
is desired,{"empirical": False}
should be passed (default None).- masks
str
,dict
orlist
ofdict
orstr
, optional The specification of the masks to apply to regions before extracting signals. Check Using Masks for more details. If None, will not apply any mask (default None).
- name
str
, optional The name of the marker. If None, will use
BOLD_EdgeCentricFCSpheres
(default None).
- coords
References
[1]Jo et al. (2021) Subject identification using edge-centric functional connectivity. https://doi.org/10.1016/j.neuroimage.2021.118204
- aggregate(input, extra_input=None)¶
Perform sphere aggregation and ETS computation.
- Parameters:
- input
dict
A single input from the pipeline data object in which to compute the marker.
- extra_input
dict
, optional The other fields in the pipeline data object. Useful for accessing other data kind that needs to be used in the computation. For example, the functional connectivity markers can make use of the confounds if available (default None).
- input
- Returns:
dict
The computed result as dictionary. This will be either returned to the user or stored in the storage by calling the store method with this as a parameter. The dictionary has the following keys:
aggregation
: dictionary with the following keys:data
: ROI values asnumpy.ndarray
col_names
: ROI labels as list of str
- class junifer.markers.FunctionalConnectivityParcels(parcellation, agg_method='mean', agg_method_params=None, conn_method='correlation', conn_method_params=None, masks=None, name=None)¶
Class for functional connectivity using parcellations.
- Parameters:
- parcellation
str
orlist
ofstr
The name(s) of the parcellation(s) to use. See
list_parcellations()
for options.- agg_method
str
, optional The method to perform aggregation using. See
get_aggfunc_by_name()
for options (default “mean”).- agg_method_params
dict
, optional Parameters to pass to the aggregation function. See
get_aggfunc_by_name()
for options (default None).- conn_method
str
, optional The method to perform connectivity measure using. See
JuniferConnectivityMeasure
for options (default “correlation”).- conn_method_params
dict
, optional Parameters to pass to
JuniferConnectivityMeasure
. If None,{"empirical": True}
will be used, which would meansklearn.covariance.EmpiricalCovariance
is used to compute covariance. If usage ofsklearn.covariance.LedoitWolf
is desired,{"empirical": False}
should be passed (default None).- masks
str
,dict
orlist
ofdict
orstr
, optional The specification of the masks to apply to regions before extracting signals. Check Using Masks for more details. If None, will not apply any mask (default None).
- name
str
, optional The name of the marker. If None, will use
BOLD_FunctionalConnectivityParcels
(default None).
- parcellation
- aggregate(input, extra_input=None)¶
Perform parcel aggregation.
- Parameters:
- input
dict
A single input from the pipeline data object in which to compute the marker.
- extra_input
dict
, optional The other fields in the pipeline data object. Useful for accessing other data kind that needs to be used in the computation. For example, the functional connectivity markers can make use of the confounds if available (default None).
- input
- Returns:
dict
The computed result as dictionary. This will be either returned to the user or stored in the storage by calling the store method with this as a parameter. The dictionary has the following keys:
aggregation
: dictionary with the following keys:data
: ROI values asnumpy.ndarray
col_names
: ROI labels as list of str
- class junifer.markers.FunctionalConnectivitySpheres(coords, radius=None, allow_overlap=False, agg_method='mean', agg_method_params=None, conn_method='correlation', conn_method_params=None, masks=None, name=None)¶
Class for functional connectivity using coordinates (spheres).
- Parameters:
- coords
str
The name of the coordinates list to use. See
list_coordinates()
for options.- radiuspositive
float
, optional The radius of the sphere around each coordinates in millimetres. If None, the signal will be extracted from a single voxel. See
JuniferNiftiSpheresMasker
for more information (default None).- allow_overlapbool, optional
Whether to allow overlapping spheres. If False, an error is raised if the spheres overlap (default False).
- agg_method
str
, optional The method to perform aggregation using. See
get_aggfunc_by_name()
for options (default “mean”).- agg_method_params
dict
, optional Parameters to pass to the aggregation function. See
get_aggfunc_by_name()
for options (default None).- conn_method
str
, optional The method to perform connectivity measure using. See
JuniferConnectivityMeasure
for options (default “correlation”).- conn_method_params
dict
, optional Parameters to pass to
JuniferConnectivityMeasure
. If None,{"empirical": True}
will be used, which would meansklearn.covariance.EmpiricalCovariance
is used to compute covariance. If usage ofsklearn.covariance.LedoitWolf
is desired,{"empirical": False}
should be passed (default None).- masks
str
,dict
orlist
ofdict
orstr
, optional The specification of the masks to apply to regions before extracting signals. Check Using Masks for more details. If None, will not apply any mask (default None).
- name
str
, optional The name of the marker. If None, will use
BOLD_FunctionalConnectivitySpheres
(default None).
- coords
- aggregate(input, extra_input=None)¶
Perform sphere aggregation.
- Parameters:
- input
dict
A single input from the pipeline data object in which to compute the marker.
- extra_input
dict
, optional The other fields in the pipeline data object. Useful for accessing other data kind that needs to be used in the computation. For example, the functional connectivity markers can make use of the confounds if available (default None).
- input
- Returns:
dict
The computed result as dictionary. This will be either returned to the user or stored in the storage by calling the store method with this as a parameter. The dictionary has the following keys:
aggregation
: dictionary with the following keys:data
: ROI values asnumpy.ndarray
col_names
: ROI labels as list of str
- class junifer.markers.MarkerCollection(markers, datareader=None, preprocessors=None, storage=None)¶
Class for marker collection.
- Parameters:
- Raises:
ValueError
If
markers
have same names.
- fit(input)¶
Fit the pipeline.
- Parameters:
- input
dict
The input data to fit the pipeline on. Should be the output of indexing the Data Grabber with one element.
- input
- Returns:
- validate(datagrabber)¶
Validate the pipeline.
Without doing any computation, check if the marker collection can be fitted without problems i.e., the data required for each marker is present and streamed down the steps. Also, if a storage is configured, check that the storage can handle the markers’ output.
- Parameters:
- datagrabberDataGrabber-like
The DataGrabber to validate.
- class junifer.markers.ParcelAggregation(parcellation, method, method_params=None, time_method=None, time_method_params=None, masks=None, on=None, name=None)¶
Class for parcel aggregation.
- Parameters:
- parcellation
str
orlist
ofstr
The name(s) of the parcellation(s). Check valid options by calling
list_parcellations()
.- method
str
The method to perform aggregation using. Check valid options in
get_aggfunc_by_name()
.- method_params
dict
, optional Parameters to pass to the aggregation function. Check valid options in
get_aggfunc_by_name()
.- time_method
str
, optional The method to use to aggregate the time series over the time points, after applying method (only applicable to BOLD data). If None, it will not operate on the time dimension (default None).
- time_method_params
dict
, optional The parameters to pass to the time aggregation method (default None).
- masks
str
,dict
orlist
ofdict
orstr
, optional The specification of the masks to apply to regions before extracting signals. Check Using Masks for more details. If None, will not apply any mask (default None).
- on{“T1w”, “T2w”, “BOLD”, “VBM_GM”, “VBM_WM”, “VBM_CSF”, “fALFF”, “GCOR”, “LCOR”} or
list
of the options, optional The data types to apply the marker to. If None, will work on all available data (default None).
- name
str
, optional The name of the marker. If None, will use the class name (default None).
- parcellation
- Raises:
ValueError
If
time_method
is specified for non-BOLD data or iftime_method_params
is not None whentime_method
is None.
- compute(input, extra_input=None)¶
Compute.
- Parameters:
- input
dict
A single input from the pipeline data object in which to compute the marker.
- extra_input
dict
, optional The other fields in the pipeline data object. Useful for accessing other data kind that needs to be used in the computation. For example, the functional connectivity markers can make use of the confounds if available (default None).
- input
- Returns:
dict
The computed result as dictionary. This will be either returned to the user or stored in the storage by calling the store method with this as a parameter. The dictionary has the following keys:
aggregation
: dictionary with the following keys:data
: ROI values asnumpy.ndarray
col_names
: ROI labels as list of str
- Warns:
RuntimeWarning
If time aggregation is required but only time point is available.
- class junifer.markers.RSSETSMarker(parcellation, agg_method='mean', agg_method_params=None, masks=None, name=None)¶
Class for root sum of squares of edgewise timeseries.
- Parameters:
- parcellation
str
orlist
ofstr
The name(s) of the parcellation(s). Check valid options by calling
list_parcellations()
.- agg_method
str
, optional The method to perform aggregation using. Check valid options in
get_aggfunc_by_name()
(default “mean”).- agg_method_params
dict
, optional Parameters to pass to the aggregation function. Check valid options in
get_aggfunc_by_name()
(default None).- masks
str
,dict
orlist
ofdict
orstr
, optional The specification of the masks to apply to regions before extracting signals. Check Using Masks for more details. If None, will not apply any mask (default None).
- name
str
, optional The name of the marker. If None, will use the class name (default None).
- parcellation
- compute(input, extra_input=None)¶
Compute.
Take a timeseries of brain areas, and calculate timeseries for each edge according to the method outlined in [1]. For more information, check https://github.com/brain-networks/edge-ts/blob/master/main.m
- Parameters:
- Returns:
dict
The computed result as dictionary. This will be either returned to the user or stored in the storage by calling the store method with this as a parameter. The dictionary has the following keys:
data
: the actual computed values as a numpy.ndarraycol_names
: the column labels for the computed values as list
References
[1]Zamani Esfahlani et al. (2020) High-amplitude cofluctuations in cortical activity drive functional connectivity doi: 10.1073/pnas.2005531117
- class junifer.markers.ReHoParcels(parcellation, using, reho_params=None, agg_method='mean', agg_method_params=None, masks=None, name=None)¶
Class for regional homogeneity on parcels.
- Parameters:
- parcellation
str
orlist
ofstr
The name(s) of the parcellation(s). Check valid options by calling
list_parcellations()
.- using{“junifer”, “afni”}
Implementation to use for computing ReHo:
“junifer” : Use
junifer
’s own ReHo implementation“afni” : Use AFNI’s
3dReHo
- reho_params
dict
, optional Extra parameters for computing ReHo map as a dictionary (default None). If
using="afni"
, then the valid keys are:nneigh
{7, 19, 27}, optional (default 27)Number of voxels in the neighbourhood, inclusive. Can be:
7 : for facewise neighbours only
19 : for face- and edge-wise neighbours
27 : for face-, edge-, and node-wise neighbors
neigh_rad
positive float, optionalThe radius of a desired neighbourhood (default None).
neigh_x
positive float, optionalThe semi-radius for x-axis of ellipsoidal volumes (default None).
neigh_y
positive float, optionalThe semi-radius for y-axis of ellipsoidal volumes (default None).
neigh_z
positive float, optionalThe semi-radius for z-axis of ellipsoidal volumes (default None).
box_rad
positive int, optionalThe number of voxels outward in a given cardinal direction for a cubic box centered on a given voxel (default None).
box_x
positive int, optionalThe number of voxels for +/- x-axis of cuboidal volumes (default None).
box_y
positive int, optionalThe number of voxels for +/- y-axis of cuboidal volumes (default None).
box_z
positive int, optionalThe number of voxels for +/- z-axis of cuboidal volumes (default None).
else if
using="junifer"
, then the valid keys are:nneigh
{7, 19, 27, 125}, optional (default 27)Number of voxels in the neighbourhood, inclusive. Can be:
7 : for facewise neighbours only
19 : for face- and edge-wise neighbours
27 : for face-, edge-, and node-wise neighbors
125 : for 5x5 cuboidal volume
- agg_method
str
, optional The method to perform aggregation using. Check valid options in
get_aggfunc_by_name()
(default “mean”).- agg_method_params
dict
, optional Parameters to pass to the aggregation function. Check valid options in
get_aggfunc_by_name()
(default None).- masks
str
,dict
orlist
ofdict
orstr
, optional The specification of the masks to apply to regions before extracting signals. Check Using Masks for more details. If None, will not apply any mask (default None).
- name
str
, optional The name of the marker. If None, it will use the class name (default None).
- parcellation
- compute(input, extra_input=None)¶
Compute.
- Parameters:
- Returns:
dict
The computed result as dictionary. This will be either returned to the user or stored in the storage by calling the store method with this as a parameter. The dictionary has the following keys:
reho
: dictionary with the following keys:data
: ROI values asnumpy.ndarray
col_names
: ROI labels as list of str
- class junifer.markers.ReHoSpheres(coords, using, radius=None, allow_overlap=False, reho_params=None, agg_method='mean', agg_method_params=None, masks=None, name=None)¶
Class for regional homogeneity on spheres.
- Parameters:
- coords
str
The name of the coordinates list to use. See
list_coordinates()
for options.- using{“junifer”, “afni”}
Implementation to use for computing ReHo:
“junifer” : Use
junifer
’s own ReHo implementation“afni” : Use AFNI’s
3dReHo
- radius
float
, optional The radius of the sphere in millimeters. If None, the signal will be extracted from a single voxel. See
nilearn.maskers.NiftiSpheresMasker
for more information (default None).- allow_overlapbool, optional
Whether to allow overlapping spheres. If False, an error is raised if the spheres overlap (default is False).
- use_afnibool, optional
Whether to use AFNI for computing. If None, will use AFNI only if available (default None).
- reho_params
dict
, optional Extra parameters for computing ReHo map as a dictionary (default None). If
using="afni"
, then the valid keys are:nneigh
{7, 19, 27}, optional (default 27)Number of voxels in the neighbourhood, inclusive. Can be:
7 : for facewise neighbours only
19 : for face- and edge-wise neighbours
27 : for face-, edge-, and node-wise neighbors
neigh_rad
positive float, optionalThe radius of a desired neighbourhood (default None).
neigh_x
positive float, optionalThe semi-radius for x-axis of ellipsoidal volumes (default None).
neigh_y
positive float, optionalThe semi-radius for y-axis of ellipsoidal volumes (default None).
neigh_z
positive float, optionalThe semi-radius for z-axis of ellipsoidal volumes (default None).
box_rad
positive int, optionalThe number of voxels outward in a given cardinal direction for a cubic box centered on a given voxel (default None).
box_x
positive int, optionalThe number of voxels for +/- x-axis of cuboidal volumes (default None).
box_y
positive int, optionalThe number of voxels for +/- y-axis of cuboidal volumes (default None).
box_z
positive int, optionalThe number of voxels for +/- z-axis of cuboidal volumes (default None).
else if
using="junifer"
, then the valid keys are:nneigh
{7, 19, 27, 125}, optional (default 27)Number of voxels in the neighbourhood, inclusive. Can be:
7 : for facewise neighbours only
19 : for face- and edge-wise neighbours
27 : for face-, edge-, and node-wise neighbors
125 : for 5x5 cuboidal volume
- agg_method
str
, optional The aggregation method to use. See
get_aggfunc_by_name()
for more information (default None).- agg_method_params
dict
, optional The parameters to pass to the aggregation method (default None).
- masks
str
,dict
orlist
ofdict
orstr
, optional The specification of the masks to apply to regions before extracting signals. Check Using Masks for more details. If None, will not apply any mask (default None).
- name
str
, optional The name of the marker. If None, it will use the class name (default None).
- coords
- compute(input, extra_input=None)¶
Compute.
- Parameters:
- Returns:
dict
The computed result as dictionary. This will be either returned to the user or stored in the storage by calling the store method with this as a parameter. The dictionary has the following keys:
reho
: dictionary with the following keys:data
: ROI values asnumpy.ndarray
col_names
: ROI labels as list of str
- class junifer.markers.SphereAggregation(coords, radius=None, allow_overlap=False, method='mean', method_params=None, time_method=None, time_method_params=None, masks=None, on=None, name=None)¶
Class for sphere aggregation.
- Parameters:
- coords
str
The name of the coordinates list to use. See
list_coordinates()
for options.- radius
float
, optional The radius of the sphere in millimeters. If None, the signal will be extracted from a single voxel. See
nilearn.maskers.NiftiSpheresMasker
for more information (default None).- allow_overlapbool, optional
Whether to allow overlapping spheres. If False, an error is raised if the spheres overlap (default is False).
- method
str
, optional The aggregation method to use. See
get_aggfunc_by_name()
for more information (default “mean”).- method_params
dict
, optional The parameters to pass to the aggregation method (default None).
- time_method
str
, optional The method to use to aggregate the time series over the time points, after applying method (only applicable to BOLD data). If None, it will not operate on the time dimension (default None).
- time_method_params
dict
, optional The parameters to pass to the time aggregation method (default None).
- masks
str
,dict
orlist
ofdict
orstr
, optional The specification of the masks to apply to regions before extracting signals. Check Using Masks for more details. If None, will not apply any mask (default None).
- on{“T1w”, “T2w”, “BOLD”, “VBM_GM”, “VBM_WM”, “VBM_CSF”, “fALFF”, “GCOR”, “LCOR”} or
list
of the options, optional The data types to apply the marker to. If None, will work on all available data (default None).
- name
str
, optional The name of the marker. By default, it will use KIND_SphereAggregation where KIND is the kind of data it was applied to (default None).
- coords
- Raises:
ValueError
If
time_method
is specified for non-BOLD data or iftime_method_params
is not None whentime_method
is None.
- compute(input, extra_input=None)¶
Compute.
- Parameters:
- input
dict
A single input from the pipeline data object in which to compute the marker.
- extra_input
dict
, optional The other fields in the pipeline data object. Useful for accessing other data kind that needs to be used in the computation. For example, the functional connectivity markers can make use of the confounds if available (default None).
- input
- Returns:
dict
The computed result as dictionary. This will be either returned to the user or stored in the storage by calling the store method with this as a parameter. The dictionary has the following keys:
aggregation
: dictionary with the following keys:data
: ROI values asnumpy.ndarray
col_names
: ROI labels as list of str
- Warns:
RuntimeWarning
If time aggregation is required but only time point is available.
- class junifer.markers.TemporalSNRParcels(parcellation, agg_method='mean', agg_method_params=None, masks=None, name=None)¶
Class for temporal signal-to-noise ratio using parcellations.
- Parameters:
- parcellation
str
orlist
ofstr
The name(s) of the parcellation(s). Check valid options by calling
list_parcellations()
.- agg_method
str
, optional The method to perform aggregation using. Check valid options in
get_aggfunc_by_name()
(default “mean”).- agg_method_params
dict
, optional Parameters to pass to the aggregation function. Check valid options in
get_aggfunc_by_name()
(default None).- masks
str
,dict
orlist
ofdict
orstr
, optional The specification of the masks to apply to regions before extracting signals. Check Using Masks for more details. If None, will not apply any mask (default None).
- name
str
, optional The name of the marker. If None, will use the class name (default None).
- parcellation
- aggregate(input, extra_input=None)¶
Perform parcel aggregation.
- Parameters:
- input
dict
A single input from the pipeline data object in which the data is the voxelwise temporal SNR map.
- extra_input
dict
, optional The other fields in the pipeline data object. Useful for accessing other data kind that needs to be used in the computation. For example, the functional connectivity markers can make use of the confounds if available (default None).
- input
- Returns:
dict
The computed result as dictionary. This will be either returned to the user or stored in the storage by calling the store method with this as a parameter. The dictionary has the following keys:
aggregation
: dictionary with the following keys:data
: ROI-wise tSNR values asnumpy.ndarray
col_names
: ROI labels as list of str
- class junifer.markers.TemporalSNRSpheres(coords, radius=None, allow_overlap=False, agg_method='mean', agg_method_params=None, masks=None, name=None)¶
Class for temporal signal-to-noise ratio using coordinates (spheres).
- Parameters:
- coords
str
The name of the coordinates list to use. See
list_coordinates()
for options.- radius
float
, optional The radius of the sphere in mm. If None, the signal will be extracted from a single voxel. See
nilearn.maskers.NiftiSpheresMasker
for more information (default None).- allow_overlapbool, optional
Whether to allow overlapping spheres. If False, an error is raised if the spheres overlap (default is False).
- agg_method
str
, optional The aggregation method to use. See
get_aggfunc_by_name()
for more information (default None).- agg_method_params
dict
, optional The parameters to pass to the aggregation method (default None).
- masks
str
,dict
orlist
ofdict
orstr
, optional The specification of the masks to apply to regions before extracting signals. Check Using Masks for more details. If None, will not apply any mask (default None).
- name
str
, optional The name of the marker. By default, it will use KIND_FunctionalConnectivitySpheres where KIND is the kind of data it was applied to (default None).
- coords
- aggregate(input, extra_input=None)¶
Perform sphere aggregation.
- Parameters:
- input
dict
A single input from the pipeline data object in which the data is the voxelwise temporal SNR map.
- extra_input
dict
, optional The other fields in the pipeline data object. Useful for accessing other data kind that needs to be used in the computation. For example, the functional connectivity markers can make use of the confounds if available (default None).
- input
- Returns:
dict
The computed result as dictionary. This will be either returned to the user or stored in the storage by calling the store method with this as a parameter. The dictionary has the following keys:
aggregation
: dictionary with the following keys:data
: ROI-wise tSNR values asnumpy.ndarray
col_names
: ROI labels as list of str
Complexity¶
Provide imports for complexity sub-package.
- class junifer.markers.complexity.HurstExponent(parcellation, agg_method='mean', agg_method_params=None, masks=None, params=None, name=None)¶
Class for Hurst exponent of a time series.
- Parameters:
- parcellation
str
orlist
ofstr
The name(s) of the parcellation(s). Check valid options by calling
junifer.data.parcellations.list_parcellations()
.- agg_method
str
, optional The method to perform aggregation using. Check valid options in
junifer.stats.get_aggfunc_by_name()
(default “mean”).- agg_method_params
dict
, optional Parameters to pass to the aggregation function. Check valid options in
junifer.stats.get_aggfunc_by_name()
(default None).- masks
str
,dict
orlist
ofdict
orstr
, optional The specification of the masks to apply to regions before extracting signals. Check Using Masks for more details. If None, will not apply any mask (default None).
- params
dict
, optional Parameters to pass to the Hurst exponent calculation function. For more information, check out
junifer.markers.utils._hurst_exponent
. If None, value is set to {“method”: “dfa”} (default None).- name
str
, optional The name of the marker. If None, it will use the class name (default None).
- parcellation
Warning
This class is not automatically imported by junifer and requires you to import it explicitly. You can do it programmatically by
from junifer.markers.complexity import HurstExponent
or in the YAML bywith: junifer.markers.complexity
.- compute_complexity(extracted_bold_values)¶
Compute complexity measure.
Take a timeseries of brain areas, and calculate Hurst exponent using the detrended fluctuation analysis method assuming the data is monofractal [1].
- Parameters:
- extracted_bold_values
numpy.ndarray
The BOLD values extracted via parcel aggregation.
- extracted_bold_values
- Returns:
numpy.ndarray
The values after computing complexity measure.
See also
neurokit2.fractal_dfa
References
[1]Peng, C.; Havlin, S.; Stanley, H.E.; Goldberger, A.L. Quantification of scaling exponents and crossover phenomena in nonstationary heartbeat time series. Chaos Interdiscip. J. Nonlinear Sci., 5, 82-87, 1995.
- class junifer.markers.complexity.MultiscaleEntropyAUC(parcellation, agg_method='mean', agg_method_params=None, masks=None, params=None, name=None)¶
Class for AUC of multiscale entropy of a time series.
- Parameters:
- parcellation
str
orlist
ofstr
The name(s) of the parcellation(s). Check valid options by calling
junifer.data.parcellations.list_parcellations()
.- agg_method
str
, optional The method to perform aggregation using. Check valid options in
junifer.stats.get_aggfunc_by_name()
(default “mean”).- agg_method_params
dict
, optional Parameters to pass to the aggregation function. Check valid options in
junifer.stats.get_aggfunc_by_name()
(default None).- masks
str
,dict
orlist
ofdict
orstr
, optional The specification of the masks to apply to regions before extracting signals. Check Using Masks for more details. If None, will not apply any mask (default None).
- params
dict
, optional Parameters to pass to the AUC of multiscale entropy calculation function. For more information, check out
junifer.markers.utils._multiscale_entropy_auc
. If None, value is set to {“m”: 2, “tol”: 0.5, “scale”: 10} (default None).- name
str
, optional The name of the marker. If None, it will use the class name (default None).
- parcellation
Warning
This class is not automatically imported by junifer and requires you to import it explicitly. You can do it programmatically by
from junifer.markers.complexity import MultiscaleEntropyAUC
or in the YAML bywith: junifer.markers.complexity
.- compute_complexity(extracted_bold_values)¶
Compute complexity measure.
Take a timeseries of brain areas, calculate multiscale entropy for each region and calculate the AUC of the entropy curves leading to a region-wise map of the brain [1].
- Parameters:
- extracted_bold_values
numpy.ndarray
The BOLD values extracted via parcel aggregation.
- extracted_bold_values
- Returns:
numpy.ndarray
The values after computing complexity measure.
See also
neurokit2.entropy_multiscale
References
[1]Costa, M., Goldberger, A. L., & Peng, C. K. Multiscale entropy analysis of complex physiologic time series. Physical review letters, 89(6), 068102, 2002.
- class junifer.markers.complexity.PermEntropy(parcellation, agg_method='mean', agg_method_params=None, masks=None, params=None, name=None)¶
Class for permutation entropy of a time series.
- Parameters:
- parcellation
str
orlist
ofstr
The name(s) of the parcellation(s). Check valid options by calling
junifer.data.parcellations.list_parcellations()
.- agg_method
str
, optional The method to perform aggregation using. Check valid options in
junifer.stats.get_aggfunc_by_name()
(default “mean”).- agg_method_params
dict
, optional Parameters to pass to the aggregation function. Check valid options in
junifer.stats.get_aggfunc_by_name()
(default None).- masks
str
,dict
orlist
ofdict
orstr
, optional The specification of the masks to apply to regions before extracting signals. Check Using Masks for more details. If None, will not apply any mask (default None).
- params
dict
, optional Parameters to pass to the permutation entropy calculation function. For more information, check out
junifer.markers.utils._perm_entropy
. If None, value is set to {“m”: 2, “delay”: 1} (default None).- name
str
, optional The name of the marker. If None, it will use the class name (default None).
- parcellation
Warning
This class is not automatically imported by junifer and requires you to import it explicitly. You can do it programmatically by
from junifer.markers.complexity import PermEntropy
or in the YAML bywith: junifer.markers.complexity
.- compute_complexity(extracted_bold_values)¶
Compute complexity measure.
Take a timeseries of brain areas, and calculate permutation entropy according to the method outlined in [1].
- Parameters:
- extracted_bold_values
numpy.ndarray
The BOLD values extracted via parcel aggregation.
- extracted_bold_values
- Returns:
numpy.ndarray
The values after computing complexity measure.
See also
neurokit2.entropy_permutation
References
[1]Bandt, C., & Pompe, B. (2002) Permutation entropy: a natural complexity measure for time series. Physical review letters, 88(17), 174102.
- class junifer.markers.complexity.RangeEntropy(parcellation, agg_method='mean', agg_method_params=None, masks=None, params=None, name=None)¶
Class for range entropy of a time series.
- Parameters:
- parcellation
str
orlist
ofstr
The name(s) of the parcellation(s). Check valid options by calling
junifer.data.parcellations.list_parcellations()
.- agg_method
str
, optional The method to perform aggregation using. Check valid options in
junifer.stats.get_aggfunc_by_name()
(default “mean”).- agg_method_params
dict
, optional Parameters to pass to the aggregation function. Check valid options in
junifer.stats.get_aggfunc_by_name()
(default None).- masks
str
,dict
orlist
ofdict
orstr
, optional The specification of the masks to apply to regions before extracting signals. Check Using Masks for more details. If None, will not apply any mask (default None).
- params
dict
, optional Parameters to pass to the range entropy calculation function. For more information, check out
junifer.markers.utils._range_entropy
. If None, value is set to {“m”: 2, “tol”: 0.5, “delay”: 1} (default None).- name
str
, optional The name of the marker. If None, it will use the class name (default None).
- parcellation
Warning
This class is not automatically imported by junifer and requires you to import it explicitly. You can do it programmatically by
from junifer.markers.complexity import RangeEntropy
or in the YAML bywith: junifer.markers.complexity
.- compute_complexity(extracted_bold_values)¶
Compute complexity measure.
Take a timeseries of brain areas, and calculate range entropy according to the method outlined in [1].
- Parameters:
- extracted_bold_values
numpy.ndarray
The BOLD values extracted via parcel aggregation.
- extracted_bold_values
- Returns:
numpy.ndarray
The values after computing complexity measure.
See also
neurokit2.entropy_range
References
[1]A. Omidvarnia et al. (2018) Range Entropy: A Bridge between Signal Complexity and Self-Similarity. Entropy, vol. 20, no. 12, p. 962, 2018.
- class junifer.markers.complexity.RangeEntropyAUC(parcellation, agg_method='mean', agg_method_params=None, masks=None, params=None, name=None)¶
Class for AUC of range entropy values of a time series over r = 0 to 1.
- Parameters:
- parcellation
str
orlist
ofstr
The name(s) of the parcellation(s). Check valid options by calling
junifer.data.parcellations.list_parcellations()
.- agg_method
str
, optional The method to perform aggregation using. Check valid options in
junifer.stats.get_aggfunc_by_name()
(default “mean”).- agg_method_params
dict
, optional Parameters to pass to the aggregation function. Check valid options in
junifer.stats.get_aggfunc_by_name()
(default None).- masks
str
,dict
orlist
ofdict
orstr
, optional The specification of the masks to apply to regions before extracting signals. Check Using Masks for more details. If None, will not apply any mask (default None).
- params
dict
, optional Parameters to pass to the range entropy calculation function. For more information, check out
junifer.markers.utils._range_entropy
. If None, value is set to {“m”: 2, “delay”: 1, “n_r”: 10} (default None).- name
str
, optional The name of the marker. If None, it will use the class name (default None).
- parcellation
Warning
This class is not automatically imported by junifer and requires you to import it explicitly. You can do it programmatically by
from junifer.markers.complexity import RangeEntropyAUC
or in the YAML bywith: junifer.markers.complexity
.- compute_complexity(extracted_bold_values)¶
Compute complexity measure.
Take a timeseries of brain areas, calculate range entropy according to the method outlined in [1] across the range of tolerance value r from 0 to 1, and compute its area under the curve.
- Parameters:
- extracted_bold_values
numpy.ndarray
The BOLD values extracted via parcel aggregation.
- extracted_bold_values
- Returns:
numpy.ndarray
The values after computing complexity measure.
See also
neurokit2.entropy_range
References
[1]A. Omidvarnia et al. (2018) Range Entropy: A Bridge between Signal Complexity and Self-Similarity. Entropy, vol. 20, no. 12, p. 962, 2018.
- class junifer.markers.complexity.SampleEntropy(parcellation, agg_method='mean', agg_method_params=None, masks=None, params=None, name=None)¶
Class for sample entropy of a time series.
- Parameters:
- parcellation
str
orlist
ofstr
The name(s) of the parcellation(s). Check valid options by calling
junifer.data.parcellations.list_parcellations()
.- agg_method
str
, optional The method to perform aggregation using. Check valid options in
junifer.stats.get_aggfunc_by_name()
(default “mean”).- agg_method_params
dict
, optional Parameters to pass to the aggregation function. Check valid options in
junifer.stats.get_aggfunc_by_name()
(default None).- masks
str
,dict
orlist
ofdict
orstr
, optional The specification of the masks to apply to regions before extracting signals. Check Using Masks for more details. If None, will not apply any mask (default None).
- params
dict
, optional Parameters to pass to the sample entropy calculation function. For more information, check out
junifer.markers.utils._sample_entropy
. If None, value is set to {“m”: 2, “delay”: 1, “tol”: 0.5} (default None).- name
str
, optional The name of the marker. If None, it will use the class name (default None).
- parcellation
Warning
This class is not automatically imported by junifer and requires you to import it explicitly. You can do it programmatically by
from junifer.markers.complexity import SampleEntropy
or in the YAML bywith: junifer.markers.complexity
.- compute_complexity(extracted_bold_values)¶
Compute complexity measure.
Take a timeseries of brain areas, and calculate sample entropy [1].
- Parameters:
- extracted_bold_values
numpy.ndarray
The BOLD values extracted via parcel aggregation.
- extracted_bold_values
- Returns:
numpy.ndarray
The values after computing complexity measure.
See also
neurokit2.entropy_sample
References
[1]Richman, J., Moorman, J. Physiological time-series analysis using approximate entropy and sample entropy. Am. J. Physiol. Heart Circ. Physiol., 278 (6) (2000), pp. H2039-2049
- class junifer.markers.complexity.WeightedPermEntropy(parcellation, agg_method='mean', agg_method_params=None, masks=None, params=None, name=None)¶
Class for weighted permutation entropy of a time series.
- Parameters:
- parcellation
str
orlist
ofstr
The name(s) of the parcellation(s). Check valid options by calling
junifer.data.parcellations.list_parcellations()
.- agg_method
str
, optional The method to perform aggregation using. Check valid options in
junifer.stats.get_aggfunc_by_name()
(default “mean”).- agg_method_params
dict
, optional Parameters to pass to the aggregation function. Check valid options in
junifer.stats.get_aggfunc_by_name()
(default None).- masks
str
,dict
orlist
ofdict
orstr
, optional The specification of the masks to apply to regions before extracting signals. Check Using Masks for more details. If None, will not apply any mask (default None).
- params
dict
, optional Parameters to pass to the weighted permutation entropy calculation function. For more information, check out
junifer.markers.utils._weighted_perm_entropy
. If None, value is set to {“m”: 2, “delay”: 1} (default None).- name
str
, optional The name of the marker. If None, it will use the class name (default None).
- parcellation
Warning
This class is not automatically imported by junifer and requires you to import it explicitly. You can do it programmatically by
from junifer.markers.complexity import WeightedPermEntropy
or in the YAML bywith: junifer.markers.complexity
.- compute_complexity(extracted_bold_values)¶
Compute complexity measure.
Take a timeseries of brain areas, and calculate weighted permutation entropy according to the method outlined in [1].
- Parameters:
- extracted_bold_values
numpy.ndarray
The BOLD values extracted via parcel aggregation.
- extracted_bold_values
- Returns:
numpy.ndarray
The values after computing complexity measure.
See also
neurokit2.entropy_permutation
References
[1]Fadlallah, B., Chen, B., Keil, A., & Principe, J. (2013) Weighted-permutation entropy: A complexity measure for time series incorporating amplitude information. Physical Review E, 87(2), 022911.