Skip to content

Enforce all transforms to be sf.Affine objects before call to SamsegLongitudinal class in the long cli - #35

Merged
oulap merged 2 commits into
freesurfer:devfrom
jnolan14:long_affine
Aug 5, 2026
Merged

Enforce all transforms to be sf.Affine objects before call to SamsegLongitudinal class in the long cli#35
oulap merged 2 commits into
freesurfer:devfrom
jnolan14:long_affine

Conversation

@jnolan14

@jnolan14 jnolan14 commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Addressing the issue raised in #34.

Cause is that the wrapper call to sf.Affine to ensure all transforms are Affine objects will discard all information about the volume's geometry when no LTA files are passed. This succeeds when the LTA files are passed as they are properly loaded via sf.load_affine, which will contain the correct metadata. Passing the geometry of the input images ensures that there is no mismatch in the grids in the case no LTAs are passed and the default np.eye(4) is used as the affine transform.

This introduces and additional, likely unecessary call to sf.load_volume, which could be handled in a future refactor of the longitudinal code. Alternatively, we could address this by adding functionality to sf.Affine that will extract the geometry information when an Affine object is passed as the matrix.

…he case that no lta files are passed. Ensures that downstream all transform objects are of type surfa.Affine, so the additional wrapper call to do this in the SamsegLongitudinal calls can be dropped
… cli entry point, and will be proper sf.Affine objects with the correct geometry
@oulap
oulap merged commit cb4eff2 into freesurfer:dev Aug 5, 2026
11 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants