Skip to main content

pyDICOS

License run-tests codecov PyPI PyPI - Downloads

Motivations

This project was initiated to enable the usage of DICOS data in machine learning workflows. PyDICOS is intended to be a simple python wrapper of Stratovan's C++ DICOS library. Note that this is NOT an open source implementation of the DICOS standard.

PyDICOS relies on pybind11 to wrap DICOS user-level API to python. It depends on NumPy to load data in python and can easily be installed via pip.

PyDICOS is unrelated to pydicom in its implementation and contributors, while being similar in its core spirit (enabling python data manipulations).

Open Architecture

We firmly believe that by releasing this library, we will encourage and support the Open Architecture framework. We welcome all actors of airport security to review and use this library.

Scope

  • Provide a Pythonized API for the DICOS toolkit
    • First release : read/write functions for CT, DX and TDR, user-level API
    • First releases : DICOS protocol, client/server functions
    • Future release : more pure python functions to shave off heavy CPP signatures (dcsread, dcswrite, get_data, set_data and CT::generate_tdr)
    • Future release : library indexed in PyPi
    • Out of scope for now : Windows release
    • Out of scope for now : AIT2D, AIT3D, QR
    • Out of scope for now : Module and Tag level APIs
  • Stay up to date with Stratovan latest releases
    • Currently tested and supported DICOS version : v3

Install

✨ NEW ✨ : pyDICOS is now available for windows

Using PyPi index (recommended)

Using pip directly from PyPi index :

pip install pydicos

⚠️ pyDICOS is currently available for Linux on x86 and windows on x64 platforms

Building from source (dev mode)

To setup the build environment, clone the repository, create your virtual environment and install required dependencies

git clone https://github.com/Auxilia-tech/pyDICOS
cd pyDICOS
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt

Install the Stratovan toolkit in the opt folder. If the library is already installed in another folder, skip this step and change the SDICOS path variable in setup.sh.

chmod +x ./sdicos_lin_ubuntu-20-{version}.run
./sdicos_lin_ubuntu-20-{version}.run --unattendedmodeui none --mode unattended --prefix /opt/stratovan/sdicos
chmod 755 -R /opt/stratovan/sdicos

To generate a python wheel :

chmod +x setup.sh
./setup.sh

The lib wheel should be produced in the dist folder and can be installed via pip in any local virtual environment.

Usage

Concept diagram

Script usage

Refer to our example files to explore the bound methods. The Stratovan example files were entirely translated in python.

Here is a quick example for a script that reads and rewrites a CT and DX scan, and a TDR.

from pydicos import dcsread, dcswrite

ct = dcsread("SimpleCT/SimpleCT.dcs")
data = ct.get_data() # list of 3-dimentionnal numpy arrays
dcswrite(ct, "SimpleCT/SimpleCT_2.dcs")

dx = dcsread("DXFiles/SimpleDX.dcs")
data = dx.get_data() # 2-dimentionnal numpy array
dcswrite(dx, "DXFiles/SimpleDX_2.dcs")

tdr = dcsread("SimpleTDR/SimpleTDR.dcs")
data = tdr.get_data() # dictionnay of metadata
dcswrite(tdr, "SimpleTDR/SimpleTDR_2.dcs")

✨ NEW ✨ : refer to our notebook tutorial for instructions and examples to change an object main attribute.

Advanced usage

More complex operations can be addressed by using the C++ functions directly. They can be invoked using the pyDICOS modules. For example, the previous script would look like this :

from pyDICOS import CT, DX, TDR, ErrorLog, Filename
   
ct, err, file = CT(), ErrorLog(), Filename("SimpleCT/SimpleCT.dcs")
if not ct.Read(file, err, None):
   raise RuntimeError(f"Failed to read DICOS file: {file.Get()}\n{err.GetErrorLog().Get()}")
data = ... # This is very long, refer to pydicos._loaders::CTLoader.get_data for full script
if not ct.Write(Filename("SimpleCT/SimpleCT_2.dcs"), err):
   raise RuntimeError(f"Failed to write DICOS file: SimpleCT/SimpleCT_2.dcs\n{err.GetErrorLog().Get()}")

dx, err, file = DX(), ErrorLog(), Filename("SimpleDX/SimpleDX.dcs")
if not dx.Read(file, err, None):
   raise RuntimeError(f"Failed to read DICOS file: {file.Get()}\n{err.GetErrorLog().Get()}")
data = np.array(dx.GetXRayData().GetUnsigned16(), copy=False)
if not dx.Write(Filename("SimpleDX/SimpleDX_2.dcs"), err):
   raise RuntimeError(f"Failed to write DICOS file: SimpleDX/SimpleDX_2.dcs\n{err.GetErrorLog().Get()}")

