Skip to main content

pyfroc

Python framework for FROC/AFROC analysis

Table of contents

About

What pyfroc does

  • Improve the FROC/AFROC analysis process.
  • Manage responses of raters.
    • The responses can be made using segmentation tools (e.g., 3D Slicer).
    • You can use your tool if you write a loader class inheriting BaseLoader class.
  • Evaluate responses and devide them into true positive or false positive automatically.
    • Using built-in module, the responses within the paired lesion approximated as a sphere is regarded as true positive, otherwise false positive.
  • Build a .xlsx file for the RJafroc, a R library which runs statistical tests of AFROC (alternative Free-response receiver operating characteristic) analysis.
  • Write images of responses with paired lesions (if exists).

What pyfroc doesn't

  • Statistical analysis of JAFROC. This is out of scope of pyfroc. Use RJafroc for statistical analysis.
  • FROC/AFROC analysis including multi-modality references because pyfroc doesn't implement an algorithm to match intermodality lesions.

Use case

pyfroc is designed for specific scenarios of FROC/AFROC analysis. pyfroc itself supports only one modality for reference lesions. If you want to compare two modality using two reference modality, run pyfroc for each reference modality, write .xlsx files for RJafroc, and combine the two .xlsx file manually.

Here are the sample scenarios.

Scenario #1

  • Compare detection performance between radiologists with and without AI
  • The responses will be recored on the same series of DICOM images for radiologists with and without AI.

Scenario #2

  • Compare a standard MRI protocol with an abbreviated protocol in terms of lesion detection.
  • The responses will be recored on the same series of DICOM images for both protocols.

Scenario #3

  • Compare images reconstructed using an advanced method with images reconstructed using conventional method in terms of the lesion detectability.
  • Using either series to record responses.

Instalation

Run the command below in your terminal.

pip install pyfroc

Sample code (CLI)

# Install pyfroc
pip install pyfroc

# Prepare dicrectories for an experiment
pyfroc prepare --dicom-dir ./dicom --num-of-raters 2 --num-of-modalities 2

# Record responses of the raters using 3D Slicer
# See the turorial 2 for details

# Read the responses and create rjafroc_input.xlsx file for RJafroc analysis
pyfroc evaluate --out-format rjafroc_xlsx --write-img --dicom-dir •/dicom

# Run AFROC statistical analysis using the RJafroc
RScript samples/afroc_analysis.R

Sample code (Python)

from pyfroc.loaders.simple_loader import (
    SimpleLoader,
    SignalRaw,
    ReferenceRaw,
    ResponseRaw
)
from pyfroc.raters import WithinLesionRater
from pyfroc.writers import RJAFROCWriter

# Prepare your data
case_list = []

case_list.append((
    ReferenceRaw(
        case_id="case1",
        modality_id="modality1",
        signals=[
            SignalRaw(name="signal1", x=1, y=2, z=3, r=4, confidence=0.5),
            SignalRaw(name="signal2", x=5, y=6, z=7, r=8, confidence=0.6),
        ]
    ),
    ResponseRaw(
        rater_id="rater1",
        case_id="case1",
        modality_id="modality1",
        signals=[
            SignalRaw(name="signal1", x=1, y=2, z=3, r=4, confidence=0.5),
            SignalRaw(name="signal2", x=5, y=6, z=7, r=8, confidence=0.6),
        ]
    )
))

# Create a loader
loader = SimpleLoader(case_list)

# Create a rater
rater = WithinLesionRater(loader)

# Write the result to a file
RJAFROCWriter.write("rjarcox_input.xlsx", rater)

Tutorials

1. Demonstration using sample data

This tutorial demostrates a walkthrough of AFROC analysis using the pyfroc framework.

See ./samples/tutorial1.ipynb

2. Perform an AFROC experiment

In this tutorial, you will perform an AFROC analysis using the pyfroc framework with your DICOM images.

See ./samples/tutorial2.ipynb

3. How to modify behavior in pyfroc

If you want to modify behavior in pyfroc other than CLI options, you can write your own class inheriting base class to make new behavior.

See ./samples/tutorial3.ipynb

Author

Satoshi Funayama (@akchan)

Department of Radiology, Hamamatsu University School of Medicine, Shizuoka, Japan

License

GPLv3

Metadata

Release files for pyfroc 0.3.5

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

Source distribution (sdist)

Source distribution for pyfroc 0.3.5
File Size Uploaded Provenance Actions
pyfroc-0.3.5.tar.gz 3.6 MB Without provenance Details for pyfroc-0.3.5.tar.gz

Built distribution (wheel)

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

Total release size: 3.7 MB

Release files / pyfroc-0.3.5.tar.gz

Download URL pyfroc-0.3.5.tar.gz
Size 3.6 MB
Tags Source
SHA-256 checksum
How to use checksums
2c7390804e8184316716aed64a5e364341b0df872a5b11cecaed83d2455605c9
BLAKE2b-256 checksum
How to use checksums
7baa7451e21baa5af3d7a0c70a924d777b3cf202bc46ebc401435e145ebfcdd3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-httpx/0.27.0

Release files / pyfroc-0.3.5-py3-none-any.whl

Download URL pyfroc-0.3.5-py3-none-any.whl
Size 79.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
49e1c626fe532d0ef57aea4426b9ce047d7a95ffdcceea44fbc1202fb36ab0d8
BLAKE2b-256 checksum
How to use checksums
d210588e76baee29e9a34889c0b3beb0aa72dc811b6520ecba62534d05183456
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-httpx/0.27.0

Security for pyfroc 0.3.5

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