xcist / main

simulation and reconstruction package
BSD 3-Clause "New" or "Revised" License
45 stars 20 forks source link

Is it possible to obtain the detected spectrum? #37

Closed juanenofbit closed 1 year ago

juanenofbit commented 1 year ago

I wonder if it is possible to know the detected X-ray spectrum, or the number of photons per energy bin, actually detected in a simulation.

I can determine the emission spectrum (via the protocol.spectrumFilename parameter file) but due to pre-filter effects, detector efficiency, etc., I don't know the detected spectrum, which I need to estimate or measure for the analytical beam-hardening correction I am working on.

For traditional correction using a water phantom, this detected spectrum is not necessary if attenuations are measured at different thicknesses to make the polynomial fit (besides, I have seen that this simulation and correction is already integrated in Xcist).

But it would be very helpful to know the detected spectrum for advanced corrections with mixed materials.

Thanks in advance!

zhangjy-ge commented 1 year ago

It is possible to obtain the detected spectrum by tweaking the xcist code. For example, what I would possibly try is 1) change to a large energy bin number in physics.energyCount, and change physics.viewSampleCount to 1 (so that we don't need to worry about subview) 2) check the results of thisSubView before this line: https://github.com/xcist/main/blob/9ddc90bd6a0291f130dbcca504a8358df5b6fc05/catsim/pyfiles/Detection_EI.py#L33. Note that thisSubView should be of shape [detectorColCount*detectorRowCount (because detectors cells have been flatten here), physics.energyCount], so you may choose a cell and plot its thisSubView along the energy dimension to see something like detected spectrum.