Add Z alignment repair utility (fix_z_align.py)#16
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 68128d638d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| config['z_offset'] = _global_z_for_local(base_config, original_local_min, local_start) | ||
| config['first_slice'] = config['z_offset'] - 1 | ||
| config['overwrite'] = True | ||
| config['wipe_progress_flag'] = False |
There was a problem hiding this comment.
Allow repaired stacks to bypass z_aligned skip
In the normal use case this tool repairs a stack that has already been processed, so the input store already has z_aligned=True; align_stack_z returns immediately in that case unless wipe_progress_flag is true (checked in emalign/scripts/align_stack_z.py). Because the repair config always forces this flag to False, both the preview and final propagation calls become no-ops after deleting progress documents, leaving the bad alignment unrepaired.
Useful? React with 👍 / 👎.
| config['local_z_min'] = int(local_start) | ||
| config['local_z_max'] = int(local_stop_exclusive) | ||
| config['z_offset'] = _global_z_for_local(base_config, original_local_min, local_start) | ||
| config['first_slice'] = config['z_offset'] - 1 |
There was a problem hiding this comment.
Preserve reference-based configs' unset first_slice
When the original config uses reference_path, align_stack_z expects first_slice to stay None; otherwise it passes both an external reference dataset and an external first slice into the flow code, which raises the incompatible-reference error in emalign/align_z/align_z.py. Unconditionally setting first_slice here therefore makes repairs fail for reference-aligned stacks instead of continuing to align slices against the reference volume.
Useful? React with 👍 / 👎.
Motivation
Description
fix_z_align.py, a standalone CLI that accepts a path to an existingalign_stack_zJSON config and a single slice or inclusive slice range (formats:N,N:M, orN-M).local_z_min,local_z_max,z_offset,first_slice, and enablingoverwrite) and callingalign_stack_zfor the preview and for the final propagation.flow_z,render_z(byglobal_slice), and optionallymesh_relax_zdocuments for the affected range.inspect_dataset, CLI confirmation (y/yes) to proceed,--skip-previewto immediately propagate,--preview-afterto extend the preview window, and--project-nameto override the config project name.Testing
python -m py_compile fix_z_align.pywhich succeeded to validate basic syntax and imports.python fix_z_align.py --helpwhich failed in this environment because importing OpenCV triggersImportError: libGL.so.1: cannot open shared object filedue to a missing system library, so Neuroglancer/preview execution could not be exercised here.Codex Task