Improve talairach transform and etiv estimation through atlas prealignment#807
Conversation
|
Should we delete the prealigned image file after talairach-registration was done? We can keep the ltas, but the image file can be deleted, no? |
|
Already marking as "ready for review", but still intending to add update to new neuroreg release. |
Set LIT activation directly when --lesion_mask is parsed and remove the separate reuse/postprocessing state variables. Detect existing LIT outputs from the subject directory, fail on inconsistent LIT activation for segmentation or edits runs, and trigger postprocessing from the output files themselves. Use the shared get_script_path_python helper for lit-inpainting and lit-postprocessing instead of a local run_fastsurfer.sh helper. The helper is adapted from Deep-MI/FastSurfer PR Deep-MI#807 and runs package entry points through the configured --py interpreter after command -v checks. Limit --skip-segstats to the explicit --seg_only plus --no_biasfield case and use the shared LIT output filename variables throughout.
There was a problem hiding this comment.
Pull request overview
This PR strengthens Talairach registration robustness (and downstream eTIV estimation) by introducing an affine prealignment step based on neuroreg centroid-based registration, then concatenating that prealignment with the existing talairach_avi transform.
Changes:
- Add neuroreg-based centroid prealignment prior to
talairach_avi, and concatenate transforms into the final Talairach transform. - Plumb through new CLI args (
--py,--asegdkt_segfile) totalairach-reg.shfrom the main entrypoints. - Add
neuroregas a dependency and add a centroid JSON resource for the target template.
Reviewed changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| run_fastsurfer.sh | Passes Python command + segmentation path into Talairach registration step. |
| recon_surf/recon-surf.sh | Passes Python command + segmentation path into Talairach registration step. |
| recon_surf/talairach-reg.sh | Implements segreg-based prealignment, runs talairach_avi on prealigned image, concatenates transforms. |
| recon_surf/functions.sh | Adds helper to locate Python-provided console scripts (segreg, lta). |
| recon_surf/segreg_mni_icbm152_t1_tal_nlin_asym_09c_centroids.json | Adds centroid definition data intended for the prealignment. |
| requirements.txt | Adds neuroreg to the frozen (container-derived) dependency list. |
| requirements.cpu.txt | Adds neuroreg to the frozen CPU dependency list. |
| requirements.mac.txt | Adds neuroreg to macOS dependency list. |
| pyproject.toml | Declares neuroreg as a project dependency. |
Comments suppressed due to low confidence (1)
recon_surf/talairach-reg.sh:85
talairach-reg.shnow relies on--pyand--asegdkt_segfile, but they are not included in the required-argument validation loop (only--dir/--conformed_name/--norm_nameare checked). If a caller omits either flag, the script will fail later with less actionable errors. Add explicit validation forpythonandasegdkt_segfile(or provide safe defaults) before runningsegreg.
--py) python="$1" ; shift ;;
--asegdkt_segfile) if checkfile "$1" ; then exit 1; fi ; asegdkt_segfile="$1" ; shift ;;
--edits) edits="true" ;;
--3t) atlas3T="true" ;;
*) echo "ERROR: Unrecognized argument $key!" ; usage ; exit 1 ;;
esac
done
for arg_spec in "dir=$mdir" "conformed_name=$conformed_name" "norm_name=$norm_name"
do
arg=$(echo "$arg_spec" | cut -d"=" -f1)
value=$(echo "$arg_spec" | cut -d"=" -f2)
if [[ -z "$value" ]] ; then
echo "ERROR: --$arg is a required argument, but no value was passed!"
exit 1
fi
done
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
2f6b4c2 to
2f682cc
Compare
There was a problem hiding this comment.
Pull request overview
Improves robustness of Talairach registration (and downstream eTIV estimation) by adding an affine atlas prealignment step using neuroreg centroid-based registration, then concatenating transforms for the final Talairach transform.
Changes:
- Add
neuroregas a dependency (pip requirements +pyproject.toml). - Pass Python interpreter and asegdkt segmentation into the Talairach registration script.
- Update Talairach registration to: (1) compute a
segreg-based prealignment, (2) runtalairach_avifrom the prealigned image, (3) concatenate transforms.
Reviewed changes
Copilot reviewed 6 out of 8 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
run_fastsurfer.sh |
Passes --py and --asegdkt_segfile into Talairach registration invocation. |
recon_surf/recon-surf.sh |
Passes --py and --asegdkt_segfile into talairach-reg.sh from recon-surf pipeline. |
recon_surf/talairach-reg.sh |
Implements the new neuroreg prealignment + transform concatenation flow. |
requirements.txt |
Adds neuroreg==0.6.0 to the container freeze requirements. |
requirements.cpu.txt |
Adds neuroreg==0.6.0 to the CPU container freeze requirements. |
pyproject.toml |
Adds neuroreg>=0.6.0 to project dependencies. |
CerebNet/data_loader/dataset.py |
Refactors TypedDict typing for ROI metadata and adjusts construction. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
8bd2642 to
e3b4053
Compare
Fix Localizer typing
This commit combines several minor changes from the code review (spelling, wrapping with run_it). Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…ongitudinal processing
… to be able to call python package commands. Implement segreg and lta script lookups Delete the prealigned image after talairach_avi
Update recon_surf/functions.sh Use local variable. Co-authored-by: Martin Reuter <m-reuter@users.noreply.github.com> Reverts get_script_python
e3b4053 to
ebe1024
Compare
This PR intends to improve talairach transform and etiv estimation through atlas prealignment.