Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/ignored dicoms in config #47

Merged
merged 4 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,16 @@ wahab_labels_dir: "1Felix and Rich make models/Training dataset Tiffs/Training s

# Where random stuff from the scripts should go, relative to the root of the repository
script_output: "script_output/"
boring_script_output: "script_output/boring_stuff/"
boring_script_output: "script_output/boring_stuff/"

# Bad Dicoms
# These ones are in multiple training sets
duplicate_ids:
- 39
# These ones are broken for various reasons
broken_ids:
- 92
- 90
- 69
- 36
- 166
1 change: 0 additions & 1 deletion fishjaw/model/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

import os
import pickle
from math import sqrt
from dataclasses import dataclass
from typing import Type, Any

Expand Down
16 changes: 16 additions & 0 deletions fishjaw/util/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,3 +178,19 @@ def boring_script_out_dir() -> pathlib.Path:
if not retval.is_dir():
retval.mkdir()
return retval


def broken_dicoms() -> set[int]:
"""
Get the IDs of the broken DICOMs

"""
return set(util.config()["broken_ids"])


def duplicate_dicoms() -> set[int]:
"""
Get the IDs of the broken DICOMs

"""
return set(util.config()["duplicate_ids"])
2 changes: 1 addition & 1 deletion scripts/arch_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

import torch
from prettytable import PrettyTable
from monai.networks.nets import attentionunet

from fishjaw.model import model, data
from monai.networks.nets import attentionunet


def count_parameters(net: torch.nn.Module) -> None:
Expand Down
15 changes: 4 additions & 11 deletions scripts/create_dicoms.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,19 +282,12 @@ def main():
"""
config = util.userconf()

# Some might be duplicated between the different sets; we only want
# the whole jaws in this case
duplicates = {39}

# I might know some are broken - this is usually because the label and
# Wahab's TIFF are different shapes. Maybe the 3D tiffs are broken?
broken = {92, 90, 69, 36, 166}

create_set_1(config)
create_set_2(config, ignore=broken)
create_set_2(config, ignore=files.broken_dicoms())

# Ignore the duplicates here
create_set_3(config, ignore=duplicates | broken)
# Some might be duplicated between the different sets; we only want
# the whole jaws in this case
create_set_3(config, ignore=files.broken_dicoms() | files.duplicate_dicoms())


if __name__ == "__main__":
Expand Down
Loading