Skip to content
Snippets Groups Projects
Commit 15d81c39 authored by Sharon Yates's avatar Sharon Yates
Browse files

Testing with Harry, clean up

parent 300429c4
No related branches found
No related tags found
No related merge requests found
......@@ -36,7 +36,7 @@ label_path = "../annotation_volumes//allen2022_colours.csv"
label_df = pd.read_csv(label_path)
# read the annotation volume, it also has a header but we don't need it
# now we can get the labels for each point
labels = labelPoints(points, data, scale_factor=2.5)
labels = labelPoints(points, data, scale_factor=1)
# save points to a meshview json
WritePointsToMeshview(points, labels, "../outputs/points.json", label_df)
......
......@@ -6,7 +6,6 @@ import json
import pandas as pd
from datetime import datetime
class PyNutil:
def __init__(
self,
......@@ -84,7 +83,7 @@ class PyNutil:
)
print("quantifying coordinates")
labeled_points = labelPoints(
self.pixel_points, self.atlas_volume, scale_factor=2.5
self.pixel_points, self.atlas_volume, scale_factor=1
)
self.label_df = PixelCountPerRegion(labeled_points, self.atlas_labels)
self.labeled_points = labeled_points
......
......@@ -5,7 +5,7 @@
},
"allen2017":{
"labels":"allen2017_colours.csv",
"volume":"annotation_10_reoriented_2017.nrrd"
"volume":"annotation_25_reoriented_2017.nrrd"
},
"allen2022":{
"labels":"allen2022_colours.csv",
......
class Demo:
def __init__(self, test):
self.test = test
def print_test(self):
print(self.test)
self.output = 'success'
\ No newline at end of file
......@@ -3,9 +3,10 @@ import numpy as np
import struct
import pandas as pd
import matplotlib.pyplot as plt
import cv2
"""read flat file and write into an np array"""
np.set_printoptions(suppress=True)
with open(base, "rb") as f:
# i dont know what b is, w and h are the width and height that we get from the
# flat file header
......@@ -27,12 +28,17 @@ with open(base, "rb") as f:
image[y, x] = imagedata[x + y * w]
image_arr = np.array(image)
print(image_arr.shape)
image_arr = cv2.resize(image_arr,(9848,12784),interpolation=cv2.INTER_NEAREST)
print(image_arr.shape)
val,count = np.unique(image_arr, return_counts=True)
print(list(zip(val,count)))
# show image with plt.imshow(image_arr)
"""assign label file values into image array"""
labelfile = pd.read_csv(r"../annotation_volumes\allen2017_colours.csv")
labelfile = pd.read_csv(r"../metadata/annotation_volumes\allen2017_colours.csv")
allen_id_image = np.zeros((h, w)) # create an empty image array
"""for ph in range(h):
......
{ "volume_path": "../annotation_volumes/annotation_10_reoriented_2017.nrrd",
"label_path": "../annotation_volumes/allen2017_colours.csv",
"segmentation_folder": "../test_data/ttA_2877_NOP_s037_seg",
"alignment_json": "../test_data/ttA_2877_NOP_horizontal_final_2017.json",
{ "volume_path": "allen2017",
"label_path": "annotation_volumes/allen2017_colours.csv",
"segmentation_folder": "test_data/ttA_2877_NOP_s037_seg",
"alignment_json": "test_data/ttA_2877_NOP_horizontal_final_2017.json",
"nonlinear": false,
"colour": [0, 0, 255],
"points_json_path": "../outputs/test5_points.json",
"counts_per_label_name": "../outputs/test5_counts_per_allenID_2017_false.csv"
"points_json_path": "outputs/test5_points.json",
"counts_per_label_name": "outputs/test5_counts_per_allenID_2017_false.csv"
}
from PyNutil import PyNutil
pnt = PyNutil(settings_file=r"test/test4_2017.json")
pnt = PyNutil(settings_file=r"test/test5_NOP_s037.json")
# pnt.build_quantifier()
pnt.get_coordinates()
pnt.quantify_coordinates()
pnt.save_analysis("outputs/test4_2017")
pnt.save_analysis("outputs/test5_NOP_25")
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment