bidsschematools.types.context

BIDS validation context dataclasses

The classes in this module may be used to populate the context for BIDS validation.

This module has been auto-generated from the BIDS schema version 1.2.0-dev.

Classes

class bidsschematools.types.context.Aslcontext(path: str, n_rows: int, volume_type: Sequence[str] | None = None)

Bases: object

ASL context file

path

Path to associated aslcontext file

Type:

str

n_rows

Number of rows in aslcontext.tsv

Type:

int

volume_type

Contents of the volume_type column

Type:

Sequence[str] | None

class bidsschematools.types.context.Associations(events: Events | None = None, aslcontext: Aslcontext | None = None, m0scan: M0scan | None = None, magnitude: Magnitude | None = None, magnitude1: Magnitude1 | None = None, bval: Bval | None = None, bvec: Bvec | None = None, channels: Channels | None = None, electrodes: Electrodes | None = None, coordsystem: Coordsystem | None = None)

Bases: object

Associated files, indexed by suffix, selected according to the inheritance principle

events

Events file

Type:

protocols.Events | None

aslcontext

ASL context file

Type:

protocols.Aslcontext | None

m0scan

M0 scan file

Type:

protocols.M0scan | None

magnitude

Magnitude image file

Type:

protocols.Magnitude | None

magnitude1

Magnitude1 image file

Type:

protocols.Magnitude1 | None

bval

B value file

Type:

protocols.Bval | None

bvec

B vector file

Type:

protocols.Bvec | None

channels

Channels file

Type:

protocols.Channels | None

electrodes

Electrodes file

Type:

protocols.Electrodes | None

coordsystem

Coordinate system file

Type:

protocols.Coordsystem | None

class bidsschematools.types.context.Bval(path: str, n_cols: int, n_rows: int, values: Sequence[float])

Bases: object

B value file

path

Path to associated bval file

Type:

str

n_cols

Number of columns in bval file

Type:

int

n_rows

Number of rows in bval file

Type:

int

values

B-values contained in bval file

Type:

Sequence[float]

class bidsschematools.types.context.Bvec(path: str, n_cols: int, n_rows: int)

Bases: object

B vector file

path

Path to associated bvec file

Type:

str

n_cols

Number of columns in bvec file

Type:

int

n_rows

Number of rows in bvec file

Type:

int

class bidsschematools.types.context.Channels(path: str, type: Sequence[str] | None = None, short_channel: Sequence[str] | None = None, sampling_frequency: Sequence[str] | None = None)

Bases: object

Channels file

path

Path to associated channels file

Type:

str

type

Contents of the type column

Type:

Sequence[str] | None

short_channel

Contents of the short_channel column

Type:

Sequence[str] | None

sampling_frequency

Contents of the sampling_frequency column

Type:

Sequence[str] | None

class bidsschematools.types.context.Context(schema: Mapping[str, Any], dataset: Dataset, path: str, size: int, sidecar: Mapping[str, Any], associations: Associations, subject: Subject | None = None, entities: Mapping[str, Any] | None = None, datatype: str | None = None, suffix: str | None = None, extension: str | None = None, modality: str | None = None, columns: Mapping[str, Any] | None = None, json: Mapping[str, Any] | None = None, gzip: Gzip | None = None, nifti_header: NiftiHeader | None = None, ome: Ome | None = None, tiff: Tiff | None = None)

Bases: object

schema

The BIDS specification schema

Type:

Mapping[str, Any]

dataset

Properties and contents of the entire dataset

Type:

protocols.Dataset

path

Path of the current file

Type:

str

size

Length of the current file in bytes

Type:

int

sidecar

Sidecar metadata constructed via the inheritance principle

Type:

Mapping[str, Any]

associations

Associated files, indexed by suffix, selected according to the inheritance principle

Type:

protocols.Associations

subject

Properties and contents of the current subject

Type:

protocols.Subject | None

entities

Entities parsed from the current filename

Type:

Mapping[str, Any] | None

datatype

Datatype of current file, for examples, anat

Type:

str | None

suffix

Suffix of current file

Type:

str | None

extension

Extension of current file including initial dot

Type:

str | None

modality

Modality of current file, for examples, MRI

Type:

str | None

columns

TSV columns, indexed by column header, values are arrays with column contents

Type:

Mapping[str, Any] | None

json

Contents of the current JSON file

Type:

Mapping[str, Any] | None

gzip

Parsed contents of gzip header

Type:

protocols.Gzip | None

nifti_header

Parsed contents of NIfTI header referenced elsewhere in schema.

Type:

protocols.NiftiHeader | None

ome

Parsed contents of OME-XML header, which may be found in OME-TIFF or OME-ZARR files

Type:

protocols.Ome | None

tiff

TIFF file format metadata

Type:

protocols.Tiff | None

class bidsschematools.types.context.Coordsystem(path: str)

Bases: object

Coordinate system file

path

Path to associated coordsystem file

Type:

str

class bidsschematools.types.context.Dataset(dataset_description: Mapping[str, Any], tree: Mapping[str, Any], ignored: Sequence[str], datatypes: Sequence[str], modalities: Sequence[str], subjects: Subjects)

Bases: object

Properties and contents of the entire dataset

dataset_description

Contents of /dataset_description.json

Type:

Mapping[str, Any]

tree

Tree view of all files in dataset

Type:

Mapping[str, Any]

ignored

Set of ignored files

Type:

Sequence[str]

datatypes

Data types present in the dataset

Type:

Sequence[str]

