diff --git a/PyNutil/counting_and_load.py b/PyNutil/counting_and_load.py index 2c7b46eebe62b1716a674b0d7ea4022a906d56b7..f5b1f8dba50e81fab7d13622bf2db89a5de5fd06 100644 --- a/PyNutil/counting_and_load.py +++ b/PyNutil/counting_and_load.py @@ -101,6 +101,13 @@ def pixel_count_per_region( new_rows.append(row) df_counts_per_label_name = pd.DataFrame(new_rows) + + #Task for Sharon: + #If you can get the areas per region from the flat file here + #you can then use those areas to calculate the load per region here + # and add to dataframe + #see messing around pyflat.py + return df_counts_per_label_name diff --git a/PyNutil/main.py b/PyNutil/main.py index d2e7a8a0cf0f0c80886284e8fe6ee2ac6275605d..8e045e6bb055a76d14e7aa9f17dd4cf7ea28b45d 100644 --- a/PyNutil/main.py +++ b/PyNutil/main.py @@ -211,12 +211,13 @@ class PyNutil: labeled_points, labeled_points_centroids, self.atlas_labels ) prev_pl = 0 + prev_cl = 0 per_section_df = [] current_centroids = None current_points = None - for pl in self.points_len: + for pl,cl in zip(self.points_len, self.centroids_len): if hasattr(self, "centroids"): - current_centroids = labeled_points_centroids[prev_pl : prev_pl + pl] + current_centroids = labeled_points_centroids[prev_cl : prev_cl + cl] if hasattr(self, "pixel_points"): current_points = labeled_points[prev_pl : prev_pl + pl] current_df = pixel_count_per_region( @@ -224,6 +225,7 @@ class PyNutil: ) per_section_df.append(current_df) prev_pl += pl + prev_cl += cl self.labeled_points = labeled_points self.labeled_points_centroids = labeled_points_centroids diff --git a/test/test7_PyNutil.json b/test/test7_PyNutil.json index 0bf2480bfe06c9297b0af9a9e4ca3533f79a5e1e..07d54af0c9e47c394b736c5e9b82c205927535de 100644 --- a/test/test7_PyNutil.json +++ b/test/test7_PyNutil.json @@ -4,5 +4,5 @@ "alignment_json": "test_data/PyNutil_testdataset_Nonlin_SY.json", "nonlinear": true, "colour": [0, 0, 0], - "points_json_path": "outputs/test7_PyNutil.json", + "points_json_path": "outputs/test7_PyNutil.json" } \ No newline at end of file diff --git a/testOOP.py b/testOOP.py index 7fe8ce38fda9f93ddb3bd79eff43be1a6fa3bcc0..f2d1ae6331bf1ffde2b3eb43f1c292213e102b1a 100644 --- a/testOOP.py +++ b/testOOP.py @@ -8,4 +8,4 @@ pnt.get_coordinates(object_cutoff=0) pnt.quantify_coordinates() -pnt.save_analysis("outputs/test7_PyNutil") +pnt.save_analysis("outputs/test8_PyNutil")