PyNutil 0.5__tar.gz → 0.5.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pynutil-0.5 → pynutil-0.5.3}/PKG-INFO +1 -1
- {pynutil-0.5 → pynutil-0.5.3}/PyNutil/processing/analysis/region_counting.py +37 -10
- {pynutil-0.5 → pynutil-0.5.3}/PyNutil.egg-info/PKG-INFO +1 -1
- {pynutil-0.5 → pynutil-0.5.3}/LICENSE +0 -0
- {pynutil-0.5 → pynutil-0.5.3}/PyNutil/__init__.py +0 -0
- {pynutil-0.5 → pynutil-0.5.3}/PyNutil/config.py +0 -0
- {pynutil-0.5 → pynutil-0.5.3}/PyNutil/context.py +0 -0
- {pynutil-0.5 → pynutil-0.5.3}/PyNutil/io/__init__.py +0 -0
- {pynutil-0.5 → pynutil-0.5.3}/PyNutil/io/atlas_loader.py +0 -0
- {pynutil-0.5 → pynutil-0.5.3}/PyNutil/io/colormap.py +0 -0
- {pynutil-0.5 → pynutil-0.5.3}/PyNutil/io/file_operations.py +0 -0
- {pynutil-0.5 → pynutil-0.5.3}/PyNutil/io/loaders.py +0 -0
- {pynutil-0.5 → pynutil-0.5.3}/PyNutil/io/meshview_writer.py +0 -0
- {pynutil-0.5 → pynutil-0.5.3}/PyNutil/io/nifti_writer.py +0 -0
- {pynutil-0.5 → pynutil-0.5.3}/PyNutil/io/propagation.py +0 -0
- {pynutil-0.5 → pynutil-0.5.3}/PyNutil/io/reconstruct_dzi.py +0 -0
- {pynutil-0.5 → pynutil-0.5.3}/PyNutil/io/section_visualisation.py +0 -0
- {pynutil-0.5 → pynutil-0.5.3}/PyNutil/io/volume_nifti.py +0 -0
- {pynutil-0.5 → pynutil-0.5.3}/PyNutil/logging_utils.py +0 -0
- {pynutil-0.5 → pynutil-0.5.3}/PyNutil/main.py +0 -0
- {pynutil-0.5 → pynutil-0.5.3}/PyNutil/processing/__init__.py +0 -0
- {pynutil-0.5 → pynutil-0.5.3}/PyNutil/processing/adapters/__init__.py +0 -0
- {pynutil-0.5 → pynutil-0.5.3}/PyNutil/processing/adapters/anchoring.py +0 -0
- {pynutil-0.5 → pynutil-0.5.3}/PyNutil/processing/adapters/base.py +0 -0
- {pynutil-0.5 → pynutil-0.5.3}/PyNutil/processing/adapters/damage.py +0 -0
- {pynutil-0.5 → pynutil-0.5.3}/PyNutil/processing/adapters/deformation.py +0 -0
- {pynutil-0.5 → pynutil-0.5.3}/PyNutil/processing/adapters/registry.py +0 -0
- {pynutil-0.5 → pynutil-0.5.3}/PyNutil/processing/adapters/segmentation.py +0 -0
- {pynutil-0.5 → pynutil-0.5.3}/PyNutil/processing/adapters/visualign_deformations.py +0 -0
- {pynutil-0.5 → pynutil-0.5.3}/PyNutil/processing/analysis/__init__.py +0 -0
- {pynutil-0.5 → pynutil-0.5.3}/PyNutil/processing/analysis/aggregator.py +0 -0
- {pynutil-0.5 → pynutil-0.5.3}/PyNutil/processing/analysis/data_analysis.py +0 -0
- {pynutil-0.5 → pynutil-0.5.3}/PyNutil/processing/atlas_map.py +0 -0
- {pynutil-0.5 → pynutil-0.5.3}/PyNutil/processing/pipeline/__init__.py +0 -0
- {pynutil-0.5 → pynutil-0.5.3}/PyNutil/processing/pipeline/batch_processor.py +0 -0
- {pynutil-0.5 → pynutil-0.5.3}/PyNutil/processing/pipeline/connected_components.py +0 -0
- {pynutil-0.5 → pynutil-0.5.3}/PyNutil/processing/pipeline/section_processor.py +0 -0
- {pynutil-0.5 → pynutil-0.5.3}/PyNutil/processing/section_volume.py +0 -0
- {pynutil-0.5 → pynutil-0.5.3}/PyNutil/processing/transforms.py +0 -0
- {pynutil-0.5 → pynutil-0.5.3}/PyNutil/processing/utils.py +0 -0
- {pynutil-0.5 → pynutil-0.5.3}/PyNutil/results.py +0 -0
- {pynutil-0.5 → pynutil-0.5.3}/PyNutil.egg-info/SOURCES.txt +0 -0
- {pynutil-0.5 → pynutil-0.5.3}/PyNutil.egg-info/dependency_links.txt +0 -0
- {pynutil-0.5 → pynutil-0.5.3}/PyNutil.egg-info/requires.txt +0 -0
- {pynutil-0.5 → pynutil-0.5.3}/PyNutil.egg-info/top_level.txt +0 -0
- {pynutil-0.5 → pynutil-0.5.3}/README.md +0 -0
- {pynutil-0.5 → pynutil-0.5.3}/setup.cfg +0 -0
- {pynutil-0.5 → pynutil-0.5.3}/setup.py +0 -0
- {pynutil-0.5 → pynutil-0.5.3}/tests/test_helpers.py +0 -0
|
@@ -123,7 +123,13 @@ def _build_count_mask(hemi_arr, undamaged_arr, hemi_val, dmg_val):
|
|
|
123
123
|
|
|
124
124
|
|
|
125
125
|
def _derive_count_aggregates(base, with_hemi, with_damage):
|
|
126
|
-
"""Derive aggregate columns (totals) from leaf-level count columns.
|
|
126
|
+
"""Derive aggregate columns (totals) from leaf-level count columns.
|
|
127
|
+
|
|
128
|
+
When hemisphere data is present, grand totals are taken from the
|
|
129
|
+
unfiltered ``_total_*`` columns (which include hemi=0 points) rather
|
|
130
|
+
than summing left + right, so that points outside the hemisphere mask
|
|
131
|
+
are not silently dropped.
|
|
132
|
+
"""
|
|
127
133
|
if with_hemi and with_damage:
|
|
128
134
|
for entity in ("pixel_count", "object_count"):
|
|
129
135
|
base[f"left_hemi_{entity}"] = (
|
|
@@ -134,18 +140,20 @@ def _derive_count_aggregates(base, with_hemi, with_damage):
|
|
|
134
140
|
base[f"right_hemi_undamaged_{entity}"]
|
|
135
141
|
+ base[f"right_hemi_damaged_{entity}"]
|
|
136
142
|
)
|
|
137
|
-
base[f"undamaged_{entity}"] =
|
|
138
|
-
|
|
139
|
-
+ base[f"right_hemi_undamaged_{entity}"]
|
|
140
|
-
)
|
|
141
|
-
base[f"damaged_{entity}"] = (
|
|
142
|
-
base[f"left_hemi_damaged_{entity}"]
|
|
143
|
-
+ base[f"right_hemi_damaged_{entity}"]
|
|
144
|
-
)
|
|
143
|
+
base[f"undamaged_{entity}"] = base[f"_total_undamaged_{entity}"]
|
|
144
|
+
base[f"damaged_{entity}"] = base[f"_total_damaged_{entity}"]
|
|
145
145
|
base[entity] = base[f"undamaged_{entity}"] + base[f"damaged_{entity}"]
|
|
146
|
+
base.drop(
|
|
147
|
+
columns=[c for c in base.columns if c.startswith("_total_")],
|
|
148
|
+
inplace=True,
|
|
149
|
+
)
|
|
146
150
|
elif with_hemi:
|
|
147
151
|
for entity in ("pixel_count", "object_count"):
|
|
148
|
-
base[entity] = base[f"
|
|
152
|
+
base[entity] = base[f"_total_{entity}"]
|
|
153
|
+
base.drop(
|
|
154
|
+
columns=[c for c in base.columns if c.startswith("_total_")],
|
|
155
|
+
inplace=True,
|
|
156
|
+
)
|
|
149
157
|
elif with_damage:
|
|
150
158
|
for entity in ("pixel_count", "object_count"):
|
|
151
159
|
base[entity] = base[f"undamaged_{entity}"] + base[f"damaged_{entity}"]
|
|
@@ -192,6 +200,9 @@ def pixel_count_per_region(
|
|
|
192
200
|
dmg_iter = (
|
|
193
201
|
[(True, "undamaged_"), (False, "damaged_")] if with_damage else [(None, "")]
|
|
194
202
|
)
|
|
203
|
+
# Always compute unfiltered totals so points outside the hemisphere mask
|
|
204
|
+
# (hemi=0) are not silently dropped when deriving aggregate counts.
|
|
205
|
+
total_iter = [(None, "")]
|
|
195
206
|
|
|
196
207
|
computed = {} # col_name -> (idx_array, count_array)
|
|
197
208
|
all_indices = []
|
|
@@ -215,6 +226,22 @@ def pixel_count_per_region(
|
|
|
215
226
|
computed[obj_col] = (c_idx, c_cnt)
|
|
216
227
|
all_indices.extend([p_idx, c_idx])
|
|
217
228
|
|
|
229
|
+
# Compute unfiltered totals (no hemisphere filter) so that points with
|
|
230
|
+
# hemi=0 (outside the hemisphere mask) are included in the grand totals.
|
|
231
|
+
if with_hemi:
|
|
232
|
+
for dmg_val, dmg_pfx in dmg_iter:
|
|
233
|
+
p_mask = _build_count_mask(
|
|
234
|
+
current_points_hemi, current_points_undamaged, None, dmg_val
|
|
235
|
+
)
|
|
236
|
+
c_mask = _build_count_mask(
|
|
237
|
+
current_centroids_hemi, current_centroids_undamaged, None, dmg_val
|
|
238
|
+
)
|
|
239
|
+
p_idx, p_cnt = _counts_for(p_mask, labels_dict_points)
|
|
240
|
+
c_idx, c_cnt = _counts_for(c_mask, labeled_dict_centroids)
|
|
241
|
+
computed[f"_total_{dmg_pfx}pixel_count"] = (p_idx, p_cnt)
|
|
242
|
+
computed[f"_total_{dmg_pfx}object_count"] = (c_idx, c_cnt)
|
|
243
|
+
all_indices.extend([p_idx, c_idx])
|
|
244
|
+
|
|
218
245
|
# ── Build sparse DataFrame ────────────────────────────────────────
|
|
219
246
|
all_idx = (
|
|
220
247
|
np.unique(np.concatenate(all_indices))
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|