Skip to main content

xnattools

xnattools is a python package for handy operations on XNAT data.

Documentation

The complete documentation is available at https://radiology.gitlab.io/radiomics/xnattools/ . The following example is a small part of tutorials. Please refer to the documentation for additional tutorials, examples, how-to guides, and developer guides.

Prerequisites

Before you begin, make sure you have:

  1. Installed xnattools. For example using pip:

    pip install xnattools
    
  2. Set up your XNAT credentials using one of these methods:

    Option 1: Using .netrc file (recommended)

    Create or edit ~/.netrc with your XNAT credentials:

    machine xnat.example.com
     login your-xnat-username
     password your-xnat-password
    

    Option 2: Using .env.local file

    Create a .env.local file in your project directory:

    XNAT_USER=your-xnat-username
    XNAT_PASS=your-xnat-password
    
  3. Access to an XNAT server with at least one project.

Basic Example: Running dcm2nifti

This example shows how to convert DICOM files to NIfTI format for a specific subject.

Python API

from pathlib import Path
import xnattools as xt

tools = [xt.Dcm2niftiSettings()]
settings = xt.GeneralSettings(
    system_url="https://xnat.example.com",
    project_id="MY_XNAT_PROJECT",
    subjects=["SUBJECT_001"],
    output_dir=Path.cwd(),
)
xt.run_tools(tools_to_run=tools, general_settings=settings)

Command Line

xnattools dcm2nifti https://xnat.example.com YOUR_PROJECT_ID \
    --subjects SUBJECT_001

Replace YOUR_PROJECT_ID with your actual XNAT project ID and SUBJECT_001 with a valid subject ID from your project.

To use a custom output directory for intermediate files:

Python API

from pathlib import Path
import xnattools as xt

tools = [xt.Dcm2niftiSettings()]
settings = xt.GeneralSettings(
    system_url="https://xnat.example.com",
    project_id="MY_XNAT_PROJECT",
    subjects=["SUBJECT_001"],
    output_dir=Path.cwd(),
)
xt.run_tools(tools_to_run=tools, general_settings=settings)

Command Line

xnattools dcm2nifti https://xnat.example.com YOUR_PROJECT_ID \
    --subjects SUBJECT_001 \
    --output-dir /path/to/temp

Authors

Metadata

Release files for xnattools 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for xnattools 1.1.0
File Size Uploaded Provenance Actions
xnattools-1.1.0.tar.gz 50.4 kB Without provenance Details for xnattools-1.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for xnattools 1.1.0
File Interpreter ABI Platform Actions
xnattools-1.1.0-py3-none-any.whl Python 3 none any Details for xnattools-1.1.0-py3-none-any.whl

Total release size: 112.7 kB

Release files / xnattools-1.1.0.tar.gz

Download URL xnattools-1.1.0.tar.gz
Size 50.4 kB
Tags Source
SHA-256 checksum
How to use checksums
ea4aba1fae60c4853758631c841844497ab0cd024f1a60bce9cb9de9ceb9cf52
BLAKE2b-256 checksum
How to use checksums
f9532b323786b7c3ed08f9bd5a13fd9a77d66285a1ba8d47e0b253471f0b52ff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.18

Release files / xnattools-1.1.0-py3-none-any.whl

Download URL xnattools-1.1.0-py3-none-any.whl
Size 62.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0fd9d59d09dc8fc545f775e5906aa93d58faedcfb66a508bcdf12abf887bc3df
BLAKE2b-256 checksum
How to use checksums
16f61a16e35461cbc12cd746ae0448192f8fe034f12b8a0df802c1c7688e5632
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.18

Security for xnattools 1.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page