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

MAINT: Housekeeping and more verbose debugging outputs #302

Merged
merged 1 commit into from
Nov 17, 2022

Conversation

oesteban
Copy link
Member

No description provided.

@oesteban oesteban force-pushed the enh/more-verbose-debug-mode branch from 632f6e0 to dacfb63 Compare November 17, 2022 12:23
@oesteban oesteban merged commit fd53565 into master Nov 17, 2022
@oesteban oesteban deleted the enh/more-verbose-debug-mode branch November 17, 2022 13:08
Copy link
Member

@effigies effigies left a comment

Choose a reason for hiding this comment

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

Small comments. Nothing that would have been blocking.

debug_ref = (~xfm).apply(fmap_ref, reference=nii_target)
debug_ref.header.set_qform(nii_target.affine, code=1)
debug_ref.header.set_sform(nii_target.affine, code=1)
debug_ref.to_filename(Path() / "debug_fmapref.nii.gz")
Copy link
Member

Choose a reason for hiding this comment

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

Odd idiom.

>>> Path() / "debug_fmapref.nii.gz"
PosixPath('debug_fmapref.nii.gz')

So this is the same as:

        debug_ref.to_filename("debug_fmapref.nii.gz")

debug_ref.to_filename(Path() / "debug_fmapref.nii.gz")

# Generate a new transform
newaff = np.linalg.inv(np.linalg.inv(coeff.affine) @ (~xfm).matrix)
Copy link
Member

Choose a reason for hiding this comment

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

I don't understand why you're replacing A @ B with ~(~B @ ~A).

@@ -103,7 +103,9 @@ def init_unwarp_wf(omp_nthreads=1, debug=False, name="unwarp_wf"):

rotime = pe.Node(GetReadoutTime(), name="rotime")
rotime.interface._always_run = debug
resample = pe.Node(ApplyCoeffsField(num_threads=omp_nthreads), name="resample")
resample = pe.Node(ApplyCoeffsField(
num_threads=omp_nthreads if not debug else 1
Copy link
Member

@effigies effigies Nov 17, 2022

Choose a reason for hiding this comment

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

Just as a thought, I wonder if this would be more or less clear:

    resample = pe.Node(ApplyCoeffsField(num_threads=debug or omp_nthreads), name="resample")

Since bools are a subclass of int, it will be 1 if debug is True or omp_nthreads if debug is False.

>>> ApplyCoeffsField(num_threads=True).inputs

in_coeff = <undefined>
in_data = <undefined>
in_xfms = <undefined>
num_threads = 1
pe_dir = <undefined>
ro_time = <undefined>

@effigies
Copy link
Member

effigies commented Dec 6, 2022

Can be backported to 2.1.0 if needed.

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

Successfully merging this pull request may close these issues.

2 participants