fixes #1357
Please read and adhere to the contribution guidelines.
Please tick the following:
Ā Ā https://github.com/SyneRBI/SIRF/pull/1358
(1Ā file)
ā
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.
clone() will make a copy, which fill will then change again. I assume using get_uniform_copy() will be a bit faster as it avoids reading the data. Or do we have an allocator/constructor that doesn't initialise the data at all?
ā
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
Actually, get_uniform_copy cannot be any faster as it calls clone to make a copy and then fills it with the specified value:
def get_uniform_copy(self, value=1.0):
'''Initialises an instance of DataContainer based on the template'''
y = self.clone() # SIRF uses `DiscretisedDensity.clone()` to make a copy of `self` data
y.fill(value)
return y
ā
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
ah. :-)
ā
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
unrelated HDF5 linking error
ā
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
@KrisThielemans approved this pull request.
Before merging, can you add a line to CHANGES.md? ("Restored functionality for algebraic operations mixing STIR.ImageData and numpy arrays." or something like that.)
ā
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
I'll test with MaGeZ as soon as I can.
ā
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
@paskino commented on this pull request.
> @@ -625,6 +625,56 @@ def as_array(self):
try_calling(pystir.cSTIR_getImageData(self.handle, array.ctypes.data))
return array
+ def dot(self, other):
+ '''
+ Returns the dot product of the container data with another container
+ data or numpy array viewed as vectors.
+ other: DataContainer
+ '''
+ if not (issubclass(type(other), type(self))):
+ other = self.clone().fill(other)
This sounds like a bad idea. It will double the memory usage.
ā
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 2 commits.
ā
View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
@KrisThielemans commented on this pull request.
> @@ -625,6 +625,56 @@ def as_array(self):
try_calling(pystir.cSTIR_getImageData(self.handle, array.ctypes.data))
return array
+ def dot(self, other):
+ '''
+ Returns the dot product of the container data with another container
+ data or numpy array viewed as vectors.
+ other: DataContainer
+ '''
+ if not (issubclass(type(other), type(self))):
+ other = self.clone().fill(other)
yes, but it seems we have no alternative at the moment.
ā
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
@KrisThielemans approved this pull request.
I'm fine with the doc. I'd still prefer to have a test before we merge though.
ā
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.![]()
@KrisThielemans commented on this pull request.
In src/xGadgetron/pGadgetron/Gadgetron.py:
> @@ -437,6 +437,56 @@ def get_ISMRMRD_info(self, par):
def get_info(self, par):
return self.get_ISMRMRD_info(par)
+ def dot(self, other):
+ '''
+ Returns the dot product of the container data with another container
+ data or numpy array viewed as vectors.
+ other: ImageData or numpy array or scalar
+ '''
+ if not (issubclass(type(other), type(self))):
+ other = self.clone().fill(other)
+ return super(ImageData, self).dot(other)
according to doc, since Python 3.0, you can write
ā¬ļø Suggested change- return super(ImageData, self).dot(other) + return super().dot(other)
which is a nicer, and in fact seems to say that we can write this only once somewhere, as opposed to for Gadgetron/STIR/Reg etc. No idea how to do that though.
ā
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.![]()