diff --git a/scripts/PyNutil_test.json b/scripts/PyNutil_test.json new file mode 100644 index 0000000000000000000000000000000000000000..f1e2bd453bafae1ad4f1a6b12c1b0f5936ae00b0 --- /dev/null +++ b/scripts/PyNutil_test.json @@ -0,0 +1,285 @@ +{ + "name": "PyNutil_test.json", + "target": "ABA_Mouse_CCFv3_2017_25um.cutlas", + "target-resolution": [ + 456, + 528, + 320 + ], + "slices": [ + { + "filename": "test_s001.png", + "width": 1500, + "height": 1000, + "snr": 1, + "format": "png", + "current": 0, + "tilesize": 254, + "overlap": 1, + "mode": 0, + "ouv": [ + -5.145275115966797, + 361.8014440433213, + 331.1490739071843, + 456, + 0, + 0, + 0, + 0, + -320 + ], + "markers": [ + [ + 440.0000000000001, + 289, + 450, + 323 + ] + ], + "nr": 1, + "anchoring": [ + -5.145275115966797, + 361.8014440433213, + 331.1490739071843, + 456, + 0, + 0, + 0, + 0, + -320 + ] + }, + { + "filename": "test_s002.png", + "width": 1500, + "height": 1000, + "snr": 2, + "format": "png", + "current": 0, + "tilesize": 254, + "overlap": 1, + "mode": 0, + "ouv": [ + -3.8589563369750977, + 318.7157039711191, + 340.24552914037605, + 456, + 0, + 0, + 0, + 0, + -320 + ], + "markers": [ + [ + 636.8098159509204, + 603.4958601655935, + 672.6993865030674, + 593.3762649494021 + ], + [ + 902.9868982011025, + 615.5567336628567, + 843.8650306748466, + 610.8555657773691 + ], + [ + 561.2609204260139, + 750.3661510917975, + 558.5889570552147, + 775.5289788408462 + ] + ], + "nr": 2, + "anchoring": [ + -3.8589563369750977, + 318.7157039711191, + 340.24552914037605, + 456, + 0, + 0, + 0, + 0, + -320 + ] + }, + { + "filename": "test_s003.png", + "width": 1500, + "height": 1000, + "snr": 3, + "format": "png", + "current": 0, + "tilesize": 254, + "overlap": 1, + "mode": 0, + "ouv": [ + -2.8942172527313232, + 275.6299638989171, + 350.0189942541106, + 456, + 0, + 0, + 0, + 0, + -320 + ], + "markers": [ + [ + 761.0429447852762, + 629.2548298068077, + 741, + 500 + ], + [ + 204.29447852760745, + 613.6154553817848, + 365.3374233128834, + 612.695492180313 + ], + [ + 482.6376861494953, + 714.9876920193675, + 623.0061349693251, + 747.0101195952162 + ], + [ + 434.00208292806684, + 606.7676930120547, + 578.8343558282207, + 601.6559337626494 + ], + [ + 959.8159509202455, + 636.6145354185834, + 980.0613496932516, + 628.3348666053357 + ], + [ + 957.8161415293836, + 523.3987679117937, + 953.3742331288344, + 547.3781048758049 + ] + ], + "nr": 3, + "anchoring": [ + -2.8942172527313232, + 275.6299638989171, + 350.0189942541106, + 456, + 0, + 0, + 0, + 0, + -320 + ] + }, + { + "filename": "test_s004.png", + "width": 1500, + "height": 1000, + "snr": 4, + "format": "png", + "current": 0, + "tilesize": 254, + "overlap": 1, + "mode": 0, + "ouv": [ + -3.0282087922096252, + 232.54422382671487, + 364.1366059225139, + 456, + 0, + 0, + 0, + 0, + -320 + ], + "markers": [ + [ + 522.6993865030674, + 712.9714811407543, + 530.6338374725239, + 715.7313707451705 + ], + [ + 630.6438500513034, + 523.1833943062713, + 550.3067484662577, + 519.7792088316469 + ], + [ + 916.4047791164191, + 534.1886045162021, + 962.5766871165645, + 523.4590616375344 + ], + [ + 950.8076359295408, + 705.46368100121, + 925, + 668 + ], + [ + 1096.1208774051677, + 649.3153717520049, + 1115, + 675 + ], + [ + 1030.2378410339393, + 594.2011916220456, + 1065.644171779141, + 604.4158233670653 + ] + ], + "nr": 4, + "anchoring": [ + -3.0282087922096252, + 232.54422382671487, + 364.1366059225139, + 456, + 0, + 0, + 0, + 0, + -320 + ] + }, + { + "filename": "test_s005.png", + "width": 1500, + "height": 1000, + "snr": 5, + "format": "png", + "current": 0, + "tilesize": 254, + "overlap": 1, + "mode": 0, + "ouv": [ + -0.6163610816001892, + 189.45848375451277, + 374.2485759765199, + 456, + 0, + 0, + 0, + 0, + -320 + ], + "nr": 5, + "anchoring": [ + -0.6163610816001892, + 189.45848375451277, + 374.2485759765199, + 456, + 0, + 0, + 0, + 0, + -320 + ] + } + ] +} \ No newline at end of file diff --git a/test_data/PyNutil_test_2.waln b/scripts/PyNutil_test.waln similarity index 100% rename from test_data/PyNutil_test_2.waln rename to scripts/PyNutil_test.waln diff --git a/scripts/Tiling_script.py b/scripts/Tiling_script.py new file mode 100644 index 0000000000000000000000000000000000000000..fd12fff1e4e3257a84937c5b5d7b2fb2740fcb40 --- /dev/null +++ b/scripts/Tiling_script.py @@ -0,0 +1,19 @@ +import os +import sys +import numpy as np +import tifffile as tiff +path_to_file = r"/home/harryc/Downloads/mouse-s23/ext-d000009_PVMouse_81265_Samp1__s023.tif" +image_outdir = path_to_file.split(".")[0].split("/")[-1] +if not os.path.exists(image_outdir): + os.makedirs(image_outdir) +# Read the image +img = tiff.imread(path_to_file) +# Get the shape of the image +shape = img.shape +#Get the chunk size +chunk_size = 512 +#crop the image and save each chunk +for i in range(0, shape[0], chunk_size): + for j in range(0, shape[1], chunk_size): + chunk = img[i:i+chunk_size, j:j+chunk_size] + tiff.imsave("{}/chunk_{}_{}.tif".format(image_outdir,i, j), chunk) \ No newline at end of file diff --git a/scripts/waln_to_json.py b/scripts/waln_to_json.py index f44cba5c843e35c862f967e15cf52faec996e4f5..342c30ff68084b75f25f363b156caf62bd071796 100644 --- a/scripts/waln_to_json.py +++ b/scripts/waln_to_json.py @@ -56,6 +56,6 @@ def waln_to_json(filename): else: pass -waln_to_json("PyNutil_test_2.waln") +waln_to_json("PyNutil_test.waln") diff --git a/testOOP.py b/testOOP.py index 3109bb82b350068bd4c4d1741a54cfe3ca82438e..63cb0854f0b12fb7ee3fe956b2ae78aa2a52168c 100644 --- a/testOOP.py +++ b/testOOP.py @@ -8,11 +8,11 @@ pnt = PyNutil(settings_file=r"PyNutil/test/test10_PyNutil_web.json") ##use_flat can be set to True if you want to use the flat file ## for method select between "all", "per_pixel" and "per_object" -pnt.get_coordinates(object_cutoff=0, method="per_pixel", use_flat=False) +pnt.get_coordinates(object_cutoff=0, method="all", use_flat=False) pnt.quantify_coordinates() -pnt.save_analysis("PyNutil/outputs/test10_PyNutil_web") +pnt.save_analysis("PyNutil/outputs/test10_PyNutil_web_all") # remove name, r, g, b, from pixel_ # add to region_areas df