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:
-
Installed
xnattools. For example using pip:pip install xnattools
-
Set up your XNAT credentials using one of these methods:
Option 1: Using
.netrcfile (recommended)Create or edit
~/.netrcwith your XNAT credentials:machine xnat.example.com login your-xnat-username password your-xnat-password
Option 2: Using
.env.localfileCreate a
.env.localfile in your project directory:XNAT_USER=your-xnat-username XNAT_PASS=your-xnat-password
-
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.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| xnattools-1.1.1.tar.gz | 50.5 kB | Without provenance | Details for xnattools-1.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| xnattools-1.1.1-py3-none-any.whl | Python 3 | none | any | Details for xnattools-1.1.1-py3-none-any.whl |
Total release size: 112.8 kB
Release files / xnattools-1.1.1.tar.gz
| Download URL | xnattools-1.1.1.tar.gz |
|---|---|
| Size | 50.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1ad757d6ed5c9fd8590ea632d6dadac45b86948d1a9665d7c8eb9278e2999488
|
|
BLAKE2b-256 checksum How to use checksums |
b54607909611b9a17119f16c329e37393bc1a8a4946aae1f8fe529361a72b1df
|
| 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.1-py3-none-any.whl
| Download URL | xnattools-1.1.1-py3-none-any.whl |
|---|---|
| Size | 62.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bff1c4d7e05f24fecab691917f6d22f2821d8c2484762470bfefe003a949eb4a
|
|
BLAKE2b-256 checksum How to use checksums |
8815773658fc25266c25df521ba2cdb7f9d28c5ec572fa498ddd7e73426a1145
|
| 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.1
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.