tdr, err, file = TDR(), ErrorLog(), Filename("SimpleTDR/SimpleTDR.dcs")
if not tdr.Read(file, err, None):
   raise RuntimeError(f"Failed to read DICOS file: {filename}\n{err.GetErrorLog().Get()}")
data = ... # This is very long, refer to pydicos._loaders::TDRLoader.get_data for full script
if not tdr.Write(Filename("SimpleTDR/SimpleTDR_2.dcs"), err):
   raise RuntimeError(f"Failed to write DICOS file: SimpleTDR/SimpleTDR_2.dcs\n{err.GetErrorLog().Get()}")

As you can see, pyDICOS is the direct translation of the C++ classes and in-place method signatures. The objects of the pydicos library inherit the methods available in pyDICOS. More details in architecture.

Testing

The library can be tested via pytest

pytest tests/

Note for Linux Users: If your system clock is set to local time, you may need to export the TZ environment variable to UTC before running tests.

export TZ=UTC

Contributing

As our resources are limited, we very much value your contributions, be it bug fixes, new core features, or documentation improvements. For more information, please read our contribution guide.

Contributors acknowledgement

Many thanks to our main contributors :

  • Ahmad Audi is a freelance developer specialized in C++ and python. He is available for similar work on upwork. LinkedIn
  • Louis Combaldieu is the cofounder and CTO of Auxilia. He specializes in deep learning and computer vision. Get in touch with him through our contact form to learn more about pyDICOS and Auxilia's line of products.

License

This software is released under the MIT license.

Stratovan inherited disclaimer

##############################################################################
### Stratovan Corporation Copyright and Disclaimer Notice:
###
### Copyright (c) 2014 Stratovan Corporation. All Rights Reserved.
###
### Permission to use, copy, modify, and distribute this software and its
### documentation without a signed licensing agreement, is hereby granted,
### provided that this copyright notice, this paragraph and the following two
### paragraphs appear in all copies, modifications, and distributions.
###
### IN NO EVENT SHALL STRATOVAN BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
### SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
### ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
### STRATOVAN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
###
### STRATOVAN SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED
### TO, THE IMPLIED WARRANTIES OF USE AND FITNESS FOR A PARTICULAR PURPOSE. THE
### SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED HEREUNDER IS
### PROVIDED "AS IS". STRATOVAN HAS NO OBLIGATION TO PROVIDE MAINTENANCE,
### SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS UNLESS DIRECTED BY THE
### U.S. GOVERNMENT'S TRANSPORTATION SECURITY ADMINISTRATION (TSA).
###
##############################################################################

Release files for pydicos 1.3.0

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

Built distributions (wheels)

Table of built distributions (wheels) for pydicos 1.3.0
File
pydicos-1.3.0-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details
pydicos-1.3.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 Details
pydicos-1.3.0-cp310-cp310-win_amd64.whl CPython 3.10 CPython 3.10 Windows x86-64 Details
pydicos-1.3.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 Details
pydicos-1.3.0-cp39-cp39-win_amd64.whl CPython 3.9 CPython 3.9 Windows x86-64 Details
pydicos-1.3.0-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.9 CPython 3.9 Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 Details
pydicos-1.3.0-cp38-cp38-win_amd64.whl CPython 3.8 CPython 3.8 Windows x86-64 Details
pydicos-1.3.0-cp38-cp38-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.8 CPython 3.8 Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 Details
pydicos-1.3.0-cp37-cp37m-win_amd64.whl CPython 3.7 CPython 3.7 pymalloc Windows x86-64 Details
pydicos-1.3.0-cp37-cp37m-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 Details

Total release size: 45.5 MB

Release files / pydicos-1.3.0-cp311-cp311-win_amd64.whl

Download URL pydicos-1.3.0-cp311-cp311-win_amd64.whl
Size 3.4 MB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
053611850d35eccb64595c69e57caee209dd0a012e03a27988cb5244bf4dc1ce
BLAKE2b-256 checksum
How to use checksums
52ad260f3ac54cdf921c9b3ee640260b3950b5eace421a0899a216a541747d21
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.8

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 20, 2025.

Transparency log

Release files / pydicos-1.3.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL pydicos-1.3.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 5.7 MB
Tags CPython 3.11 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
83b2f012cb4ee89cf140c43054d54d5187f3cc13d258c58a8998ab821f2473fc
BLAKE2b-256 checksum
How to use checksums
176715c9f431f6f0f05e1d73a9cba1317123af0d6c4433672dfb1d4afcdaaafa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.8

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 20, 2025.

