Skip to content

[BUG] Results for default level 1 (translation) vary between runs #45

@schlegelp

Description

@schlegelp

Describe the bug
I'm not sure if this is a bug or expected but I noticed that the results for the first level of the default recipe vary between runs.

To Reproduce
This uses the example data:

wget -nv https://github.com/andreasmang/nirep/raw/refs/heads/master/nifti/na01.nii.gz
wget -nv https://github.com/andreasmang/nirep/raw/refs/heads/master/nifti/na15.nii.gz
>>> import warpfield
>>> fixed = warpfield.load_data('na01.nii.gz')[0]
>>> moving = warpfield.load_data('na15.nii.gz')[0]
>>> recipe = warpfield.Recipe()
>>> recipe.levels = recipe.levels[:1]
>>> for i in range(3):
>>>   _, warpmap, _ = warpfield.register_volumes(fixed, moving, this_recipe, verbose=False)
>>>   print(f"Run {i + 1}:\n", warpmap.warp_field.flatten())
Run 1:
 [  1.625 -30.75   28.375]
Run 2:
 [-0.125 -3.    -2.25 ]
Run 3:
 [ 0.75  0.   -0.75]

I had a quick hunt for potential culprits (random initialisations, uninitialized memory, desynchronized streams, etc.) but came up empty. For what it's worth, the deformation field seems to stabilize after the second level - so maybe it doesn't matter?

Environment:
Tested on Google Colab

  • Python 3.12
  • warpfield 0.2.2
  • T4 GPU, CUDA 12.8.r12.8

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