Open KrisThielemans opened 2 months ago
@KrisThielemans :related to that issue. what is the most efficient way in STIR to generate a binary STIR image that shows whether the binary STIR image is > 0? In numpy it would be sth like y = (x > 0)
or y = (x > 0).astype(int)
Apologies for the delay on this issue. Our plan was to let this FOV mask correspond to wherever the provided OSEM is > 0, but I wanted to check how that looks like first...
Regarding the question, I'm assuming you mean SIRF (for sirf.STIR.ImageData
). I think this might be one of our missing operations. It's generally quite hard to pass Python conditions to C++ of course. At present, I think we need to do something like
mask = im.minimum(im.allocate(eps))/eps
that wouldn't be very efficient though. @evgueni-ovtchinnikov @paskino @casperdcl any great ideas?
(1) ok. just wanted to make sure that I was not missing a method of sirf.STIR.ImageData
.
In the meantime, I will create use get_uniform_copy(0)
and fill((x.as_array() > 0).astype(float))
(2) I guess using OSEM >0, instead of adjoint_ones > 0 for the fov mask should be fine since the OSEM should not be 0 anywhere in the FOV.
Dataset
as returned bypetric.get_data
should have another memberFOV_mask
, which is asirf.STIR.ImageData
which is zero where the solution has to be zero, and 1 where the solution has to be non-negative.