diff --git a/PyNutil/folder_of_segmentations_to_meshview.py b/PyNutil/folder_of_segmentations_to_meshview.py index 0fba9d990f74880f88d217d94f06b697bb9da00a..2cfe10cc1585891e3f2ed5afc65235b22fe569b2 100644 --- a/PyNutil/folder_of_segmentations_to_meshview.py +++ b/PyNutil/folder_of_segmentations_to_meshview.py @@ -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) diff --git a/PyNutil/main.py b/PyNutil/main.py index 878cea3a206e03100e38e68ed1976fb76db00601..02568fa56f73a8e9dc9464114f16e8c00829c6e5 100644 --- a/PyNutil/main.py +++ b/PyNutil/main.py @@ -6,7 +6,6 @@ import json import pandas as pd from datetime import datetime - class PyNutil: def __init__( self, diff --git a/PyNutil/metadata/config.json b/PyNutil/metadata/config.json index 5cab460fcd262288ee1f71d9a8de5f543fc754c6..064d131d1b2d0a85f06e1d8a69d5d27818dd60fa 100644 --- a/PyNutil/metadata/config.json +++ b/PyNutil/metadata/config.json @@ -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", diff --git a/PyNutil/oop_example.py b/PyNutil/oop_example.py new file mode 100644 index 0000000000000000000000000000000000000000..4bdc2eeeb6103dda97c86eea54283522dd6b13ea --- /dev/null +++ b/PyNutil/oop_example.py @@ -0,0 +1,14 @@ +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 diff --git a/PyNutil/testing_openflatfile.py b/PyNutil/testing_openflatfile.py index 2d7071cdae8d2a455e5792b718a6ce437d5f93d2..e6e630ef96dd4081959f006f620c895d71bde5ed 100644 --- a/PyNutil/testing_openflatfile.py +++ b/PyNutil/testing_openflatfile.py @@ -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): diff --git a/test/test5_NOP_s037.json b/test/test5_NOP_s037.json index f83771195aeefef380a7f32946a28210c664e8de..d53d90f0d0d14d480620f8d578c15ccbced27db7 100644 --- a/test/test5_NOP_s037.json +++ b/test/test5_NOP_s037.json @@ -1,10 +1,10 @@ -{ "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" } diff --git a/testOOP.py b/testOOP.py index 617dcf7c6cc809fc4beab7192dce593735a9604f..235481d020f2140b797aae05b52dac15ecbc0e10 100644 --- a/testOOP.py +++ b/testOOP.py @@ -1,10 +1,10 @@ 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")