Skip to content

Commit

Permalink
Patch regmotoasl again (#321)
Browse files Browse the repository at this point in the history
  • Loading branch information
tsalo authored Sep 7, 2023
1 parent e2a64a5 commit f4e4ebd
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions aslprep/interfaces/cbf.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,7 @@ def _run_interface(self, runtime):
# extract m0 file and register it to ASL if separate
if metadata["M0Type"] == "Separate":
m0file = self.inputs.m0scan

m0_in_asl = fname_presuffix(self.inputs.asl_file, suffix="_m0file")
m0_in_asl = regmotoasl(asl=self.inputs.asl_file, m0file=m0file, m02asl=m0_in_asl)
m0_in_asl = regmotoasl(asl=self.inputs.asl_file, m0file=m0file)
m0data_smooth = smooth_image(nb.load(m0_in_asl), fwhm=self.inputs.fwhm).get_fdata()
if len(m0data_smooth.shape) > 3:
m0data = mask_data * np.mean(m0data_smooth, axis=3)
Expand Down Expand Up @@ -953,7 +951,7 @@ def _list_outputs(self):
return outputs


def regmotoasl(asl, m0file, m02asl):
def regmotoasl(asl, m0file):
"""Calculate mean M0 image and mean ASL image, then FLIRT M0 image to ASL space.
TODO: This should not be a function. It uses interfaces, so it should be a workflow.
Expand All @@ -962,16 +960,13 @@ def regmotoasl(asl, m0file, m02asl):

meanasl = fsl.MeanImage()
meanasl.inputs.in_file = asl
meanasl.inputs.out_file = fname_presuffix(asl, suffix="_meanasl")
meanasl_results = meanasl.run()
meanm0 = fsl.MeanImage()
meanm0.inputs.in_file = m0file
meanm0.inputs.out_file = fname_presuffix(asl, suffix="_meanm0")
meanm0_results = meanm0.run()
flt = fsl.FLIRT(bins=640, cost_func="mutualinfo")
flt.inputs.in_file = meanm0_results.outputs.out_file
flt.inputs.reference = meanasl_results.outputs.out_file
flt.inputs.out_file = m02asl
flt_results = flt.run()
return flt_results.outputs.out_file

Expand Down

0 comments on commit f4e4ebd

Please sign in to comment.