From 5fd21f1fede1e00c906f0cd3f1cf90cf876f6a34 Mon Sep 17 00:00:00 2001
From: sharoncy <s.c.yates@medisin.uio.no>
Date: Tue, 23 May 2023 11:27:59 +0200
Subject: [PATCH] Clean up

---
 PyNutil/load_workflow.py | 16 ++++++++++++++++
 PyNutil/pyflat.py        |  4 ++++
 2 files changed, 20 insertions(+)

diff --git a/PyNutil/load_workflow.py b/PyNutil/load_workflow.py
index 7960ac8..7b3b845 100644
--- a/PyNutil/load_workflow.py
+++ b/PyNutil/load_workflow.py
@@ -1,3 +1,5 @@
+"""Create workflow for calculating load based on atlas maps and segmentations"""
+
 import struct
 import matplotlib.pyplot as plt
 import pandas as pd
@@ -22,6 +24,20 @@ allen_id_image = lbidx[values.astype(int)] # assign allen IDs into image array
 
 plt.imshow(allen_id_image)
 
+"""count pixels for unique idx"""
+unique_ids, counts = np.unique(allen_id_image, return_counts=True)
+
+area_per_label = list(zip(unique_ids,counts))
+# create a list of unique regions and pixel counts per region
+
+df_area_per_label = pd.DataFrame(area_per_label, columns=["idx","area_count"])
+# create a pandas df with regions and pixel counts
+
+print(df_area_per_label)
+df_area_per_label.to_csv("../outputs/s037_area_per_idx.csv", sep=";", na_rep='', index= False)
+
+
+
 
 # Count area per unique label
 # Scale up to size of corresponding segmentation
diff --git a/PyNutil/pyflat.py b/PyNutil/pyflat.py
index cfc5e36..bfca328 100644
--- a/PyNutil/pyflat.py
+++ b/PyNutil/pyflat.py
@@ -1,3 +1,7 @@
+   
+"""This is Gergely Csusc's code from VisuAlign MediaWiki NITRC page,
+this was a test, not used elsewhere in PyNutil"""   
+   
    import sys
    for arg in sys.argv:
        if arg.startswith("flat="):
-- 
GitLab