Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Istvan N. Huszar, MD
tirl
Commits
d39e0648
Commit
d39e0648
authored
Aug 16, 2020
by
inhuszar
Browse files
Added source argument to dx to avoid repeated calculations.
parent
dc590a70
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/tirl/costs/msd.py
View file @
d39e0648
...
...
@@ -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
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment