Open mehrhardt opened 5 years ago
Is the method maximum
relevant? Should it be a method of DataContainer
or could we create a function that does this job?
We did discuss if we should add various functions like this (max
/min
/norm
etc) and voted for not doing it to keep SIRF lightweight. Obviously, we' re adding more stuff all the time (including arithmetical operators) so I suppose it makes sense now.
If we do go ahead, I think the DataContainer
should have virtual methods such that it can call the relevant function from the underlying container (e.g. STIR has find_max
for images). This would be faster then first copying the stuff somehwere and then determining the max. At first sight, we could have a default implementation that calls as_array
, but interestingly as_array
is Python/MATLAB specific (while the C++ code obviously isn't), so I wouldn't do that. It could be done once we have iterators for DataContainers
, see https://github.com/CCPPETMR/SIRF/issues/212.
Final thing to consider then is naming etc. You'd want to be close to the native feel. Sadly, in MATLAB max
just works on 1 dimension of the array, so I suppose there is no native equivalent for maximum
. numpy has amax
which defaults to axis=None
to use everything, but users might expect a SIRF function to be able to specify axis
as well, which would really lead us to far.
Oh, and of course, it'd have to throw if the data is complex.
so, not as trivial as you'd hope.
I suggest to close this issue as we have a new one in SIRF.
I encountered a new issue with the CIL-SIRF compatibility. The following example
results in