Skip to content

Commit 58f11b0

Browse files
authored
Merge pull request #442 from EIT-ALIVE/fix/441-watershed-excluded-peaks
Fix the excluded peaks in WatershedLungspace
2 parents e748149 + 3ae408a commit 58f11b0

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

eitprocessing/roi/watershed.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ def apply( # noqa: PLR0915
168168

169169
included_marker_indices = np.isin(peaks_loc_int, markers_inside_tiv_mask)
170170
included_peaks = np.argwhere(included_marker_indices)
171-
excluded_peaks = np.argwhere(~included_marker_indices)
171+
excluded_peaks = np.argwhere(peaks_loc_bool & ~included_marker_indices)
172172

173173
included_watershed_regions = np.where(included_region, watershed_regions, np.nan)
174174

tests/test_watershed.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,8 @@ def test_watershed_captures(draeger1: Sequence):
159159
]:
160160
assert key in captures, f"captures should have a '{key}' entry"
161161

162+
assert len(captures["local peaks"]) == len(captures["included peaks"]) + len(captures["excluded peaks"])
163+
162164

163165
def test_watershed_no_amplitude():
164166
eit_data = EITData(

0 commit comments

Comments
 (0)