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

🥅 Add registration guardrails #1814

Draft
wants to merge 72 commits into
base: develop
Choose a base branch
from
Draft
Changes from 1 commit
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
99a0ea8
:construction: WIP :goal_net: Add registration guardrail
shnizzedy Sep 26, 2022
8cc3f5a
:recycle: Modularize mask parameter checking
shnizzedy Sep 29, 2022
fe7413b
:construction: WIP :goal_net: Create registration guardrail
shnizzedy Sep 29, 2022
3aea371
:wrench: Add 'quality_thresholds' to 'registration_workflows' in pipe…
shnizzedy Sep 29, 2022
8fa5c23
:wrench: Set global registration QC thresholds on config load
shnizzedy Sep 29, 2022
b891928
:goal_net: Pass registrations through guardrail before continuing
shnizzedy Sep 29, 2022
3fb78f0
:goal_net: Plug in registration guardrails
shnizzedy Sep 29, 2022
c12e7c4
:recycle: Convert random.log to random.tsv
shnizzedy Oct 4, 2022
b7fabf4
:sparkles: Afford retrying registration with a different random seed
shnizzedy Oct 4, 2022
d3bdfa8
:goal_net: Add registration guardrails (with retries) to anatomical p…
shnizzedy Oct 4, 2022
db3d555
:page_facing_up: Add license notice to modified files
shnizzedy Oct 4, 2022
b9a7ad0
:recycle: Plug in ants guardrail
shnizzedy Oct 4, 2022
d9d0748
:fire: Remove empty file
shnizzedy Oct 5, 2022
d61569f
:art: Initialze guardrail before conditional
shnizzedy Oct 5, 2022
58811df
:bug: Fix concat-then-guardrail logic
shnizzedy Oct 5, 2022
fe139cc
:recycle: Give each guardrail a unique name
shnizzedy Oct 5, 2022
07a91cd
:art: Keep random seed in bounds
shnizzedy Oct 5, 2022
cf8272b
:bug: Add imports to guardrail node initialization
shnizzedy Oct 7, 2022
cfd7a91
:necktie: Change guardrail retry default to `True` and retry even if …
shnizzedy Oct 7, 2022
ed81db0
:bug: Handle list values returned from `qc_masks`
shnizzedy Oct 7, 2022
e9359c2
:bug: Log failed metric instead of boolean
shnizzedy Oct 7, 2022
6de7c6d
:twisted_rightwards_arrows: Merge 'develop' into 'enh/guardrails'
shnizzedy Oct 18, 2022
f6b8540
:pencil2: Fix typo (octal, not hexadecimal)
shnizzedy Oct 18, 2022
6c81eec
:construction: WIP :goal_net: Iterate guardrail installation
shnizzedy Oct 19, 2022
492c823
:recycle: Rewire coreg for bbreg fallback options
shnizzedy Oct 20, 2022
e8f0c32
:adhesive_bandage: ~~el~~if
shnizzedy Oct 20, 2022
1190804
:rotating_light: Minor linting
shnizzedy Oct 20, 2022
66e4ce6
:recycle: Move logger import + declaration into guardrail function
shnizzedy Oct 20, 2022
328b569
:twisted_rightwards_arrows: Merge dotgraph into enh/guardrails
shnizzedy Oct 20, 2022
837533e
:recycle: Better handling of global thresholds
shnizzedy Oct 21, 2022
e32644b
:goal_net: Guardrail: Log error on first try, raise on second
shnizzedy Oct 21, 2022
88b5589
:technologist: Add decorator for retry __doc__s
shnizzedy Oct 21, 2022
c83ed62
:recycle: Rewire guardrail for `anat_mni_ants_register`
shnizzedy Oct 22, 2022
fcd8a90
:recycle: Use guardrails to inform warp selection
shnizzedy Oct 24, 2022
88de7d6
:recycle: Import registration imports for retry registration
shnizzedy Oct 24, 2022
fa87a92
:goal_net: More specific error handling
shnizzedy Oct 24, 2022
e115d2e
:recycle: Pass failed_qc status to retry_calculate_ants_warp
shnizzedy Oct 25, 2022
ef7d540
:art: Increment seed for ANTs retry
shnizzedy Oct 25, 2022
e28b1a7
:recycle: Refactor guardrails for create_register_func_to_anat_use_T2
shnizzedy Oct 25, 2022
be69c25
:recycle: Refactor bbreg guardrails
shnizzedy Oct 25, 2022
ec62b6a
:goal_net: Guardrail `create_fsl_flirt_linear_reg`
shnizzedy Oct 25, 2022
94f0092
:goal_net: Guardrail
shnizzedy Oct 25, 2022
883a56a
:recycle: Make `connect_retries` a `Workflow` method
shnizzedy Oct 25, 2022
f2b9115
:goal_net: Guardrail `create_fsl_fnirt_nonlinear_reg_nhp`
shnizzedy Oct 25, 2022
fb90455
:recycle: Refactor guardrails for `create_wf_calculate_ants_warp`
shnizzedy Oct 25, 2022
c167384
:recycle: Refactor guardrail for `create_register_func_to_anat`
shnizzedy Oct 25, 2022
fd5e27d
:goal_net: Guardrail `acpc_alignment`
shnizzedy Oct 26, 2022
162cf6a
:art: Simplify calls to `nodes_and_guardrails`
shnizzedy Oct 26, 2022
c0e67c8
:recycle: Semi-abstract connecting guardrailed nodes
shnizzedy Oct 26, 2022
a398b18
:goal_net: Guardrail `unet_brain_connector`
shnizzedy Oct 26, 2022
056afa2
:memo: Fix registration docstring workflow graphs
shnizzedy Oct 27, 2022
dda6eb0
:page_facing_up: Move license declaration from docstring to comments
shnizzedy Oct 27, 2022
65b7bf2
:rewind: Remove prototype guardrails from `freesurfer*connector` func…
shnizzedy Oct 28, 2022
6bd09c3
:goal_net: Guardrail `freesurfer_fsl_brain_connector`
shnizzedy Oct 28, 2022
243fdd9
:goal_net: Guardrail `mask_T2`
shnizzedy Oct 28, 2022
1cbf464
:goal_net: Guardrail `fnirt_based_brain_extraction`
shnizzedy Oct 28, 2022
611066f
:goal_net: Guardrail `freesurfer_abcd_preproc`
shnizzedy Oct 28, 2022
00c3116
:rewind: Remove prototype guardrails from `correct_restore_brain_inte…
shnizzedy Oct 28, 2022
20e87e4
:goal_net: Guardrail `init_brain_extraction_wf`
shnizzedy Oct 28, 2022
eed56b3
:wrench: Add `fail_fast` configuration option to expose Nipype's `sto…
shnizzedy Oct 28, 2022
5cc28cf
:fire: Remove prototype guardrail definitions
shnizzedy Oct 28, 2022
50261d4
:memo: Expand guardrail docstrings
shnizzedy Oct 28, 2022
d4b7d02
:goal_net: Guardrail `distcor_blip_afni_qwarp`
shnizzedy Oct 28, 2022
8f917a7
:goal_net: Guardrail 'distcor_blip_fsl_topup'
shnizzedy Oct 28, 2022
744411f
:goal_net: Guardrail `linear_reg_func_to_anat`
shnizzedy Oct 28, 2022
51051d9
:goal_net: Guardrail `anat_refined_mask`
shnizzedy Oct 28, 2022
3cce875
:goal_net: Guardrail `bold_mask_anatomical_based`
shnizzedy Oct 28, 2022
cde0c7c
:goal_net: Guardrail `bold_mask_css`
shnizzedy Oct 28, 2022
e0e2138
:goal_net: Guardrail `dual_regression`
shnizzedy Oct 28, 2022
97fd7fb
:goal_net: Guardrail `spatial_regression`
shnizzedy Oct 28, 2022
307979e
:white_check_mark: Update random seed test
shnizzedy Oct 28, 2022
02887af
fixup! :wrench: Add `fail_fast` configuration option to expose Nipype…
shnizzedy Oct 28, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
👔 Change guardrail retry default to True and retry even if not chan…
…ging seed

