Skip to content

Commit

Permalink
fix: 🐛 Able to handle OPTOS PSEUDOCOLOUR_ULTRAWIDEFIELD modality
Browse files Browse the repository at this point in the history
  • Loading branch information
alanwilter committed Nov 12, 2024
1 parent 96f89bd commit 728cc86
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ repos:
- id: check-shebang-scripts-are-executable
- id: check-added-large-files
args:
- "--maxkb=10000"
- "--maxkb=12000"
# - id: debug-statements # not for process_dcm
- id: check-yaml
exclude: mkdocs.yml
Expand Down
6 changes: 6 additions & 0 deletions process_dcm/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ class ImageModality(Enum):

FACE_PHOTO = ("FACE", "Face photo", ModalityFlag.IS_2D_IMAGE | ModalityFlag.IS_ANTERIOR | ModalityFlag.SENSITIVE)

PSEUDOCOLOUR_ULTRAWIDEFIELD = (
"PCUWF",
"Pseudocolour Ultra-widefield",
ModalityFlag.IS_2D_IMAGE | ModalityFlag.IS_INTERIOR | ModalityFlag.IS_COLOUR,
)

# VF-related modalities
FDF = ("FDF", "Flicker Defined Form Perimetry")
SAP = ("SAP", "Standard Automated Perimetry")
Expand Down
2 changes: 2 additions & 0 deletions process_dcm/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,8 @@ def update_modality(dcm: FileDataset) -> bool:
elif dcm.Modality == "OP":
if dcm.Manufacturer.upper() == "TOPCON":
dcm.Modality = ImageModality.COLOUR_PHOTO
elif dcm.Manufacturer.upper() == "OPTOS" and dcm.HorizontalFieldOfView == 200:
dcm.Modality = ImageModality.PSEUDOCOLOUR_ULTRAWIDEFIELD
elif " IR" in dcm.get("SeriesDescription", ""):
dcm.Modality = ImageModality.SLO_INFRARED
elif " BAF " in dcm.get("SeriesDescription", ""):
Expand Down
Binary file added tests/example-optos/fundus.dcm
Binary file not shown.
15 changes: 15 additions & 0 deletions tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,21 @@ def test_process_task():
assert result == ("0780320450", "bbff7a25-d32c-4192-9330-0bb01d49f746")


def test_process_task_optos():
with TemporaryDirectory() as tmpdirname:
output_dir = Path(tmpdirname)
task_data = ("tests/example-optos/", str(output_dir))
image_format = "png"
overwrite = True
verbose = True
keep = ""
mapping = ""
group = True
tol = 2
result = process_task(task_data, image_format, overwrite, verbose, keep, mapping, group, tol)
assert result == ("0570586923", "BEH002")


# def test_process_taskL():
# with TemporaryDirectory() as tmpdirname:
# output_dir = Path(tmpdirname)
Expand Down

0 comments on commit 728cc86

Please sign in to comment.