Transparency log

Release files / pydicos-1.3.0-cp310-cp310-win_amd64.whl

Download URL pydicos-1.3.0-cp310-cp310-win_amd64.whl
Size 3.4 MB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
6d285c7942bd45ab9fa4f2cec4e04614ba43a2cb691227f86d27a11802407220
BLAKE2b-256 checksum
How to use checksums
54e4371d0cb827a032920988614fa166b1d4c34322320c8a134303610e145de2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.8

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 20, 2025.

Transparency log

Release files / pydicos-1.3.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL pydicos-1.3.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 5.7 MB
Tags CPython 3.10 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
d9bcce251f1016b9ccfda4236f4942719538b96bbc1c72cb0e49077aeec109b2
BLAKE2b-256 checksum
How to use checksums
5eb554a64e2d2b4894de7eb7f343cf6a603a252cb1bdc0be87ab4edd7824a492
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.8

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 20, 2025.

Transparency log

Release files / pydicos-1.3.0-cp39-cp39-win_amd64.whl

Download URL pydicos-1.3.0-cp39-cp39-win_amd64.whl
Size 3.5 MB
Tags CPython 3.9 Windows x86-64
SHA-256 checksum
How to use checksums
c2ee008c974db12e041ed8d9c7fcbf1a46954505bf6fd2535cb050769afa0d16
BLAKE2b-256 checksum
How to use checksums
0d80e64d2a75a9d8c18d2b2c13018500afd6f9813e3b4f6446f0a0f56b5ad492
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.8

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 20, 2025.

Transparency log

Release files / pydicos-1.3.0-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL pydicos-1.3.0-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 5.7 MB
Tags CPython 3.9 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
1bbbcc8ad96ce49b644d57a5df9a888f997fb9ca7c6bf6323f24103cfeba885e
BLAKE2b-256 checksum
How to use checksums
f06c8c2377fc028427f2774390948e67c1a02bf230f59d2c34fce2f4c262ed83
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.8

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 20, 2025.

Transparency log

Release files / pydicos-1.3.0-cp38-cp38-win_amd64.whl

Download URL pydicos-1.3.0-cp38-cp38-win_amd64.whl
Size 3.4 MB
Tags CPython 3.8 Windows x86-64
SHA-256 checksum
How to use checksums
6af86f3867a1f6b11bc01156be8f033314c617fd7592d5b8ee401806a082ad48
BLAKE2b-256 checksum
How to use checksums
f7c32a3779065e0f5b81ad95d61196fb3e71aa54c14ddfcac5bb7e115dcd4450
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.8

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 20, 2025.

Transparency log

Release files / pydicos-1.3.0-cp38-cp38-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL pydicos-1.3.0-cp38-cp38-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 5.7 MB
Tags CPython 3.8 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
4cfc69aeaffbf2d8505d0b23b9efa722de3e60b540cdbc9206dcd04405103084
BLAKE2b-256 checksum
How to use checksums
1d0345244af51becbe50be9956e9388a9565177c29a02377df772f93bc2e8318
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.8

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 20, 2025.

Transparency log

Release files / pydicos-1.3.0-cp37-cp37m-win_amd64.whl

Download URL pydicos-1.3.0-cp37-cp37m-win_amd64.whl
Size 3.4 MB
Tags CPython 3.7 CPython 3.7 pymalloc Windows x86-64
SHA-256 checksum
How to use checksums
bc8994ea0f48f865b4fb86b25c75a6a5945cee6f37495e293614feb02d583b5c
BLAKE2b-256 checksum
How to use checksums
34d49e49e16ecb9e93eefa0d2eb79c7b18cf9e24794b095cf16f96af8bb31c0f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.8

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 20, 2025.

Transparency log

Release files / pydicos-1.3.0-cp37-cp37m-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL pydicos-1.3.0-cp37-cp37m-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 5.8 MB
Tags CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
67bcdcd25f5c7d23c260e264735b85607f95ec1a47b37bb91cd48b02667be08f
BLAKE2b-256 checksum
How to use checksums
0af66a70d094c0449f5fef0b18ac6b9e4e9a1fbcd39ab798b4dfb08c6790de6d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.8

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 20, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

1.3.0 This release

10 release files

1.2.9

10 release files

1.2.8

5 release files

1.2.7

5 release files

1.2.6

5 release files

1.2.5

5 release files

1.2.4

5 release files

1.2.3

5 release files

1.2.2

5 release files

1.2.1

5 release files

1.2.0

5 release files

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