OpenGATE / GateTools

Python tools and functions for Gate
GNU Lesser General Public License v3.0
30 stars 22 forks source link

Image arithm with scalar #7

Closed tbaudier closed 4 years ago

tbaudier commented 4 years ago

To do an operation between images and scalars without using the binary (eg: directly with Python) we need to create an image containing this scalar value.

djboersma commented 4 years ago

We could maybe move line 89 till 99 into another image_arithm function?

tbaudier commented 4 years ago

I imagine another condition here: https://github.com/OpenGATE/GateTools/blob/master/gatetools/image_arithm.py#L86

to check if the value is a scalar: (https://stackoverflow.com/a/19773559) (not hasattr(N, 'len')) and (not isinstance(N, str))

tbaudier commented 4 years ago

For the moment I did this: https://github.com/OpenGATE/GateTools/commit/b78986b3fbd83805a6775797143498d1e8227dfe

I do not know if we can do it differently