Please read and adhere to the contribution guidelines.
Please tick the following:
https://github.com/SyneRBI/SIRF/pull/1376
(5 files)
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
@KrisThielemans requested changes on this pull request.
Need to say something about the Reg fix in CHANGES.md.
As the new functionality actually tested? As I don't think it's correct.
Also, in #1373 I suggested to duplicate tests with as_array() and asarray(), but maybe that isn't necessary.
Final comment, this is currently on top of #1373. Are we abandoning that one? The history here is rather awful, but a squash merge if the Reg fix and the algebra fix seems rather weird. Would then need some rebasing. Alternatively, we squash merge #1373 first, and then merge master here etc. No easy solutions... @casperdcl, we'll need your help I think.
> @@ -141,6 +146,9 @@ def __sub__(self, other):
'''
return self.subtract(other)
+ def __rsub__(self, other):
+ return -other + self
I believe this is incorrect, as y.__rsub__(x) == x-y, so shouldn't it be -self + other?
I have no idea about overloads, but both implementations seem to first multiply with -1 and then add, which is normally wasteful. I guess if we have a constructor that doesn't do any work, we could do something like
try ret = self.allocate() ret.asarray() = other.asarray() - self.asarray() return ret except someExceptionStuffHere: return -self + other
> @@ -171,6 +179,9 @@ def __truediv__(self, other):
'''
return self.divide(other)
+ def __rtruediv__(self, other):
+ return other*self.power(-1)
similar comments as for __rsub__
In src/Registration/pReg/Reg.py:
> @@ -567,7 +567,14 @@ def __array_interface__(self):
"""As per https://numpy.org/doc/stable/reference/arrays.interface.html"""
if not self.supports_array_view:
raise ContiguousError("please make an array-copy first with `asarray(copy=True)` or `as_array()`")
- return {'shape': self.shape, 'typestr': '<f4', 'version': 3,
+ shape = self.shape
+ dims = len(shape)
+ strides = ()
+ stride = 4
please add some comment on why this is the case
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
@evgueni-ovtchinnikov pushed 1 commit.
—
View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
@evgueni-ovtchinnikov pushed 1 commit.
—
View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
@evgueni-ovtchinnikov commented on this pull request.
> @@ -141,6 +146,9 @@ def __sub__(self, other):
'''
return self.subtract(other)
+ def __rsub__(self, other):
+ return -other + self
I believe this is incorrect, as
y.__rsub__(x) == x-y, so shouldn't it be-self + other?
apparently not, otherwise respective data container algebra tests would fail (also in CIL, from which this approach was adopted)
ret.asarray() = other.asarray() - self.asarray()
would not work for MR data, I am afraid
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
@evgueni-ovtchinnikov commented on this pull request.
In src/Registration/pReg/Reg.py:
> @@ -567,7 +567,14 @@ def __array_interface__(self):
"""As per https://numpy.org/doc/stable/reference/arrays.interface.html"""
if not self.supports_array_view:
raise ContiguousError("please make an array-copy first with `asarray(copy=True)` or `as_array()`")
- return {'shape': self.shape, 'typestr': '<f4', 'version': 3,
+ shape = self.shape
+ dims = len(shape)
+ strides = ()
+ stride = 4
added here and in CHANGES.md
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()