Skip to content

REF: generalised anat references 2.0 - #477

Draft
eilidhmacnicol wants to merge 11 commits into
nipreps:masterfrom
eilidhmacnicol:ref/input_anat_func
Draft

REF: generalised anat references 2.0#477
eilidhmacnicol wants to merge 11 commits into
nipreps:masterfrom
eilidhmacnicol:ref/input_anat_func

Conversation

@eilidhmacnicol

Copy link
Copy Markdown
Contributor

After pushing #475 , @mgxd suggested to move the logic to its own workflow.

As a result, we have a new function, collect_anat which will assign a modality as either 'reference' or 'aux'. At the moment, 'reference' is hard-coded to be T1w but this provides an opportunity for command line overrides or alternative pipelines for nirodents/nibabies

@mgxd mgxd left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

had a chance to jot down some thoughts - i like the overall direction, but we can take this moment to clean up the logic (which admittedly is a bit of a mess if derived from nibabies 😅 )

'data': subject_data[modality],
'n': len(subject_data[modality]),
'precomputed': f'{modality}_preproc' in precomputed,
'role': 'reference' if modality.capitalize() == reference_anat else 'aux',

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can this just be a bool, since if not we will treat as auxillary

Suggested change
'role': 'reference' if modality.capitalize() == reference_anat else 'aux',
'is_ref': modality.capitalize() == reference_anat,

anat_inputs = {
modality: {
'data': subject_data[modality],
'n': len(subject_data[modality]),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wdyt about

Suggested change
'n': len(subject_data[modality]),
'count': len(subject_data[modality]),

'role': 'reference' if modality.capitalize() == reference_anat else 'aux',
}
for modality in ['t1w', 't2w', 'flair']
if modality in subject_data.keys()

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since i believe all keys are in subject_data, this will check if the list is not empty

Suggested change
if modality in subject_data.keys()
if subject_data.get(modality)

msm_sulc=False,
t1w=[str(bids_root / 'sub-01' / 'anat' / 'sub-01_T1w.nii.gz')],
t2w=[str(bids_root / 'sub-01' / 'anat' / 'sub-01_T2w.nii.gz')],
anat=collect_anat(collect_data(bids_root, '01')[0], {}, 'T1w'),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is pretty noisy and has a lot going on for one line

Comment on lines +137 to +142
anat_inputs[reference_anat.lower()].update(
{
f'have_{preproc}': f'{reference_anat.lower()}_{preproc}' in precomputed
for preproc in ['mask', 'tpms', 'dseg']
}
)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looking at this, i wonder if this precomputed parsing would be better suited for a separate function

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants