qsirecon.interfaces.bids module
Interfaces for handling BIDS-like neuroimaging structures
Fetch some example data:
>>> import os
>>> from niworkflows import data
>>> data_root = data.get_bids_examples(variant='BIDS-examples-1-enh-ds054')
>>> os.chdir(data_root)
Disable warnings:
>>> from nipype import logging
>>> logging.getLogger('nipype.interface').setLevel('ERROR')
- class qsirecon.interfaces.bids.CopyAtlas(from_file=None, resource_monitor=None, **inputs)[source]
Bases:
SimpleInterfaceCopy atlas file to output directory.
- Parameters:
- Returns:
out_file – The path to the copied atlas file.
- Return type:
Notes
I can’t use DerivativesDataSink because it has a problem with dlabel CIFTI files. It gives the following error: “AttributeError: ‘Cifti2Header’ object has no attribute ‘set_data_dtype’”
I can’t override the CIFTI atlas’s data dtype ahead of time because setting it to int8 or int16 somehow converts all of the values in the data array to weird floats. This could be a version-specific nibabel issue.
I’ve also updated this function to handle JSON and TSV files as well.
- Mandatory Inputs:
atlas (a string) – The atlas name.
in_file (a pathlike object or string representing an existing file) – The atlas file to copy.
out_dir (a pathlike object or string representing an existing directory) – The output directory.
- Optional Inputs:
Sources (a list of items which are a string) – List of sources for the atlas.
meta_dict (a dictionary with keys which are any value and with values which are any value or None) – The atlas metadata dictionary.
source_file (a string) – The source file’s name.
- Outputs:
out_file (a pathlike object or string representing an existing file) – The copied atlas file.
- class qsirecon.interfaces.bids.DerivativesDataSink(allowed_entities=None, out_path_base=None, **inputs)[source]
Bases:
DerivativesDataSinkStore derivative files.
A child class of the niworkflows DerivativesDataSink, using QSIRecon’s configuration files.
- Mandatory Inputs:
in_file (a list of items which are a pathlike object or string representing an existing file) – The object to be saved.
source_file (a list of items which are a pathlike object or string representing a file) – The source file(s) to extract entities from.
- Optional Inputs:
base_directory (a string or os.PathLike object) – Path to the base directory for storing data.
check_hdr (a boolean) – Fix headers of NIfTI outputs. (Nipype default value:
True)compress (a list of items which are a boolean or None) – Whether
in_fileshould be compressed (True), uncompressed (False) or left unmodified (None, default). (Nipype default value:[])data_dtype (a string) – NumPy datatype to coerce NIfTI data to, or source to match the input file dtype.
dismiss_entities (a list of items which are a string or None) – A list entities that will not be propagated from the source file. (Nipype default value:
[])meta_dict (a dictionary with keys which are a string and with values which are any value) – An input dictionary containing metadata.
- Outputs:
compression (a list of items which are a boolean or None) – Whether
in_fileshould be compressed (True), uncompressed (False) or left unmodified (None).fixed_hdr (a list of items which are a boolean) – Whether derivative header was fixed.
out_file (a list of items which are a pathlike object or string representing an existing file)
out_meta (a list of items which are a pathlike object or string representing an existing file)
- out_path_base = ''
- class qsirecon.interfaces.bids.ReconDerivativesDataSink(allowed_entities=None, out_path_base=None, **inputs)[source]
Bases:
DerivativesDataSink- Mandatory Inputs:
in_file (a string or os.PathLike object referring to an existing directory or a list of items which are a pathlike object or string representing an existing file) – The object to be saved.
source_file (a list of items which are a pathlike object or string representing a file) – The source file(s) to extract entities from.
- Optional Inputs:
atlas (a string) – Label for label field. (Nipype default value:
"")base_directory (a string or os.PathLike object) – Path to the base directory for storing data.
bundle (a string) – Label for bundle field. (Nipype default value:
"")bundles (a string) – Label for bundles field. (Nipype default value:
"")check_hdr (a boolean) – Fix headers of NIfTI outputs. (Nipype default value:
True)compress (a list of items which are a boolean or None) – Whether
in_fileshould be compressed (True), uncompressed (False) or left unmodified (None, default). (Nipype default value:[])data_dtype (a string) – NumPy datatype to coerce NIfTI data to, or source to match the input file dtype.
dismiss_entities (a list of items which are a string or None) – A list entities that will not be propagated from the source file. (Nipype default value:
[])extension (a string) – Extension (will be ignored). (Nipype default value:
"")label (a string) – Label for label field. (Nipype default value:
"")meta_dict (a dictionary with keys which are a string and with values which are any value) – An input dictionary containing metadata.
model (a string) – Label for model field. (Nipype default value:
"")param (a string) – Label for parameter field. (Nipype default value:
"")qsirecon_suffix (a string) – Name appended to qsirecon- in the derivatives. (Nipype default value:
"")
- Outputs:
compression (a list of items which are a boolean or None) – Whether
in_fileshould be compressed (True), uncompressed (False) or left unmodified (None).fixed_hdr (a list of items which are a boolean) – Whether derivative header was fixed.
out_file (a string) – The output file/folder.
out_meta (a list of items which are a pathlike object or string representing an existing file)
- out_path_base = 'qsirecon'