Open
Description
Hello, I believe there is a bug during the mapping of deformation fields.
In the .map method of the DenseFieldTransform class, I believe the locations that are mapped out-of-domain should be set to the initial coordinates instead of 0. Otherwise, if for example you want to go back to the displacement field by subtracting the reference coordinates you end-up with very large displacements instead of 0.
def map(self, x, inverse=False):
....
....
new_map = np.vstack(tuple(
map_coordinates(
self._field[..., i],
ijk.T,
order=1,
mode="constant",
cval=0,
prefilter=False,
) for i in range(self.reference.ndim)
)).T
# Now, where is 0 i set the original coordinates value -- no transformation/displacement
new_map[np.isclose(new_map, 0)] = x[np.isclose(new_map, 0)]
return new_map
Thanks for your work!
Metadata
Metadata
Assignees
Labels
No labels