Co-authored-by: Mike Milham <Michael.Milham@childmind.org>
Co-authored-by: Steve Giavasis <sgiava77@gmail.com>
3 people committed Oct 7, 2022
commit cfd7a91f975813282f0f608c2e4e5cc5b7777017
13 changes: 7 additions & 6 deletions CPAC/registration/guardrails.py
Original file line number Diff line number Diff line change
@@ -118,7 +118,7 @@ def registration_guardrail_node(name=None):
function=registration_guardrail), name=name)


def registration_guardrail_workflow(registration_node, retry=False):
def registration_guardrail_workflow(registration_node, retry=True):
"""A workflow to handle hitting a registration guardrail

Parameters
@@ -200,13 +200,14 @@ def retry_registration_node(registered, registration_node):
"""
from CPAC.pipeline.random_state.seed import MAX_SEED, random_seed
seed = random_seed()
if registered.endswith('-failed') and isinstance(seed, int):
if registered.endswith('-failed'):
retry_node = registration_node.clone(
name=f'{registration_node.name}-retry')
if seed < MAX_SEED: # increment random seed
retry_node.seed = seed + 1
else: # loop back to minumum seed
retry_node.seed = 1
if isinstance(seed, int):
if seed < MAX_SEED: # increment random seed
retry_node.seed = seed + 1
else: # loop back to minumum seed
retry_node.seed = 1
return retry_node
return registration_node