Open epapoutsellis opened 12 months ago
@epapoutsellis thanks for this detailed report.
It looks like there are 2 issues we should deal with:
xrmreader
package and it seems it has 1 version only and the license is similar to MIT.Maybe you can join the next developer's meeting or the user support.
@paskino Apologies but have meetings Tuesday and Friday. Will try to join on Friday. This is a recent package from Andreas Maier group.
What do you mean by per-projection geometry setup
? I strongly suggest to use a parallel processing library to do all these shift corrections for all projections. Otherwise, it takes A LOT OF TIME. You know my favourite library for it.
I mean that we don't have to apply the shifts at all, just record them in the geometry of each projection. Then we pass this info to the engine which will do the projection.
Feel free to suggest another meeting time if those don't work for you.
@epapoutsellis can you list the additional parameters you require? These could be added to dxchange with a PR.
Thanks for sharing a ZEISS reference.
After discussion with @epapoutsellis @gfardell @effepivi we propose to tackle the reader issues in different ways:
np.roll
in favour of scipy.shift
with default to do same as what we do now (no backward incompatibility)
For about one month, I have been trying to reconstruct a dataset (cone-beam geometry) using the ZeissDataReader, and I found some bugs in terms of reading the actual
data
and reading themetadata
.dxchange
instead of xrmreader, we lose some important information for the metadata. For my data, if I usedxchange.read_txrm(filename_sinogram)
function the keys of the metadata dictionary arexrmreader.read_metadata(filename_sinogram)
function the keys of the metadata dictionary areI do not know why, but the latter seems more complete. Besides the
x-shifts
,y-shifts
and thereference
we have more important shifts such as AMC, temperature and source. For more information, see here. There are also some other keys which I have no idea what they describe, such asalign-mode
,cone_angle
,fan_angle
,camera_offset
,scaling_min
,scaling_max
. If anyone is familiar with these keys, I would really appreciate some explanation.Example
If we use the
ZeissDataReader
to read the WalnutData, everything is ok. Using thexrmreader.read_metadata(filename_sinogram)
function, theAMC
,temperature
areNone
but thesource-x-shifts
andsource-y-shifts
are close to 0, meaning that we do not need to include this correction.However, in my data I have something like:
meaning that somehow we need to correct our projections for all of these shifts.
Solution
I have tried a lot of things which I will not mention here, in order to understand what is the problem with the CIL reconstruction and why is so different from the
recon.txrm
which I guess is from a Zeiss software. The problem is in the following lineshttps://github.com/TomographicImaging/CIL/blob/be57697c96d3e66032bac5de5246d0d276e3ba1e/Wrappers/Python/cil/io/ZEISSDataReader.py#L273-L276
We use
np.roll
which works only with integer values. Meaning that with anint
rounding we do not perform a good interpolation. Actually, all the values in thex-shifts
andy-shifts
vectors that are in $\in(-1. , 1.)$ will end up to be 0 after the rounding. Below are two histogram plots of they-shifts
restricted to $\in(-1. , 1.)$ for the Walnut dataset with/without theint
roundingWhy the Walnut recon looks correct using the np.roll and the
int
rounding???Because the number of projections (108) where the
y-shifts
is $\in(-1. , 1.)$ is small compared to the total number of projections(800).In my dataset the histogram plots are:
which means that the
y-shifts
for 300 projections out of 800 projections were approximated by 0.Correct Implementation
is using the shift by
scipy
. This is howxrmreader
implements the interpolation for all the shifts. Although, I am not sure ifnearest
mode and order1
are good defaults.In my case, I need also to correct for
AMC
,temperature
,source
shifts as well as to correct for the offset due to thecenter_shift
. Below is a comparison, with all these different options a) usingnp.roll
for x/y shifts, b) usingscipy.shift
for x/y shifts, c) usingscipy.shift
for all shifts & correcting the offset and d) thetxrm.recon
.@antonyvam for future reference.