diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c51a27ba..68e7e574 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -22,7 +22,8 @@ jobs: strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] - python-version: ["3.12", "3.11", "3.10"] + python-version: 3.11 + # python-version: ["3.12", "3.11", "3.10"] steps: - uses: actions/checkout@v3 diff --git a/examples/radcure_simple.py b/examples/radcure_simple.py index cbb74810..943941d1 100644 --- a/examples/radcure_simple.py +++ b/examples/radcure_simple.py @@ -114,7 +114,7 @@ def process_one_subject(self, subject_id): image = self.image_input(subject_id).image - structure_set = self.structure_set_input(subject_id) + structure_set = self.structure_set_input(subject_id) # noqa: F841 dose_set = self.rtdose_input(subject_id) pet_set = self.petscan_input(subject_id) diff --git a/src/imgtools/autopipeline.py b/src/imgtools/autopipeline.py index 10eec238..0937e009 100644 --- a/src/imgtools/autopipeline.py +++ b/src/imgtools/autopipeline.py @@ -474,7 +474,7 @@ def process_one_subject(self, subject_id): if conn_to == "CT" or conn_to == "MR": img = image elif conn_to == "PT": - img = pet + img = pet # noqa: F821 mask = self.make_binary_mask(structure_set, img, self.existing_roi_indices, diff --git a/src/imgtools/image.py b/src/imgtools/image.py index 31504b46..d8a6f2e0 100644 --- a/src/imgtools/image.py +++ b/src/imgtools/image.py @@ -124,9 +124,6 @@ def geometry(self): direction=self.direction, spacing=self.spacing) - @property - def size(self): - return self._image.GetSize()[::-1] @property def ndim(self): diff --git a/src/imgtools/io/dataset.py b/src/imgtools/io/dataset.py index c794293c..bfe746c3 100644 --- a/src/imgtools/io/dataset.py +++ b/src/imgtools/io/dataset.py @@ -174,7 +174,7 @@ def process_one_subject( if conn_to == "CT": mask = make_binary_mask(structure_set, image) elif conn_to == "PT": - mask = make_binary_mask(structure_set, pet) + mask = make_binary_mask(structure_set, pet) # noqa: F821 else: raise ValueError("You need to pass a reference CT or PT/PET image to map contours to.") temp[f"mod_{colname}"] = tio.LabelMap.from_sitk(mask) diff --git a/src/imgtools/io/writers.py b/src/imgtools/io/writers.py index 0cd08e11..8301a0cb 100644 --- a/src/imgtools/io/writers.py +++ b/src/imgtools/io/writers.py @@ -119,7 +119,7 @@ def put(self, subject_id, mask, **kwargs): origin = mask.GetOrigin() spacing = mask.GetSpacing() - direction = mask.GetDirection() + direction = mask.GetDirection() # noqa: F841 space = "left-posterior-superior" # everything is ITK read/write diff --git a/src/imgtools/modules/datagraph.py b/src/imgtools/modules/datagraph.py index e49d8c9a..85beb4a2 100644 --- a/src/imgtools/modules/datagraph.py +++ b/src/imgtools/modules/datagraph.py @@ -267,7 +267,7 @@ def parser(self, query_string: str) -> pd.DataFrame: ''' # Basic processing of just one modality supp_mods = ["RTDOSE", "RTSTRUCT", "CT", "PT", 'MR', 'SEG'] - edge_def = {"RTSTRUCT,RTDOSE" : 0, "CT,RTDOSE" : 1, "CT,RTSTRUCT" : 2, "PET,RTSTRUCT" : 3, "CT,PT" : 4, 'MR,RTSTRUCT': 2, "RTPLAN,RTSTRUCT": 6, "RTPLAN,RTDOSE": 5, "CT,SEG": 7, "MR,SEG": 7, "MR,RTSTRUCT": 2} + edge_def = {"RTSTRUCT,RTDOSE" : 0, "CT,RTDOSE" : 1, "CT,RTSTRUCT" : 2, "PET,RTSTRUCT" : 3, "CT,PT" : 4, 'MR,RTSTRUCT': 2, "RTPLAN,RTSTRUCT": 6, "RTPLAN,RTDOSE": 5, "CT,SEG": 7, "MR,SEG": 7} self.mods = query_string.split(",") self.mods_n = len(self.mods) diff --git a/src/imgtools/ops/ops.py b/src/imgtools/ops/ops.py index 32b075fa..16b0790d 100644 --- a/src/imgtools/ops/ops.py +++ b/src/imgtools/ops/ops.py @@ -100,7 +100,7 @@ def __init__(self, import json with open(tree_crawl_path, 'r') as f: - tree_db = json.load(f) # currently unused, TO BE implemented in the future + tree_db = json.load(f) # currently unused, TO BE implemented in the future # noqa: F841 # GRAPH # ----- @@ -1636,7 +1636,7 @@ def get_mask(self, reference_image, seg, mask, label, idx, continuous): mask[:,:,:,idx] += seg[:,:,:,idx_seg] else: # if 2D segmentations on 3D images frame = seg.frame_groups[idx_seg] - ref_uid = frame.DerivationImageSequence[0].SourceImageSequence[0].ReferencedSOPInstanceUID # unused but references InstanceUID of slice + ref_uid = frame.DerivationImageSequence[0].SourceImageSequence[0].ReferencedSOPInstanceUID # unused but references InstanceUID of slice # noqa: F841 frame_coords = np.array(frame.PlanePositionSequence[0].ImagePositionPatient) img_coords = physical_points_to_idxs(reference_image, np.expand_dims(frame_coords, (0, 1)))[0][0] z = img_coords[0] diff --git a/src/imgtools/utils/nnunet.py b/src/imgtools/utils/nnunet.py index 7e8d63cb..1ed2bcc0 100644 --- a/src/imgtools/utils/nnunet.py +++ b/src/imgtools/utils/nnunet.py @@ -41,7 +41,7 @@ def subfiles(folder: str, join: bool = True, prefix: str = None, suffix: str = N if join: path_fn = os.path.join else: - path_fn = lambda x, y: y + path_fn = lambda x, y: y # noqa: E731 res = [path_fn(folder, i) for i in os.listdir(folder) if os.path.isfile(os.path.join(folder, i)) and (prefix is None or i.startswith(prefix)) and (suffix is None or i.endswith(suffix))] diff --git a/tests/dataset_check.py b/tests/dataset_check.py index f81567ef..64598068 100644 --- a/tests/dataset_check.py +++ b/tests/dataset_check.py @@ -37,7 +37,7 @@ def dataset_path(): #Defining paths for autopipeline and dataset component crawl_path = pathlib.Path(imgtools_path, f"imgtools_{dataset_name}.csv").as_posix() - json_path = pathlib.Path(imgtools_path, f"imgtools_{dataset_name}.json").as_posix() + json_path = pathlib.Path(imgtools_path, f"imgtools_{dataset_name}.json").as_posix() # noqa: F841 edge_path = pathlib.Path(imgtools_path, f"imgtools_{dataset_name}_edges.csv").as_posix() yield quebec_path, output_path, crawl_path, edge_path diff --git a/tests/test_components.py b/tests/test_components.py index e3cf2ac7..007d82a0 100644 --- a/tests/test_components.py +++ b/tests/test_components.py @@ -35,7 +35,7 @@ def dataset_path(): #Defining paths for autopipeline and dataset component crawl_path = pathlib.Path(imgtools_path, f"imgtools_{dataset_name}.csv").as_posix() - json_path = pathlib.Path(imgtools_path, f"imgtools_{dataset_name}.json").as_posix() + json_path = pathlib.Path(imgtools_path, f"imgtools_{dataset_name}.json").as_posix() # noqa: F841 edge_path = pathlib.Path(imgtools_path, f"imgtools_{dataset_name}_edges.csv").as_posix() yield quebec_path, output_path, crawl_path, edge_path