From b6740612aeef8d78349c8d8784e5d12e125da84a Mon Sep 17 00:00:00 2001 From: drgmo Date: Sun, 18 Jan 2026 21:03:11 +0000 Subject: [PATCH 1/3] fix iteration in eagle patient encoder --- src/stamp/encoding/encoder/eagle.py | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/src/stamp/encoding/encoder/eagle.py b/src/stamp/encoding/encoder/eagle.py index b2fb293d..3bd251c4 100644 --- a/src/stamp/encoding/encoder/eagle.py +++ b/src/stamp/encoding/encoder/eagle.py @@ -222,9 +222,32 @@ def encode_patients_( h5_ctp = os.path.join(feat_dir, slide_filename) h5_vir2 = os.path.join(agg_feat_dir, slide_filename) - feats, agg_feats = self._validate_and_read_features_with_agg( - h5_ctp, h5_vir2, slide_name - ) + # filters out non-existing files + if not Path(h5_ctp).is_file(): + tqdm.write( + f"[{patient_id}] skip slide (missing ctranspath): {h5_ctp}" + ) + continue + if not Path(h5_vir2).is_file(): + tqdm.write( + f"[{patient_id}] skip slide (missing agg feats): {h5_vir2}" + ) + continue + + # robust reading + try: + feats, agg_feats = self._validate_and_read_features_with_agg( + str(h5_ctp), str(h5_vir2), slide_name + ) + except FileNotFoundError as e: + tqdm.write( + f"[{patient_id}] skip slide (FileNotFoundError): {slide_name} -> {e}" + ) + continue + + # feats, agg_feats = self._validate_and_read_features_with_agg( + # h5_ctp, h5_vir2, slide_name + # ) feats_list.append(feats) agg_feats_list.append(agg_feats) From 4dd479cc6c70339cd913e526c691955394b2f53c Mon Sep 17 00:00:00 2001 From: drgmo Date: Sun, 18 Jan 2026 21:13:43 +0000 Subject: [PATCH 2/3] minimal patch --- src/stamp/encoding/encoder/eagle.py | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/src/stamp/encoding/encoder/eagle.py b/src/stamp/encoding/encoder/eagle.py index 3bd251c4..7f807b6b 100644 --- a/src/stamp/encoding/encoder/eagle.py +++ b/src/stamp/encoding/encoder/eagle.py @@ -222,18 +222,6 @@ def encode_patients_( h5_ctp = os.path.join(feat_dir, slide_filename) h5_vir2 = os.path.join(agg_feat_dir, slide_filename) - # filters out non-existing files - if not Path(h5_ctp).is_file(): - tqdm.write( - f"[{patient_id}] skip slide (missing ctranspath): {h5_ctp}" - ) - continue - if not Path(h5_vir2).is_file(): - tqdm.write( - f"[{patient_id}] skip slide (missing agg feats): {h5_vir2}" - ) - continue - # robust reading try: feats, agg_feats = self._validate_and_read_features_with_agg( From e512470e82fbaee223dcbbe238d460557393dde8 Mon Sep 17 00:00:00 2001 From: drgmo Date: Fri, 23 Jan 2026 11:47:29 +0000 Subject: [PATCH 3/3] fix(eagle): delete redundant lines --- src/stamp/encoding/encoder/eagle.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/stamp/encoding/encoder/eagle.py b/src/stamp/encoding/encoder/eagle.py index 7f807b6b..fe108c09 100644 --- a/src/stamp/encoding/encoder/eagle.py +++ b/src/stamp/encoding/encoder/eagle.py @@ -233,9 +233,6 @@ def encode_patients_( ) continue - # feats, agg_feats = self._validate_and_read_features_with_agg( - # h5_ctp, h5_vir2, slide_name - # ) feats_list.append(feats) agg_feats_list.append(agg_feats)