modalities

Modalities present in the dataset

Type:

Sequence[str]

subjects

Collections of subjects in dataset

Type:

protocols.Subjects

class bidsschematools.types.context.DimInfo(freq: int, phase: int, slice: int)

Bases: object

Metadata about dimensions data.

freq

These fields encode which spatial dimension (1, 2, or 3).

Type:

int

phase

Corresponds to which acquisition dimension for MRI data.

Type:

int

slice

Slice dimensions.

Type:

int

class bidsschematools.types.context.Electrodes(path: str)

Bases: object

Electrodes file

path

Path to associated electrodes.tsv file

Type:

str

class bidsschematools.types.context.Events(path: str, onset: Sequence[str] | None = None)

Bases: object

Events file

path

Path to associated events file

Type:

str

onset

Contents of the onset column

Type:

Sequence[str] | None

class bidsschematools.types.context.Gzip(timestamp: float, filename: str | None = None, comment: str | None = None)

Bases: object

Parsed contents of gzip header

timestamp

Modification time, unix timestamp

Type:

float

filename

Filename

Type:

str | None

comment

Comment

Type:

str | None

class bidsschematools.types.context.M0scan(path: str)

Bases: object

M0 scan file

path

Path to associated M0 scan file

Type:

str

class bidsschematools.types.context.Magnitude(path: str)

Bases: object

Magnitude image file

path

Path to associated magnitude file

Type:

str

class bidsschematools.types.context.Magnitude1(path: str)

Bases: object

Magnitude1 image file

path

Path to associated magnitude1 file

Type:

str

class bidsschematools.types.context.NiftiHeader(dim_info: DimInfo, dim: Sequence[int], pixdim: Sequence[float], shape: Sequence[int], voxel_sizes: Sequence[float], xyzt_units: XyztUnits, qform_code: int, sform_code: int, axis_codes: Sequence[Literal['R', 'L', 'A', 'P', 'S', 'I']], mrs: Mapping[str, Any] | None = None)

Bases: object

Parsed contents of NIfTI header referenced elsewhere in schema.

dim_info

Metadata about dimensions data.

Type:

protocols.DimInfo

dim

Data seq dimensions.

Type:

Sequence[int]

pixdim

Grid spacings (unit per dimension).

Type:

Sequence[float]

shape

Data array shape, equal to dim[1:dim[0] + 1]

Type:

Sequence[int]

voxel_sizes

Voxel sizes, equal to pixdim[1:dim[0] + 1]

Type:

Sequence[float]

xyzt_units

Units of pixdim[1..4]

Type:

protocols.XyztUnits

qform_code

Use of the quaternion fields.

Type:

int

sform_code

Use of the affine fields.

Type:

int

axis_codes

Orientation labels indicating primary direction of data axes defined with respect to the object of interest.

Type:

Sequence[Literal[‘R’, ‘L’, ‘A’, ‘P’, ‘S’, ‘I’]]

mrs

NIfTI-MRS JSON fields

Type:

Mapping[str, Any] | None

class bidsschematools.types.context.Ome(PhysicalSizeX: float | None = None, PhysicalSizeY: float | None = None, PhysicalSizeZ: float | None = None, PhysicalSizeXUnit: str | None = None, PhysicalSizeYUnit: str | None = None, PhysicalSizeZUnit: str | None = None)

Bases: object

Parsed contents of OME-XML header, which may be found in OME-TIFF or OME-ZARR files

PhysicalSizeX

Pixels / @PhysicalSizeX

Type:

float | None

PhysicalSizeY

Pixels / @PhysicalSizeY

Type:

float | None

PhysicalSizeZ

Pixels / @PhysicalSizeZ

Type:

float | None

PhysicalSizeXUnit

Pixels / @PhysicalSizeXUnit

Type:

str | None

PhysicalSizeYUnit

Pixels / @PhysicalSizeYUnit

Type:

str | None

PhysicalSizeZUnit

Pixels / @PhysicalSizeZUnit

Type:

str | None

class bidsschematools.types.context.Sessions(ses_dirs: Sequence[str], session_id: Sequence[str] | None = None)

Bases: object

Collections of sessions in subject

ses_dirs

Sessions as determined by ses-* directories

Type:

Sequence[str]

session_id

The session_id column of sessions.tsv

Type:

Sequence[str] | None

class bidsschematools.types.context.Subject(sessions: Sessions)

Bases: object

Properties and contents of the current subject

sessions

Collections of sessions in subject

Type:

protocols.Sessions

class bidsschematools.types.context.Subjects(sub_dirs: Sequence[str], participant_id: Sequence[str] | None = None)

Bases: object

Collections of subjects in dataset

sub_dirs

Subjects as determined by sub-* directories

Type:

Sequence[str]

participant_id

The participant_id column of participants.tsv

Type:

Sequence[str] | None

class bidsschematools.types.context.Tiff(version: int)

Bases: object

TIFF file format metadata

version

TIFF file format version (the second 2-byte block)

Type:

int

class bidsschematools.types.context.XyztUnits(xyz: Literal['unknown', 'meter', 'mm', 'um'], t: Literal['unknown', 'sec', 'msec', 'usec'])

Bases: object

Units of pixdim[1..4]

xyz

String representing the unit of voxel spacing.

Type:

Literal[‘unknown’, ‘meter’, ‘mm’, ‘um’]

t

String representing the unit of inter-volume intervals.

Type:

Literal[‘unknown’, ‘sec’, ‘msec’, ‘usec’]