Commit d39e0648 authored by inhuszar's avatar inhuszar
Browse files

Added source argument to dx to avoid repeated calculations.

parent dc590a70
......@@ -195,7 +195,7 @@ class CostMSD(Cost):
jac /= self.target.tsize
return jac.reshape((source.domain.numel, -1))
def dx(self, dim=None):
def dx(self, dim=None, source=None):
"""
Returns the voxelwise total derivative of the source with respect to the
local displacement vector. The result has the following shape:
......@@ -208,7 +208,8 @@ class CostMSD(Cost):
image.
"""
source = self.source # only evaluate once
if source is None:
source = self.source # only evaluate once
mask = self.combine_masks(self.target.mask, source.mask)
# diff = source - self.target
# diff.order = VOXEL_MAJOR
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment