Skip to main content

Fetch metadata from remote (https) nifti (gzipped or not).

Project description

telenib

Read header of remote nifti according to nifti1 spec and nifti2 spec either gzipped or not.

Requirements

server must support RANGE request.

  • requests
  • nibabel

Why?

For large nifti files, it is often not feasible to download the full nifti file in order to access the header.

Installation

  • via pip
pip install telenib

Usage

from telenib import get_nii_header
from nibabel import Nifti1Header, Nifti2Header

nii_url="https://nifti.nimh.nih.gov/nifti-1/data/avg152T1_RL_nifti.nii.gz"
tele_header = get_nii_header(nii_url)

assert isinstance(tele_header, Nifti1Header) or isinstance(tele_header, Nifti2Header)

One could also add any custom header

from telenib import get_nii_header

# from https://nifti.nimh.nih.gov/nifti-1/data
nii_url="https://my.example.co/my/dir/nii.nii.gz"
tele_header = get_nii_header(nii_url, headers={
    'Authorization': f'token my-secret-token'
})

print(tele_header)

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

telenib-0.0.2.tar.gz (2.8 kB view hashes)

Uploaded Source

Built Distribution

telenib-0.0.2-py3-none-any.whl (3.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page