Skip to content
Open
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
Empty file added src/__init__.py
Empty file.
8 changes: 8 additions & 0 deletions src/data_objs/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,11 @@ def __init__(self, scan_path: str):
self.frame_rate: float # Hz
self.intensities_for_analysis: np.ndarray # linearized intensity values
self.extras_dict: dict = {} # dictionary for any extra information inputted by plugins

# Visualization defaults (Moved from CeusSeg)
self.clahe_clip_limit: float = 1.2
self.gamma: float = 1.5
self.width_scale_axial: float = 1.0
self.width_scale_sagittal: float = 1.0
self.width_scale_coronal: float = 1.0
self.use_philips_ceus: bool = False
1 change: 0 additions & 1 deletion src/data_objs/seg.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,3 @@ class CeusSeg:
def __init__(self):
self.seg_name: str
self.seg_mask: np.ndarray
self.pixdim: List[float] # voxel spacing in mm
Empty file.
2 changes: 2 additions & 0 deletions src/image_preprocessing/functions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from .image_preprocessors.enhance_clahe import enhance_clahe

@davidspector67 davidspector67 Apr 12, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand that this addition is likely used to call from the frontend, but such a connection between the backend and frontend would violate the MVC architecture. I'll look through the frontend PR next but would it be possible to remove this file?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the CLAHE settings have been completely replaced by the P high and P low parameters in Yuanshan’s branch (60-3D-Motion-Compensation).

The main issue is that different developments take time, and merging requests also introduces delays. In the meantime, some features from already developed branches may become outdated, conflict with newer changes, or require rework before integration.

Do you think it would be a good idea to keep this PR open until Yuanshan’s PR is also ready?

from .image_preprocessors.enhance_gamma import enhance_gamma
Comment on lines +1 to +2

Copilot AI Apr 2, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

functions.py only re-exports enhance_clahe/enhance_gamma, but nothing in the repo imports src.image_preprocessing.functions (so this module appears unused) and it omits the other preprocessors in image_preprocessors/. Consider removing it, or making it a deliberate public API by exporting all preprocessors (and/or documenting intended usage) so it doesn't become dead/partial duplication of the dynamic plugin discovery in options.get_im_preproc_funcs().

Copilot uses AI. Check for mistakes.
Empty file.
3 changes: 1 addition & 2 deletions src/seg_loading/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@ class CeusSeg:
def __init__(self):
self.seg_name: str
self.seg_mask: np.ndarray
self.pixdim: List[float] # voxel spacing in mm
```

The pixel dimensions, segmentation name, and binary mask are all that must be saved in a segmentation parser.
The segmentation name and binary mask are all that must be saved in a segmentation parser.

### Plugin Structure

Expand Down
2 changes: 1 addition & 1 deletion src/seg_loading/seg_loaders/load_bolus_mask.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def load_bolus_mask(image_data: UltrasoundImage, seg_path: str, **kwargs) -> Ceu

out = CeusSeg()
out.seg_mask = bolus_seg
out.pixdim = image_data.pixdim

if seg_path.endswith('.nii.gz'):
out.seg_name = Path(seg_path).name[:-7] # Remove '.nii.gz'
else:
Expand Down
4 changes: 2 additions & 2 deletions src/seg_loading/seg_loaders/nifti.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ def nifti(image_data: UltrasoundImage, seg_path: str, **kwargs) -> CeusSeg:
out.seg_mask = np.asarray(seg.dataobj, dtype=np.uint8)

if out.seg_mask.ndim == 3: # 2D + time
out.pixdim = seg.header.get_zooms()[:2]
image_data.pixdim = list(seg.header.get_zooms()[:2])
elif out.seg_mask.ndim == 4: # 3D + time
out.pixdim = seg.header.get_zooms()[:3]
image_data.pixdim = list(seg.header.get_zooms()[:3])

if seg_path.endswith('.nii.gz'):
out.seg_name = Path(seg_path).name[:-7] # Remove '.nii.gz'
Expand Down
17 changes: 12 additions & 5 deletions src/time_series_analysis/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,17 @@ def get_analysis_types() -> Tuple[dict, dict]:
pass

functions = {}
for file in (Path(__file__).parent / "curve_types" / "curve_definitions").iterdir():
module = importlib.import_module(f'.curve_types.curve_definitions.{file.stem}', package=__package__)
for name, obj in inspect.getmembers(module, inspect.isfunction):
if not name.startswith("_") and obj.__module__ == module.__name__:
functions[name] = obj
curve_defs_path = Path(__file__).parent / "curve_types" / "curve_definitions"
if curve_defs_path.exists():
for file in curve_defs_path.iterdir():
if file.suffix == ".py" and not file.name.startswith("_"):
try:
module = importlib.import_module(f'.curve_types.curve_definitions.{file.stem}', package=__package__)
for name, obj in inspect.getmembers(module, inspect.isfunction):
if not name.startswith("_") and obj.__module__ == module.__name__:
functions[name] = obj
except Exception as e:
print(f"Error loading curve definition {file.name}: {e}")
pass

return types, functions