-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wip: experimenting with a command to upload the images
- Loading branch information
1 parent
b6448a7
commit f79f827
Showing
4 changed files
with
102 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
click | ||
numpy | ||
cloud-volume | ||
tinybrain | ||
Pillow |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
[metadata] | ||
name = tem2ng | ||
url = https://github.com/seung-lab/tem2ng/ | ||
summary = Convert raw microscope images into a neuroglancer volume. | ||
description-content-type = text/markdown | ||
description-file = README.md | ||
author = William Silversmith | ||
author-email = [email protected] | ||
home-page = https://github.com/seung-lab/tem2ng/ | ||
license = License :: OSI Approved :: BSD License | ||
classifier = | ||
Intended Audience :: Developers | ||
Development Status :: 4 - Beta | ||
License :: OSI Approved :: BSD License | ||
Programming Language :: Python :: 3 | ||
Programming Language :: Python :: 3.7 | ||
Programming Language :: Python :: 3.8 | ||
Programming Language :: Python :: 3.9 | ||
Topic :: Software Development :: Libraries :: Python Modules | ||
|
||
[global] | ||
setup-hooks = pbr.hooks.setup_hook | ||
|
||
[files] | ||
packages = | ||
tem2ng | ||
|
||
[extras] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import os | ||
import setuptools | ||
import sys | ||
|
||
setuptools.setup( | ||
setup_requires=['pbr'], | ||
python_requires="~=3.7", # >= 3.7 < 4.0 | ||
include_package_data=True, | ||
entry_points={ | ||
"console_scripts": [ | ||
"tem2ng=tem2ng:main" | ||
], | ||
}, | ||
pbr=True | ||
) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import re | ||
import os | ||
|
||
import click | ||
|
||
from cloudvolume import CloudVolume | ||
import numpy as np | ||
import tinybrain | ||
|
||
from PIL import Image | ||
|
||
TILE_REGEXP = re.compile(r'tile_(\d+)_(\d+)\.bmp') | ||
|
||
def get_ng(tilename, z=0): | ||
x_map = {4:0,5:1,6:2,3:0,0:1,7:2,2:0,1:1,8:2} | ||
get_x = lambda t1,t2: 6000 * ((t1%25)*3 + x_map[t2]) | ||
y_map = {4:0,3:1,2:2,5:0,0:1,1:2,6:0,7:1,8:2} | ||
get_y = lambda t1,t2: 6000 * ((t1//25)*3 + y_map[t2]) | ||
|
||
t1, t2 = re.match(TILE_REGEXP, tilename).groups() | ||
|
||
x0 = get_x(t1, t2) | ||
xf = x0 + 6000 | ||
y0 = get_y(t1,t2) | ||
yf = y0 + 6000 | ||
|
||
return f"{x0}-{xf}_{y0}-{yf}_{z}-{z+1}" | ||
|
||
@click.command() | ||
@click.argument("source") | ||
def main(source): | ||
cv = CloudVolume("matrix://pni-tem1/test/") | ||
|
||
for filename in os.scandir(source): | ||
ext = os.path.splitext(filename)[1] | ||
if ext != ".bmp": | ||
continue | ||
|
||
img = Image.open(filename) | ||
|
||
|
||
img = Image.open("tile_99_0.bmp") | ||
img.show() | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|