niquery.analysis.featuring module

niquery.analysis.featuring.extract_volume_features(files: dict, max_workers: int = 8) tuple[source]

Extract the number of volumes.

Extracts the number of volumes for all files runs in each dataset.

Parameters:
  • files (dict) – Dataset records.

  • max_workers (int, optional) – Maximum number of parallel threads to use.

Returns:

A dictionary of dataset records with the extracted BOLD features, and a list of failed dataset ID and file paths.

Return type:

tuple

niquery.analysis.featuring.get_nii_header_s3(bucket: str, filename: str) nibabel.nifti1.Nifti1Header[source]

Get the NIfTI header of the given file from the s3 bucket.

Parameters:
  • bucket (str) – S3 bucket.

  • filename (str) – NIfTI filename (e.g. ‘ds000149/sub-01/func/sub-01_task-picturemanualresponse_run-01_bold.nii.gz’)

Returns:

NIfTI file header.

Return type:

Nifti1Header

niquery.analysis.featuring.get_nii_header_url(url: str) nibabel.nifti1.Nifti1Header[source]

Get the NIfTI header of the file pointed by the given URL.

Parameters:

url (str) – URL where the file of interest is located.

Returns:

NIfTI file header.

Return type:

Nifti1Header

niquery.analysis.featuring.get_nii_timepoints_s3(bucket: str, filename: str) int[source]

Compute the number of timepoints of the provided NIfTI file.

Computes the number of timepoints as the size along the last dimension from the header of the response bitstream without actually downloading the entire contents if the server supports Range requests.

Parameters:
  • bucket (str) – S3 bucket.

  • filename (str) – NIfTI filename (e.g. ‘ds000149/sub-01/func/sub-01_task-picturemanualresponse_run-01_bold.nii.gz’)

Returns:

Number of timepoints.

Return type:

int

niquery.analysis.featuring.get_nii_timepoints_url(url: str) int[source]

Compute the number of timepoints of the file pointed by the given URL.

Computes the number of timepoints as the size along the last dimension from the header of the response bitstream without actually downloading the entire contents if the server supports Range requests.

Parameters:

url (str) – URL where the file of interest is located.

Returns:

Number of timepoints.

Return type:

int