Skip to content

Mismatch in image and mask size due to change in pixel dimensions during t1w_template_wf #304

@moser297

Description

@moser297

What happened?

I'm testing the --surface-recon-method mcribs with Nibabies 23.1.0rc0 and ran into the following error:

'ValueError: Image and mask sizes do not match.'

This issue happened testing a subject with precomputed aseg/mask derivatives. Input T1w, T2w, mask and aseg all had identical image dimensions and sform/qform matrices.

After tracing down the error with @madisoth we figured out that:
In the t1w_template_wf, pixdim1 of the T1w changed from 0.800000 to 0.799999 when it was reoriented to RAS, since NiBabel recalculates the image zooms after modifying the image and overwrites the existing pixdim field in the NIfTI header

Later in the t1w_preproc_wf, the input mask/aseg (with pixdim1 = 0.800000) were regridded to match the reoriented T1w (with pixdim1 = 0.799999); after regridding, dim1 of mask/aseg changed from 208 -> 209 voxels

This lead apply_mask to fail, due to a shape mismatch between the reoriented T1w and the regridded mask.

What command did you use?

/home/faird/shared/code/external/pipelines/nibabies/nibabies_23.1.0rc0.sif /data /out participant --participant-label ${SUB} \
--surface-recon-method mcribs \
--derivatives /derivatives \
--cifti-output 91k \
--nprocs 16 \
--omp-nthreads 3 \
--resource-monitor \
-vv \
-w /work

What version of NiBabies are you using?

23.1.0rc0

Relevant log output

No response

Add any additional information or context about the problem here.

@madisoth wrote a temporary fix for me which I'm currently testing

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions