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

[FIX] only calc subject registration images when necessary #862

Merged
merged 2 commits into from
Aug 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
10 changes: 9 additions & 1 deletion AFQ/definitions/mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,10 +273,18 @@ def get_for_subses(self, base_fname, dwi, bids_info, reg_subject,
"TransformParameters"])[9:]
their_prealign[3, 3] = 1.0
warp_f5.close()
return reg.read_mapping(
mapping = reg.read_mapping(
their_disp, dwi,
reg_template, prealign=their_prealign)

def transform(self, data, **kwargs):
raise NotImplementedError(
"ITK based mappings can currently"
+ " only transform from template to subject space")

mapping.transform = transform
return mapping


class GeneratedMapMixin(object):
"""
Expand Down
10 changes: 5 additions & 5 deletions AFQ/tasks/mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,10 +204,10 @@ def get_reg_subject(data_imap, bids_info, base_fname, dwi,
"reg_subject must be a str, ImageDefinition, or Nifti1Image")

filename_dict = {
"b0": data_imap["b0"],
"power_map": data_imap["pmap"],
"dti_fa_subject": data_imap["dti_fa"],
"subject_sls": data_imap["b0"],
"b0": "b0",
"power_map": "pmap",
"dti_fa_subject": "dti_fa",
"subject_sls": "b0",
}
bm = nib.load(data_imap["brain_mask"])

Expand All @@ -222,7 +222,7 @@ def get_reg_subject(data_imap, bids_info, base_fname, dwi,
data_imap=data_imap)
else:
if reg_subject_spec in filename_dict:
reg_subject_spec = filename_dict[reg_subject_spec]
reg_subject_spec = data_imap[filename_dict[reg_subject_spec]]
img = nib.load(reg_subject_spec)
bm = bm.get_fdata().astype(bool)
masked_data = img.get_fdata()
Expand Down