Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reading from N5 #176

Closed
d-v-b opened this issue Nov 8, 2019 · 5 comments
Closed

Reading from N5 #176

d-v-b opened this issue Nov 8, 2019 · 5 comments

Comments

@d-v-b
Copy link

d-v-b commented Nov 8, 2019

I have volumes stored in N5 format, and I am serving them via a local http server (using serve). I am also running neuroglancer via npm run dev-server. In neuroglancer, I tried setting the source source to something like n5://http://localhost:5000/$CONTAINER.n5/$DATASET, where $CONTAINER and $DATASET are the names of the n5 container and the dataset I want to view, but this doesn't work. Specifically, I get Fetching "" resulted in HTTP error 0. How should I get this to work?

@jbms
Copy link
Collaborator

jbms commented Nov 8, 2019

The current n5 support is rather limited. It only supports 3d volumes in the format described here:
https://github.com/saalfeldlab/n5-viewer

Your data source URL then needs to be of the form:

n5://http://localhost:5000/CONTAINER.n5/DATASET/c0

CONTAINER.n5/DATASET/attributes.json should contain something like:

{
"scales":[[1,1,1]],
"pixelResolution":{"unit":"um","dimensions":[0.097,0.097,0.18]}
}

CONTAINER.n5/DATASET/c0/attributes.json should not exist (or will be ignored if it does),

and

CONTAINER.n5/DATASET/c0/s0/attributes.json should be a normal n5 dataset attributes.json file (with raw or gzip compression).

The good news is that in a local branch I have already implemented better support for n5 that does not require such a specific directory structure, and I will be pushing it out soon. It is part of a large change that also adds support for 4-d, etc. volumes, but is not quite ready yet.

@d-v-b
Copy link
Author

d-v-b commented Nov 12, 2019

Thanks, this was very helpful -- I ultimately got it working on test data (once I disabled adblock). Re: the local branch, do you have an idea of a) how the required N5 directory structure will be different, and b) when that branch will be visible online?

@jbms
Copy link
Collaborator

jbms commented Nov 12, 2019

I just pushed the work in progress to the ndims branch, so you can play with it if you like.

It is still a work in progress, and various things still don't work --- e.g. annotations don't work at the moment. However, N5 support basically works, though there may be bugs.

It should work with:

Additionally you can specify attributes: "axes": ["x", "y", "z", "t"] to specify the axis names, and "units": ["um", "um", "um", "s"] to specify the units for each dimension.

Neuroglancer now aggregates attributes from all parent directories as well, so the cN directories are no longer necessary or treated specially.

@jbms
Copy link
Collaborator

jbms commented Nov 12, 2019

Also here is an example that will work with a locally-running dev server:

http://localhost:8080/#!%7B%22dimensions%22:%7B%22x%22:%5B9.700000000000001e-8%2C%22m%22%5D%2C%22y%22:%5B9.700000000000001e-8%2C%22m%22%5D%2C%22z%22:%5B1.8e-7%2C%22m%22%5D%7D%2C%22position%22:%5B7534.7314453125%2C13950.4384765625%2C3323.5%5D%2C%22crossSectionScale%22:0.7672059499758557%2C%22projectionScale%22:32768%2C%22layers%22:%5B%7B%22source%22:%22n5://gs://neuroglancer-exllsm-data/m8-10_Sample12/n5/c0%22%2C%22type%22:%22image%22%2C%22blend%22:%22default%22%2C%22shader%22:%22#uicontrol%20vec3%20color%20color%28default=%5C%22red%5C%22%29%5Cn#uicontrol%20float%20brightness%20slider%28min=-10%2C%20max=10%2C%20step=0.001%29%5Cn#uicontrol%20float%20contrast%20slider%28min=-20%2C%20max=20%2C%20step=0.01%29%5Cnvoid%20main%28%29%20%7B%5Cn%20%20emitRGB%28color%20%2A%20%28toNormalized%28getDataValue%28%29%29%20+%20brightness%29%20%2A%20exp%28contrast%29%29%3B%5Cn%7D%5Cn%22%2C%22shaderControls%22:%7B%22brightness%22:-0.006%2C%22contrast%22:3.27%7D%2C%22name%22:%22c0%22%7D%2C%7B%22source%22:%22n5://gs://neuroglancer-exllsm-data/m8-10_Sample12/n5/c1%22%2C%22type%22:%22image%22%2C%22blend%22:%22default%22%2C%22shader%22:%22#uicontrol%20vec3%20color%20color%28default=%5C%22red%5C%22%29%5Cn#uicontrol%20float%20brightness%20slider%28min=-10%2C%20max=10%2C%20step=0.001%29%5Cn#uicontrol%20float%20contrast%20slider%28min=-20%2C%20max=20%2C%20step=0.01%29%5Cnvoid%20main%28%29%20%7B%5Cn%20%20emitRGB%28color%20%2A%20%28toNormalized%28getDataValue%28%29%29%20+%20brightness%29%20%2A%20exp%28contrast%29%29%3B%5Cn%7D%5Cn%22%2C%22shaderControls%22:%7B%22color%22:%22#00ff00%22%2C%22brightness%22:-0.006%2C%22contrast%22:3.4%7D%2C%22name%22:%22c1%22%7D%5D%2C%22showSlices%22:false%2C%22selectedLayer%22:%7B%22layer%22:%22c1%22%2C%22visible%22:true%2C%22size%22:290%7D%2C%22layout%22:%22xy%22%2C%22statistics%22:%7B%22size%22:372%7D%7D

@jbms
Copy link
Collaborator

jbms commented Dec 3, 2019

The ndims branch has now been merged, so I believe this issue is resolved.

@jbms jbms closed this as completed Dec 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants