Metadata-Version: 2.4
Name: cxas
Version: 0.1.2
Summary: Anatomy segmentation (159+ structures) and named landmarks for chest X-rays, with DICOM SEG/SR output.
Home-page: https://github.com/ConstantinSeibold/ChestXRayAnatomySegmentation
Author: Constantin Seibold
Author-email: constantin.seibold2@uk-essen.de
License: MIT
Keywords: chest x-ray anatomy segmntation pytorch
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: Programming Language :: Python
Classifier: Topic :: Scientific/Engineering
Classifier: Operating System :: Unix
Classifier: License :: OSI Approved :: MIT License
Requires-Python: >=3.10
Description-Content-Type: text/x-rst
License-File: LICENSE.txt
Requires-Dist: cython
Requires-Dist: torch
Requires-Dist: gdown
Requires-Dist: torchvision
Requires-Dist: numpy
Requires-Dist: SimpleITK
Requires-Dist: pydicom>=3.0.1
Requires-Dist: highdicom>=0.25
Requires-Dist: pylibjpeg>=2.0
Requires-Dist: pylibjpeg-openjpeg>=2.3
Requires-Dist: safetensors
Requires-Dist: huggingface_hub
Requires-Dist: transformers>=5.9
Requires-Dist: scipy
Requires-Dist: pyyaml
Requires-Dist: scikit-image
Requires-Dist: scikit-learn
Requires-Dist: opencv-python
Requires-Dist: colorcet
Requires-Dist: matplotlib
Requires-Dist: Pillow
Requires-Dist: pycocotools
Requires-Dist: pandas
Requires-Dist: tqdm
Provides-Extra: radiomics
Requires-Dist: pyradiomics==3.0.1; extra == "radiomics"
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: keywords
Dynamic: license
Dynamic: license-file
Dynamic: provides-extra
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

================================
Chest X-Ray Anatomy Segmentation
================================

--------------
Installation
--------------

The project is available in PyPI. To install run:

``pip install cxas``

Models (weights download on first use from https://huggingface.co/cmseibold/cxas-models and
https://huggingface.co/cmseibold/cxr-landmarks, MIT licence):

* ``UNet_ResNet50_default``: the original CXAS model, 159 structures (default of ``CXAS()``).
* ``M2F_anatomy_v2`` (new in 0.1): Mask2Former anatomy models, one per view (frontal: 187 structures,
  lateral: 177), at native image resolution; the view is read from DICOM or detected.
* Named landmarks (new in 0.1): 132 clinically curated landmark definitions, 311 view-specific
  structure-landmark pairs (``cxas.landmarks.LandmarkDetector``).

--------------------------------------------
DICOM in, DICOM SEG + SR out (new in 0.1)
--------------------------------------------

``cxas_idc -i {DICOM file or directory} -o {output directory}``

Per radiograph: one multi-segment DICOM SEG, a TID 1500 Structured Report with the landmarks, and a
``result.json``. Uses the GPU when available (``-g auto``). Docker images: ``cseibold/cxas:0.1.2-cu128``
(GPU or CPU) and ``cseibold/cxas:0.1.2-cpu``.


--------------------------------------
Running Segmentation from terminal
--------------------------------------

Segment the anatomy of X-Ray images \(.jpg,.png,.dcm\) and store the results \(npy,json,jpg,png,dicom-seg\):

```
cxas_segment -i {desired input directory or file} -o {desired output directory}
```

------------------------------------------
Running Feature Extraction from terminal
------------------------------------------

Extract anatomical features from X-Ray images \(.jpg,.png,.dcm\) and store the results \(.csv\):

``cxas_feat_extract -i {desired input directory or file} -o {desired output directory} -f {desired features to extract}``

----------------------------
Running either from terminal
----------------------------

Extract anatomical features from X-Ray images \(.jpg,.png,.dcm\) and store the results \(.csv\):

``cxas -i {desired input directory or file} -o {desired output directory} -mode {"segment" or "exract"} -f {required if mode == 'extract'}``



--------------
Citation
--------------

If you use this work or dataset, please cite:

.. code:: bibtex

    @inproceedings{Seibold_2022_BMVC,
        author    = {Constantin Marc Seibold and Simon Reiß and M. Saquib Sarfraz and Matthias A. Fink and Victoria Mayer and Jan Sellner and Moon Sung Kim and Klaus H. Maier-Hein and Jens Kleesiek and Rainer Stiefelhagen},
        title     = {Detailed Annotations of Chest X-Rays via CT Projection for Report Understanding},
        booktitle = {33rd British Machine Vision Conference 2022, {BMVC} 2022, London, UK, November 21-24, 2022},
        publisher = {{BMVA} Press},
        year      = {2022},
        url       = {https://bmvc2022.mpi-inf.mpg.de/0058.pdf}
    }
    
.. code:: bibtex

    @inproceedings{Seibold_2023_CXAS,
        author    = {Constantin Seibold, Alexander Jaus, Matthias Fink,
        Moon Kim, Simon Reiß, Jens Kleesiek*, Rainer Stiefelhagen*},
        title     = {Accurate Fine-Grained Segmentation of Human Anatomy in Radiographs via Volumetric Pseudo-Labeling},
        year      = {2023},
    }
