Skip to content

Commit ac60836

Browse files
committed
ruff
1 parent 58b4a75 commit ac60836

4 files changed

Lines changed: 11 additions & 7 deletions

File tree

example.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,9 @@ def run_example(
6969
print("Extracted features:")
7070
for fk, fv in features.items():
7171
if isinstance(fv, list):
72-
fv = f"{round(np.mean(fv), 3)} +- {round(np.std(fv), 3)}"
72+
fvv = f"{round(np.mean(fv), 3)} +- {round(np.std(fv), 3)}"
7373
elif isinstance(fv, float):
74-
fv = round(fv, 3)
75-
print(f"{fk}: {fv}")
74+
fvv = round(fv, 3)
75+
else:
76+
fvv = fv
77+
print(f"{fk}: {fvv}")

src/calc_label_thickness.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def compute_boundary_normals(seg, label1, label2):
6969
kernel[0, 1, 1] = kernel[2, 1, 1] = 1
7070

7171
# Convolve class 1 with kernel to count neighbors
72-
neighbors_of_class1 = convolve(class1.astype(int), kernel, mode="constant")
72+
# neighbors_of_class1 = convolve(class1.astype(int), kernel, mode="constant")
7373

7474
# Find class 1 voxels that are adjacent to class 2
7575
touching_mask = np.logical_and(class1, convolve(class2.astype(int), kernel, mode="constant") > 0)
@@ -137,7 +137,7 @@ def raymarch_until_background(
137137
# mask_value = interpolator(coords)
138138
# return mask_value > 0.5
139139

140-
for step in range(max_steps):
140+
for _step in range(max_steps):
141141
if max_distance is not None:
142142
dist = np.linalg.norm(pos - start_coord)
143143
if dist >= max_distance:

src/inference_function.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from pathlib import Path
2+
13
import numpy as np
24
from spineps.seg_enums import OutputType
35
from spineps.seg_model import Segmentation_Model

src/load_model.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ def load_model(model: str | Path | int) -> Segmentation_Model:
2727
raise TypeError("Model must be a string, Path, or integer.")
2828

2929

30-
def load_model_by_path(dir: str | Path) -> Segmentation_Model:
30+
def load_model_by_path(path_dir: str | Path) -> Segmentation_Model:
3131
"""Load a model from a specified directory."""
32-
return get_actual_model(in_config=dir).load()
32+
return get_actual_model(in_config=path_dir).load()
3333

3434

3535
def load_model_by_version(version: int) -> Segmentation_Model:

0 commit comments

Comments
 (0)