Serve low-res volumes from a writable root; fix make_lowres for real dataset layout#73
Merged
Merged
Conversation
…layout The dataset mount is read-only, so make_lowres could never write *_lowres.nii.gz next to the originals, and its input glob looked for data/ImageTr|ImageTe/ which does not exist (real layout is image_only/<case>/ + mask_only/<case>/). - make_lowres: glob image_only/*/ct.nii.gz; write output under --out-root (default /home/visitor/pants_lowres or $PANTS_LOWRES_PATH), mirroring image_only/<case>/ + mask_only/<case>/; makedirs; refresh docs/interpreter. - api_blueprint: the get-main-nifti / get-segmentations ?res=low paths now read from LOWRES_ROOT (same default/env) instead of the read-only mount. Fully additive: absent low-res files -> the API serves full res exactly as before.
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.
Why
?res=lowhas been silently serving full-res because the low-res files never got generated. Two reasonsmake_lowres.pycouldn't run on the server:*_lowres.nii.gznext to the originals underPANTS_PATH, which is a read-only NFS mount.nib.savefails there (same class as the uint8-mask issue).PANTS_PATH/data/ImageTr|ImageTe/*/ct.nii.gz, which finds zero cases. The real layout isPANTS_PATH/image_only/<case>/ct.nii.gz+PANTS_PATH/mask_only/<case>/combined_labels.nii.gz.(Server discovery: 9,901 cases, ~32 MB/CT; factor 2 ≈ 40–45 GB, factor 4 ≈ 5–6 GB;
/homehas 1.2 TB free.)Changes
make_lowres.py: globimage_only/*/ct.nii.gz; write under--out-root(default/home/visitor/pants_lowres, or$PANTS_LOWRES_PATH), mirroringimage_only/<case>/+mask_only/<case>/;makedirsthe output dirs; refresh docstring + conda interpreter.api_blueprint.py:get-main-nifti/get-segmentations?res=lownow read fromLOWRES_ROOT(same default/env) instead of the read-only mount.Read and write paths use the identical convention, so they line up by construction.
Additive / safe
If the low-res files don't exist, both endpoints fall through to full-res exactly as today — a no-op until the batch runs. Nothing writes into the read-only
image_only//mask_only/.Deploy (after merge, on the server)
No
.envchange needed (default matches). Restart the backend after the batch so?res=lowstarts serving the new files.Test plan
py_compileclean on both files--limit 5) writes to/home/visitor/pants_lowres/{image_only,mask_only}/<case>/…curl ".../api/get-main-nifti/<id>.nii.gz?res=low"returns the smaller file