Repository navigation
Fix precomputed axes, units and layer type; one precomputed.zip per image - #236
Open
Robbie1977 wants to merge 6 commits into
Open
Robbie1977 wants to merge 6 commits into
Robbie1977 wants to merge 6 commits into
Conversation
…mage The NRRD path transposed pynrrd's X,Y,Z array to Z,Y,X and reversed the header spacing to match, so every volume came out with x and z swapped (JRC2018U: size [174, 566, 1210], resolution [1.0, 0.519, 0.519]). The swap_xz applied to volume_man.obj meshes compensated for that rather than fixing it; checked against the NRRD voxel extents of templates, painted domains, FlyWire/hemibrain neurons and LM neurons, every OBJ and SWC is already X,Y,Z in microns. Drop the transpose, the spacing reversal and swap_xz. Write resolution, voxel_offset and mesh vertices in the units the precomputed spec defines: nanometres and voxel units (voxel_offset was the micron space origin). The frontend's shared coordinate space, which had encoded the swapped axes and micron-as-nanometre scales, now uses 1 nm per unit on x, y and z with the anterior view as default orientation. Decide the layer type from what the image is, not from the dtype: every VFB NRRD is uint8, so templates and expression patterns were coming out as 256-segment segmentations. The KB query now returns a category (template / expression / object); templates and expression patterns are image layers with their intensities, neurons, clones and painted domains are segmentation layers with every non-zero voxel as segment 1 plus one mesh (volume_man.obj when it has faces, else generated from volume.swc, else marching cubes). The same decision is made from the data when there is no KB category. One output per image folder: precomputed.zip, built in a local work dir and copied in as a tmp name then renamed, with a provenance.json entry (pipeline version + source file size/mtime) that makes re-runs skip up-to-date folders. The frontend builds the layer URL directly (<folder>/precomputed.zip|zip:|neuroglancer-precomputed:) instead of crawling two HTML directory listings for a neuroglancer/ folder, and lets Neuroglancer pick the layer type from the source with segment 1 shown. KB discovery goes through the HTTP transaction endpoint with requests; vfb-connect and its import stubbing are no longer needed.
A scheduled run has one plan pod that discovers the targets (KB query, 40 s for the 680k JRC2018U images) and many workers that each take a batch. The workers need the category the plan found, not a KB round trip of their own, and the report needs to know what each worker did: --list-targets TSV write image_dir, vfb_id, template_id, category and exit --targets-file TSV process one such batch --results JSONL one line per image: layer type, bytes, seconds, error
numpy < 2.4 and scipy < 1.15: the cluster's VMs expose a qemu64 CPU and newer wheels assume x86-64-v2. The optional Draco/igneous and navis dependencies are left out; the production path uses legacy meshes.
cloud-volume creates ~/.cloudfiles and ~/.cloudvolume on first mesh write; with no home for uid 1000 every segmentation failed with 'Permission denied: /.cloudfiles' on the first cluster run.
… JRCVNC2018U only
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This follows up #235 with the changes VFB needs before running the pipeline over the image store. Tested end-to-end on real JRC2018U folders: the template, two painted domains, FlyWire/hemibrain/LM neurons, a GAL4 line, a split line, an MCFO fragment and a VT line.
Axes.
convert_nrrd.pytransposed pynrrd's X,Y,Z array to Z,Y,X and reversed the header spacing to match, so every volume came out with x and z swapped (JRC2018U:size [174, 566, 1210],resolution [1.0, 0.519, 0.519]). Theswap_xzonvolume_man.objmeshes was compensating for that rather than fixing it: checked against the NRRD voxel extents of templates, domains, FlyWire/hemibrain neurons and LM neurons, every OBJ and SWC is already X,Y,Z in microns. The transpose, the reversal andswap_xzare gone.Units.
resolution,voxel_offsetand mesh vertices are now in the units the precomputed spec defines: nanometres and voxel units (voxel_offsetwas the micron space origin). The frontend's shared coordinate space, which encoded the swapped axes and micron-as-nanometre scales, is now 1 nm per unit on x, y, z with the anterior view as default orientation.Layer type. Every VFB NRRD is uint8, so choosing by dtype made templates and expression patterns 256-segment segmentations. The KB query now returns a category and the type follows what the image is:
VFBexp_*/VFBext_*classes)volume_man.obj→ generated fromvolume.swc→ marching cubesWithout a KB category (
--ids, filesystem scan) the same decision is made from the data.One output per folder:
precomputed.zip. Built in--work-dir(local scratch), copied in as a tmp name and renamed, so readers never see a partial file. It carriesprovenance.json(pipeline version + source size/mtime) so re-runs skip up-to-date folders and aPIPELINE_VERSIONbump regenerates everything. The frontend builds<folder>/precomputed.zip|zip:|neuroglancer-precomputed:directly instead of crawling two directory listings, and usestype: 'auto'withsegments: ['1']so segmentation layers show their mesh. What the default scene should look like (template + domains + neurons) is still the open design question from the #235 thread — this just makes each layer render correctly.Batch runs.
--use-kb --list-targets targets.tsvwrites the discovered targets with their category (40 s for the 680k JRC2018U images); workers take--targets-file batch.tsv --results results.jsonl, so only the planning step talks to the KB and each image gets one result line for the report.Also: KB discovery uses the HTTP transaction endpoint via
requests(vfb-connect dropped);--generate-mesh,--mesh-from-obj,--merge-segments,--min/max-intensity,--overwrite,--compressare removed as the category now decides. README updated.Measured (one core): template 29 MB / 5 s; neurons and domains 0.3–0.9 MB / ~2 s; dense GAL4 16 MB / 5 s. VFB will run this as a low-priority Argo job over the ~680k JRC2018U images.