diff --git a/PyNutil/load_workflow.py b/PyNutil/load_workflow.py index 7960ac88d745ac3a08d5da56f41f74f749352be1..7b3b845eb3cfb3aa7b3624aa7270a160d1ba6c4f 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 cfc5e3652937ef85493a5883b6c789740098dc6d..bfca32863904fd55249005426a4d909ab4ddfa76 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="):