miblab.rat_fetch#

miblab.rat_fetch(dataset: str | None = None, *, folder: str | Path = './tristanrat', unzip: bool = True, convert: bool = False, keep_archives: bool = False) List[str][source]#

Download, recursively extract, and (optionally) convert TRISTAN rat MRI studies from Zenodo (record 15747417).

The helper understands the 15 published studies S01 … S15. Pass dataset="all" (or leave dataset empty) to fetch every archive in one go.

Parameters:
  • dataset"S01" "S15" to grab a single study "all" or None to fetch them all.

  • folder – Root directory that will hold the SXX.zip files and the extracted DICOM tree. A sibling directory <folder>_nifti/ is used for conversion output.

  • unzip – If True, each ZIP is unpacked recursively (handles inner ZIP-in-ZIP structures).

  • convert – If True, every DICOM folder is converted to compressed NIfTI (_requires the dicom2nifti wheel and ``unzip=True``_).

  • keep_archives – Forwarded to _unzip_nested(); set True to retain each inner ZIP after extraction (useful for auditing).

Returns:

Absolute paths to every SXX.zip that was downloaded (whether new or cached).

Return type:

list[str]

Examples

Download a single study and leave it zipped

>>> from miblab import rat_fetch
>>> rat_fetch("S01", folder="~/tristanrat", unzip=False)
['/home/you/tristanrat/S01.zip']

Fetch the entire collection, unzip, but skip conversion

>>> rat_fetch(dataset="all",
...           folder="./rat_data",
...           unzip=True,
...           convert=False)

Full end-to-end pipeline (requires dicom2nifti)

>>> rat_fetch("S03",
...           folder="./rat_data",
...           unzip=True,
...           convert=True)

The call returns the list of ZIP paths; side-effects are files extracted (and optionally NIfTI volumes) under folder.