Skip to content
Snippets Groups Projects
Commit fe1bbd45 authored by polarbean's avatar polarbean
Browse files
parents 13a542b5 a47a29b5
No related branches found
No related tags found
No related merge requests found
{ {
"python.formatting.provider": "black", "python.formatting.provider": "black"
"python.testing.unittestArgs": [
"-v",
"-s",
"./tests",
"-p",
"test*.py"
],
"python.testing.pytestEnabled": false,
"python.testing.unittestEnabled": true
} }
\ No newline at end of file
...@@ -209,10 +209,7 @@ def warp_image(image, triangulation, rescaleXY): ...@@ -209,10 +209,7 @@ def warp_image(image, triangulation, rescaleXY):
newY[newY >= reg_h] = reg_h - 1 newY[newY >= reg_h] = reg_h - 1
newX[newX < 0] = 0 newX[newX < 0] = 0
newY[newY < 0] = 0 newY[newY < 0] = 0
new_image = np.zeros_like(image) new_image = image[newY, newX]
mask = (newX <= reg_w) & (newY <= reg_h) & (newX > 0) & (newY > 0)
new_image[mask] = image[mask]
new_image[~mask] = 0
return new_image return new_image
...@@ -227,8 +224,14 @@ def flat_to_dataframe( ...@@ -227,8 +224,14 @@ def flat_to_dataframe(
if (image_vector is not None) and (volume is not None): if (image_vector is not None) and (volume is not None):
image = generate_target_slice(image_vector, volume) image = generate_target_slice(image_vector, volume)
image = np.float64(image) image = np.float64(image)
random_number = np.random.randint(0,1000)
outim = ((image==0) * 255).astype(np.uint8)
cv2.imwrite(f"{random_number}_linear.jpg", outim)
if triangulation is not None: if triangulation is not None:
image = warp_image(image, triangulation, rescaleXY) image = warp_image(image, triangulation, rescaleXY)
outim = ((image==0) * 255).astype(np.uint8)
cv2.imwrite(f"{random_number}_warped.jpg", outim)
elif file.endswith(".flat"): elif file.endswith(".flat"):
image = read_flat_file(file) image = read_flat_file(file)
elif file.endswith(".seg"): elif file.endswith(".seg"):
......
workflows/127_linear.jpg

12.6 KiB

workflows/127_warped.jpg

12.7 KiB

workflows/131_linear.jpg

9.99 KiB

workflows/519_linear.jpg

9.81 KiB

workflows/519_warped.jpg

9.92 KiB

workflows/741_linear.jpg

10.5 KiB

workflows/741_warped.jpg

10.2 KiB

workflows/886_linear.jpg

9.77 KiB

workflows/886_warped.jpg

9.06 KiB

...@@ -13,14 +13,15 @@ from PyNutil import PyNutil ...@@ -13,14 +13,15 @@ from PyNutil import PyNutil
###The label_path is the path to the corresponding atlas .csv ###The label_path is the path to the corresponding atlas .csv
###The object_cutoff is a cut-off for min object size ###The object_cutoff is a cut-off for min object size
### get_coordinates, if use_flat=True, place flat files in folder titled "flat_files" at same level as "segmentations" folder ### get_coordinates, if use_flat=True, place flat files in folder titled "flat_files" at same level as "segmentations" folder
#This does not use BrainGlobe API.
pnt = PyNutil( pnt = PyNutil(
segmentation_folder="../tests/test_data/linear_allen_mouse/", segmentation_folder="../tests/test_data/nonlinear_allen_mouse/",
alignment_json="../tests/test_data/linear_allen_mouse/alignment_linear.json", alignment_json="../tests/test_data/nonlinear_allen_mouse/alignment.json",
colour=[0, 0, 0], colour=[0, 0, 0],
atlas_path="../tests/test_data/allen_mouse_2017_atlas/annotation_25_reoriented_2017.nrrd", atlas_path="../tests/test_data/allen_mouse_2017_atlas/annotation_25_reoriented_2017.nrrd",
label_path="../tests/test_data/allen_mouse_2017_atlas//allen2017_colours.csv", label_path="../tests/test_data/allen_mouse_2017_atlas//allen2017_colours.csv",
) )
pnt.get_coordinates(object_cutoff=0, use_flat=False) pnt.get_coordinates(object_cutoff=0, use_flat=False)
pnt.quantify_coordinates() pnt.quantify_coordinates()
pnt.save_analysis("../test_result/test_linear_allen_mouse") pnt.save_analysis("../test_result/test_nonlinear_allen_mouse_noflat_24_02_25")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment