### Fetch Haxby dataset example Source: https://github.com/nipy/nibabel/wiki/install_data_packages.rst Demonstrates fetching the Haxby dataset and accessing file paths. Requires nilearn to be installed. ```python from nilearn import datasets haxby_files = datasets.fetch_haxby(n_subjects=1) print haxby_files.keys() # Path to first functional file print haxby_files.func[0] ``` -------------------------------- ### Install NiBabel from source using pip Source: https://github.com/nipy/nibabel/blob/master/doc/source/installation.rst Install NiBabel by downloading the source distribution and running pip install from the unpacked directory. This is useful for manual installations. ```bash pip install . ``` -------------------------------- ### Load libraries and example file Source: https://github.com/nipy/nibabel/blob/master/doc/source/nibabel_images.rst Imports necessary libraries and defines the path to an example NIfTI file. ```python import os import numpy as np from nibabel.testing import data_path example_file = os.path.join(data_path, 'example4d.nii.gz') ``` -------------------------------- ### Install Pre-commit with uv (Bare) Source: https://github.com/nipy/nibabel/blob/master/doc/source/devel/devguide.rst Install pre-commit using uv in a bare mode, which is an alternative method for setting up the development environment. ```bash uv tool install --with=pre-commit-uv-bare pre-commit ``` -------------------------------- ### Install Development Dependencies with uv Source: https://github.com/nipy/nibabel/blob/master/doc/source/devel/devguide.rst Install tox and pre-commit using uv for development. This command installs the necessary tools into a local .venv environment. ```bash uv sync --group=dev ``` -------------------------------- ### Install NiBabel to user directory Source: https://github.com/nipy/nibabel/blob/master/doc/source/installation.rst If you encounter permission errors when installing from source, use the --user flag to install NiBabel into your user directories instead of system-wide locations. ```bash pip install --user . ``` -------------------------------- ### Basic .gitconfig file example Source: https://github.com/nipy/nibabel/blob/master/doc/source/gitwash/configure_git.rst An example of a personal `.gitconfig` file showing user details, aliases, core settings, and merge options. ```gitconfig [user] name = Your Name email = you@yourdomain.example.com [alias] ci = commit -a co = checkout st = status stat = status br = branch wdiff = diff --color-words [core] editor = vim [merge] summary = true ``` -------------------------------- ### Install tox using uv tool Source: https://github.com/nipy/nibabel/blob/master/doc/source/devel/devguide.rst Install tox specifically using the uv tool. This is an alternative to `uv sync --group=dev`. ```bash uv tool install --with=tox-uv-bare tox ``` -------------------------------- ### Load example NIfTI 1 image Source: https://github.com/nipy/nibabel/blob/master/doc/source/nifti_images.rst Loads an example NIfTI 1 image from the nibabel testing data path. This is useful for demonstrating NIfTI 1 functionality. ```python import os import nibabel as nib from nibabel.testing import data_path example_ni1 = os.path.join(data_path, 'example4d.nii.gz') n1_img = nib.load(example_ni1) n1_img ``` -------------------------------- ### Load example NIfTI 2 image Source: https://github.com/nipy/nibabel/blob/master/doc/source/nifti_images.rst Loads an example NIfTI 2 image from the nibabel testing data path. This is useful for demonstrating NIfTI 2 functionality. ```python import os import nibabel as nib from nibabel.testing import data_path example_ni2 = os.path.join(data_path, 'example_nifti2.nii.gz') n2_img = nib.load(example_ni2) n2_img ``` -------------------------------- ### Data Tool Configuration File Example Source: https://github.com/nipy/nibabel/wiki/data_packages.rst Example INI-style configuration file for the data tool, specifying package containers and paths. Higher precedence files override lower precedence ones. ```ini [data] package_containers : /usr/local/share/nipy/dipy /usr/share/nipy/dipy package_paths : /usr/local/share/data/nipy-templates /usr/local/share/data/nipy-data ``` -------------------------------- ### Install data package for user Source: https://github.com/nipy/nibabel/wiki/data_packages.rst Installs a data package into the user's home directory. This allows for local copies of data that may be too large for repositories. ```bash data-tool install --user my-data ``` -------------------------------- ### Install Pre-commit Hooks Source: https://github.com/nipy/nibabel/blob/master/doc/source/devel/devguide.rst Install the pre-commit hooks to validate changes before committing. This is a standard step for contributing to the project. ```bash pre-commit install ``` -------------------------------- ### Install Latest Development Version Source: https://github.com/nipy/nibabel/blob/master/README.rst Install the latest development version of NiBabel directly from its GitHub repository. ```bash pip install git+https://github.com/nipy/nibabel ``` -------------------------------- ### Install Test Dependencies and Run Pytest Source: https://github.com/nipy/nibabel/blob/master/README.rst Install NiBabel with test dependencies and run tests using pytest. Use this to test an installed version of NiBabel. ```bash pip install nibabel[test] pytest --pyargs nibabel ``` -------------------------------- ### Install NiBabel with pip Source: https://github.com/nipy/nibabel/blob/master/README.rst Use this command to install the current release of NiBabel from PyPI. ```bash pip install nibabel ``` -------------------------------- ### Install data package for system Source: https://github.com/nipy/nibabel/wiki/data_packages.rst Installs a data package into the system directories, making it available to all users. This is typically done by a system administrator. ```bash data-tool install --system my-data ``` -------------------------------- ### Install Pre-commit with pip Source: https://github.com/nipy/nibabel/blob/master/doc/source/devel/devguide.rst Install pre-commit using pip, a common Python package installer. This is another option for setting up the necessary tools. ```bash python -m pip install pre-commit ``` -------------------------------- ### Accessing first volume data in NIfTI Source: https://github.com/nipy/nibabel/blob/master/doc/source/devel/biaps/biap_0006.rst Load a 4D NIfTI image and access its data. This example shows how to get the first volume (index 0) from the time dimension. ```python img = nibabel.load('my_4d.nii') data = img.get_data() vol0 = data[..., 0] ``` -------------------------------- ### Install NiBabel in Editable Mode Source: https://github.com/nipy/nibabel/blob/master/README.rst When contributing to NiBabel, clone the repository and install it in editable mode for development. ```bash git clone https://github.com/nipy/nibabel.git pip install -e ./nibabel ``` -------------------------------- ### Slice Acquisition Times Example Source: https://github.com/nipy/nibabel/blob/master/doc/source/devel/biaps/biap_0003.rst Specifies acquisition times for individual slices in milliseconds, relative to the start of the volume. Use when 'acquisition_times' applies to an image axis representing slices. ```python element = dict(applies_to=['slice'], acquisition_times=[0, 20, 40, 60, 80, 100]) ``` -------------------------------- ### Discover Package Path Source: https://github.com/nipy/nibabel/blob/master/doc/source/devel/data_pkg_discuss.rst Find the installation path for a specific package and version. Raises an error if the package is not found. ```python from ourpkg import default_registry my_pkg_path = default_registry.pathfor('mypkg', '0.3') if mypkg_path is None: raise RuntimeError('It looks like mypkg version 0.3 is not installed') ``` -------------------------------- ### Install NiBabel on Debian/Ubuntu Source: https://github.com/nipy/nibabel/blob/master/doc/source/installation.rst Install NiBabel on Debian or Ubuntu systems using apt-get after enabling the NeuroDebian repository. This method uses the system's package manager. ```bash apt-get update apt-get install python-nibabel ``` -------------------------------- ### Load and inspect an example image Source: https://github.com/nipy/nibabel/blob/master/doc/source/images_and_memory.rst Loads a 4D NIfTI image and shows its dataobj is an ArrayProxy, indicating data is not yet loaded into memory. ```python import os import numpy as np from nibabel.testing import data_path example_file = os.path.join(data_path, 'example4d.nii.gz') import nibabel as nib img = nib.load(example_file) img.dataobj ``` -------------------------------- ### Prepare for Interactive Rebase Source: https://github.com/nipy/nibabel/blob/master/doc/source/gitwash/development_workflow.rst Before starting an interactive rebase, create a backup branch of the current state to allow for easy recovery if needed. ```bash git branch tmp HEAD ``` -------------------------------- ### JSON-LD Example for NIPY Header Source: https://github.com/nipy/nibabel/blob/master/doc/source/devel/biaps/biap_0003.rst Example demonstrating how JSON-LD can be used to provide semantic context for NIPY header fields, mapping keys to URIs for machine-readable definitions. ```json { "@context": { "dcm": "http://neurolex.org/wiki/Category:#" }, "dcm:Echo_Time": 45, "dcm:Repetition_Time": 2, } ``` -------------------------------- ### Example DOI Markdown Source: https://github.com/nipy/nibabel/blob/master/doc/source/devel/make_release.rst This is an example of the Markdown text for a DOI badge, which can be copied and pasted into GitHub release notes to link to the citable version of the release on Zenodo. ```markdown [![DOI](https://zenodo.org/badge/doi/10.5281/zenodo.60847.svg)](https://doi.org/10.5281/zenodo.60847) ``` -------------------------------- ### Data Tool Configuration with Include Source: https://github.com/nipy/nibabel/wiki/data_packages.rst Example of a data tool configuration file that includes other configuration files. Values from included files have lower precedence. ```ini [data] include : ~/data/other_data.json ~/data/more_data.json package_paths : /usr/share/dipy/nipy-dicom ``` -------------------------------- ### Run all style checks with pre-commit Source: https://github.com/nipy/nibabel/blob/master/doc/source/devel/devguide.rst Apply all configured pre-commit hooks to all files in the repository. This ensures code consistency and adherence to style guides. ```bash pre-commit run --all-files ``` -------------------------------- ### Initiate Interactive Rebase Source: https://github.com/nipy/nibabel/blob/master/doc/source/gitwash/development_workflow.rst Start an interactive rebase to modify commit history, specifying the commit from which to begin the rebase. ```bash git rebase -i 6ad92e5 ``` -------------------------------- ### Volume Acquisition Times Example Source: https://github.com/nipy/nibabel/blob/master/doc/source/devel/biaps/biap_0003.rst Specifies acquisition times for individual volumes in milliseconds, relative to the beginning of the run. Use when 'acquisition_times' applies to a volume axis. ```python element = dict(applies_to=['time'], acquisition_times=[0, 120, 240, 480, 600]) ``` -------------------------------- ### Extract Version using Regex Source: https://github.com/nipy/nibabel/wiki/data_packages.rst Example of using Python's re module to extract a version string from git describe output based on a regular expression. ```python import re git_describe_output = 'rel-0.1-111-g1234567' print(re.match('rel-(.*)', git_describe_output).groups()[0]) ``` -------------------------------- ### Add data package directory to path Source: https://github.com/nipy/nibabel/wiki/data_packages.rst Register a directory containing a data package to be discoverable by data package utilities. This is an alternative to using the 'install' facility. ```bash data-tool pkg-path add nipy-templates-0.3 ``` -------------------------------- ### Build Documentation with Make Source: https://github.com/nipy/nibabel/blob/master/doc/README.rst Run these commands in the root directory to build the HTML documentation. ```bash uv sync --extra doc source .venv/bin/activate make -C doc html ``` -------------------------------- ### Get multiple slices with explicit copy option Source: https://github.com/nipy/nibabel/blob/master/doc/source/devel/biaps/biap_0002.rst Use the 'get_slices' method to retrieve multiple slices, specifying 'copy=True'. This example shows retrieving a range of slices from the last dimension. ```python slices = img.get_slices(slice(0,3), copy=True) ``` -------------------------------- ### Initialize and Add Git Submodules for Data Suite Source: https://github.com/nipy/nibabel/wiki/data_packages.rst Set up a directory as a data suite by initializing a git repository and adding data packages as submodules. This is useful for organizing related data packages. ```bash mkdir my-suite cd my-suite git init git submodule add https://github.com/yarikoptic/nitest-balls1 git submodule add https://github.com/yarikoptic/nitest-balls2 git commit -m "Added some data packages" cd .. ``` -------------------------------- ### Validate NiBabel installation Source: https://github.com/nipy/nibabel/blob/master/doc/source/installation.rst Import the nibabel module in a Python interpreter to verify that the installation was successful. This is a basic check for the module's availability. ```python Python 3.8.5 (default, Sep 4 2020, 07:30:14) [GCC 7.3.0] :: Anaconda, Inc. on linux Type "help", "copyright", "credits" or "license" for more information. >>> import nibabel >>> ``` -------------------------------- ### Data Tool Configuration Precedence Example Source: https://github.com/nipy/nibabel/wiki/data_packages.rst Illustrates configuration precedence where a lower precedence file's `package_paths` can be overridden by a higher precedence file's `package_paths` or `package_containers`. ```ini [data] package_paths : /usr/share/dipy/nipy-dicom ``` -------------------------------- ### Load and Display Image Slice Source: https://github.com/nipy/nibabel/blob/master/doc/source/neuro_radio_conventions.rst Loads a NIfTI image and displays a middle slice. This example shows how to access image data and visualize it, considering the affine transformation for correct orientation. The transpose and origin='lower' are used to match common display conventions. ```python import nibabel as nib import matplotlib.pyplot as plt img = nib.load('downloads/someones_anatomy.nii.gz') # The 3x3 part of the affine is diagonal with all +ve values img.affine ``` ```python img_data = img.get_fdata() a_slice = img_data[:, :, 28] # Need transpose to put first axis left-right, second bottom-top plt.imshow(a_slice.T, cmap="gray", origin="lower") # doctest: +SKIP ``` -------------------------------- ### Upload documentation to GitHub pages Source: https://github.com/nipy/nibabel/blob/master/doc/source/devel/make_release.rst Build and upload the project documentation to GitHub pages. This makes the latest documentation accessible online. ```bash make upload-html ``` -------------------------------- ### Fetch all data from Haxby package Source: https://github.com/nipy/nibabel/wiki/install_data_packages.rst Fetches all available data from the 'haxby' package. ```bash datatool fetch haxby all ``` -------------------------------- ### Create Data Package Source: https://github.com/nipy/nibabel/wiki/data_packages.rst Generate a default datapackage.json file for a directory to make it a data package. ```bash data-tool make-pkg . ``` -------------------------------- ### API Test for PAR/REC Image Format Source: https://github.com/nipy/nibabel/blob/master/doc/source/devel/add_image_format.rst Example of how to define an API test for a new image format by inheriting from LoadImageAPI. You need to define the loader function and provide example images. ```python class TestPARRECAPI(LoadImageAPI): def loader(self, fname): return parrec.load(fname) example_images = PARREC_EXAMPLE_IMAGES ``` -------------------------------- ### Create and write image plane by plane Source: https://github.com/nipy/nibabel/blob/master/doc/source/devel/spm_use.rst This example demonstrates creating a new 'vol' struct from scratch and writing it to a file plane by slice. It initializes an empty struct and would typically be followed by setting its fields and writing. ```matlab >> new_vol = struct(); ``` -------------------------------- ### DICOM Private Creator Example Source: https://github.com/nipy/nibabel/blob/master/doc/source/dicom/dicom_intro.rst This example shows a real data element from a Siemens DICOM dataset used to reserve private data elements. It identifies the implementer and the block of elements reserved. ```text (0019, 0010) Private Creator LO: 'SIEMENS MR HEADER' ``` -------------------------------- ### Get image data shape Source: https://github.com/nipy/nibabel/blob/master/doc/source/nibabel_images.rst Retrieves the shape of the image data array from the header. ```python print(header.get_data_shape()) ``` -------------------------------- ### Empty Axis Metadata Example Source: https://github.com/nipy/nibabel/blob/master/doc/source/devel/biaps/biap_0003.rst Demonstrates setting an empty list for axis_metadata in a NIPy header. ```python hdr['axis_metadata'] = [] ``` -------------------------------- ### Get image data dtype Source: https://github.com/nipy/nibabel/blob/master/doc/source/nibabel_images.rst Retrieves the numpy data type of the image data from the header. ```python print(header.get_data_dtype()) ``` -------------------------------- ### Initialize Git Submodules Source: https://github.com/nipy/nibabel/blob/master/doc/source/devel/add_test_data.rst Command to initialize and checkout all test data repositories that have been added as git submodules. This is necessary when running tests locally. ```bash git submodule update --init ``` -------------------------------- ### DICOM JSON Representation Example Source: https://github.com/nipy/nibabel/blob/master/doc/source/devel/biaps/biap_0003.rst Illustrates a DICOM JSON representation for a tag and its preferred nibabel equivalent. ```json "00080070": { "vr": "LO", "Value": [ "SIEMENS" ] }, ``` ```json "Manufacturer": "SIEMENS" ``` -------------------------------- ### Get and Set Filename Source: https://github.com/nipy/nibabel/blob/master/doc/source/nibabel_images.rst Manage the associated filename for an image object using `set_filename` and `get_filename` methods. ```python img_again.set_filename('another_image.nii') img_again.get_filename() ``` -------------------------------- ### Getting the Fall-back Header Affine Source: https://github.com/nipy/nibabel/blob/master/doc/source/nifti_images.rst Obtain the base affine, which is a fall-back affine constructed from voxel dimensions. ```APIDOC ## Getting the Fall-back Header Affine ### Description Retrieve the base affine, which serves as a fall-back affine constructed from voxel dimensions. ### Method - **get_base_affine()** - Returns the fall-back affine matrix. ### Example ```python print(n1_header.get_base_affine()) ``` ``` -------------------------------- ### Save and Load NIfTI Image with Scaling Source: https://github.com/nipy/nibabel/blob/master/doc/source/nifti_images.rst Demonstrates saving a NIfTI image with scaling applied and then loading it back. The loaded image's header will have scaling reset, but the original scaling is preserved in the data object. ```python >>> nib.save(array_img, 'scaled_image.nii') >>> scaled_img = nib.load('scaled_image.nii') ``` -------------------------------- ### Configure Remotes for Development Workflow Source: https://github.com/nipy/nibabel/blob/master/doc/source/gitwash/patching.rst Set up your Git repository to interact with your fork on GitHub and the original upstream repository. This is part of transitioning to a full development workflow. ```bash # checkout and refresh master branch from main repo git checkout master git pull origin master # rename pointer to main repository to 'upstream' git remote rename origin upstream # point your repo to default read / write to your fork on github git remote add origin git@github.com:your-user-name/nibabel.git # push up any branches you've made and want to keep git push origin the-fix-im-thinking-of ``` -------------------------------- ### Get Slices with Copy If Proxy Source: https://github.com/nipy/nibabel/blob/master/doc/source/devel/biaps/biap_0002.rst Use this when the image is a proxy and a copy is needed. Otherwise, a view is preferred. ```python slices = img.get_slices(slicedef, copy_if='is_proxy') ``` -------------------------------- ### Version Comparison using LooseVersion Source: https://github.com/nipy/nibabel/wiki/data_packages.rst Demonstrates how version strings are compared using distutils.version.LooseVersion, showing that a non-version-control string is considered greater than a version-control string. ```python from distutils.version import LooseVersion print(LooseVersion('1.3.1') > LooseVersion('1.3.0-519-ga1b925f')) ``` -------------------------------- ### NIPY Header with Manufacturer Field Source: https://github.com/nipy/nibabel/blob/master/doc/source/devel/biaps/biap_0003.rst Example of a NIPY header including the 'nipy_header_version' and an image metadata field, 'Manufacturer'. ```python hdr = dict(nipy_header_version='1.0', Manufacturer="SIEMENS") ``` -------------------------------- ### Create NIfTI image with scaling Source: https://github.com/nipy/nibabel/blob/master/doc/source/nifti_images.rst Demonstrates creating a NIfTI image with specific data types and scaling factors. The scl_slope and scl_inter header fields control data scaling during loading and saving. ```python >>> array_data = np.arange(24, dtype=np.int16).reshape((2, 3, 4)) >>> affine = np.diag([1, 2, 3, 1]) >>> array_img = nib.Nifti1Image(array_data, affine) >>> array_header = array_img.header ``` -------------------------------- ### Read-only Property Example Source: https://github.com/nipy/nibabel/wiki/property_manifesto.rst Demonstrates a read-only property that returns a private attribute. This is an acceptable use case for properties. ```python class C(object): def __init__(self, arg1, arg2): self._arg1= arg1 self._arg2 = None self.arg2 = arg2 # just read only @property def arg1(self): return self._arg1 ``` -------------------------------- ### Getting the S-form Affine Source: https://github.com/nipy/nibabel/blob/master/doc/source/nifti_images.rst Retrieve the sform affine from the NIfTI header, which is stored in 'srow_x', 'srow_y', and 'srow_z' fields. ```APIDOC ## Getting the S-form Affine ### Description Retrieve the sform affine transformation from the NIfTI header. ### Method - **get_sform()** - Returns the sform affine. - **get_sform(coded=True)** - Returns a tuple containing the sform affine and its associated code. ### Header Fields - **srow_x** (list) - First row of the sform affine. - **srow_y** (list) - Second row of the sform affine. - **srow_z** (list) - Third row of the sform affine. - **sform_code** (int) - Code indicating the space the sform affine refers to. ### Example ```python # Get the sform affine print(n1_header.get_sform()) # Get the sform affine and its code affine, code = n1_header.get_sform(coded=True) print(affine, code) ``` ``` -------------------------------- ### Create and Save NIfTI Image Source: https://github.com/nipy/nibabel/blob/master/doc/source/gettingstarted.rst Create a new NIfTI image from NumPy data and an affine transformation, then save it to a file. The header is initialized with defaults based on the data. ```python import numpy as np import nibabel as nib data = np.ones((32, 32, 15, 100), dtype=np.int16) img = nib.Nifti1Image(data, np.eye(4)) print(img.get_data_dtype() == np.dtype(np.int16)) print(img.header.get_xyzt_units()) nib.save(img, os.path.join('build', 'test4d.nii.gz')) ``` -------------------------------- ### Add Read-Write Upstream Remote Source: https://github.com/nipy/nibabel/blob/master/doc/source/gitwash/maintainer_workflow.rst Add a remote repository with read-write access to the upstream repository. This is a one-time setup. ```bash git remote add upstream-rw git@github.com:nipy/nibabel.git git fetch upstream-rw ``` -------------------------------- ### Basic Editing Workflow Source: https://github.com/nipy/nibabel/blob/master/doc/source/gitwash/development_workflow.rst A simplified overview of the common steps for making changes: editing files, staging them, and committing them with a message. ```bash # hack hack git add my_new_file git commit -am 'NF - some message' git push ``` -------------------------------- ### Slice and Volume Acquisition Times Example Source: https://github.com/nipy/nibabel/blob/master/doc/source/devel/biaps/biap_0003.rst Specifies acquisition times for each slice within each volume, in milliseconds relative to the beginning of the run. Use when 'acquisition_times' applies to both slice and volume axes. ```python element = dict(applies_to=['slice', 'time'], acquisition_times = [[0, 100, 200], [10, 110, 210], [20, 120, 220], [30, 130, 230], [40, 140, 240]] ) ``` -------------------------------- ### Nipy Header Axis Metadata Example Source: https://github.com/nipy/nibabel/blob/master/doc/source/devel/biaps/biap_0003.rst Defines a dictionary for a NIPy header, including axis names and metadata elements. ```python hdr = dict(nipy_header_version='1.0', axis_names = ["frequency", "phase", "slice", "time"], axis_metadata = [ dict(applies_to = ['time']), dict(applies_to = ['slice']), dict(applies_to = ['slice', 'time']), ]) ``` -------------------------------- ### Nipy Header Axis Names Example Source: https://github.com/nipy/nibabel/blob/master/doc/source/devel/biaps/biap_0003.rst Defines a dictionary for a NIPy header, specifying axis names for a 4D image. ```python hdr = dict(nipy_header_version='1.0', axis_names=["frequency", "phase", "slice", "time"]) ``` -------------------------------- ### Instantiate and fetch Haxby package in Python Source: https://github.com/nipy/nibabel/wiki/install_data_packages.rst Instantiates a local virtual copy of the Haxby dataset and fetches the 'subject2' group. Raises an error if the group is not fetched. ```python import datatool # Instantiate a local virtual copy of the dataset haxby = datatools.get_package('haxby') bold_fname = haxby['subject2']['session1']['bold'].filename # DataToolError : please fetch 'subject2' group haxby.fetch('subject2') bold_fname = haxby['subject2']['session1']['bold'].filename ``` -------------------------------- ### Getting the Q-form Affine Source: https://github.com/nipy/nibabel/blob/master/doc/source/nifti_images.rst Retrieve the qform affine from the NIfTI header, which is derived from voxel sizes, qfac, and quaternion information. ```APIDOC ## Getting the Q-form Affine ### Description Retrieve the qform affine transformation from the NIfTI header. ### Method - **get_qform()** - Returns the qform affine. - **get_qform(coded=True)** - Returns a tuple containing the qform affine and its associated code. ### Example ```python # Get the qform affine and its code affine, code = n1_header.get_qform(coded=True) print(affine, code) ``` ``` -------------------------------- ### Get voxel sizes Source: https://github.com/nipy/nibabel/blob/master/doc/source/nibabel_images.rst Retrieves the voxel sizes in millimeters from the header. The last value represents the time between scans in milliseconds. ```python print(header.get_zooms()) ``` -------------------------------- ### Run ruff-format with pre-commit Source: https://github.com/nipy/nibabel/blob/master/doc/source/devel/devguide.rst Apply ruff formatting to all files using pre-commit. This automatically formats code to comply with the project's style. ```bash pre-commit run ruff-format --all-files ```