xcist / main

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

Negative values after simulation #65

Closed lhr522857918 closed 6 months ago

lhr522857918 commented 6 months ago

Hi

Thanks so much for the hard work.

I am encountered with this issue that after I simulate the projections with the scatter, the air area around the object has negative values. I am using the simulation code in the example while the simulation of noise-free version turns out to be successful. Have you any idea what could be the problem. I attach the code. ct1 = xc.CatSim("/home/lhrrr/Desktop/task1/json/1/para") # initialization

--------- Make changes to parameters (optional)

ct1.resultsName = "test_sc" ct1.physics.scatterCallback = "Scatter_ConvolutionModel" # scatter model ct1.physics.scatterKernelCallback = "" # using default ct1.physics.scatterScaleFactor = 80

ct1.protocol.viewsPerRotation = 32 ct1.protocol.viewCount = ct1.protocol.viewsPerRotation ct1.protocol.stopViewId = ct1.protocol.viewCount-1

ct1.scanner.detectorRowsPerMod = 512 ct1.scanner.detectorRowCount = ct1.scanner.detectorRowsPerMod

ct1.scanner.detectorColPerMod = 512 ct1.scanner.detectorColCount = ct1.scanner.detectorColPerMod

--------- Run simulation

ct1.run_all() # run the scans defined by protocol.scanTypes

image scatted image image Scatter free image from same recon image

zhangjy-ge commented 6 months ago

Hi,

It seems to me those negative pixels are due to too high scatter in your simulations, specifically the parameters of ct1.physics.scatterScaleFactor = 80 seems too large to me. If there are no real reasons, you may try to set it to 1 and see how it goes.

Best, Jiayong

lhr522857918 commented 6 months ago

Hi

Thanks so much for your quick response! May I ask what the scatter factor means physically.

I tried factor = 1, some pixels still have negative values, what is a suggested nominal value to use for cone beam?

Thanks again. Best.

zhangjy-ge commented 6 months ago

The scatter scale factor means w in the following formula [https://doi.org/10.1088/1361-6560/ac9174]:

image

which is used to adjust SPR. A scale factor of 1 roughly corresponds to SPR of 15%, so you might change this factor linearly accordingly based on your specific SPR, but 80 is a too large number. Since we don't know your system and SPR, we cannot suggest a value.

Another thing you could try is to add scatter correction, by setting: physics.callback_pre_log = "Scatter_Correction" physics.scatterCorrectionScaleFactor = 1

It is normal to have some negative values due to scatter. As long as you have reasonable scale factor (and correction), those negative values should be very small or gone.

lhr522857918 commented 6 months ago

Hi, I checked with scatter factor = 1 and scatter correction, some parts of the projection is still negative. I am wondering how you converted the detector signal(yi) into the projection(the prep in your simulation), since I checked that each element in the equation shall be all non-negative. I am guessing that the step converting yi to the output projection may cause negative values, could you please tell me how you did it. image

Thanks again for your great effort.

Best.

MingyeWu commented 6 months ago

Hi, Thanks for testing this. The negative value in the p-value (after -log) is due to scatters cause some pixels to have even more signal than airscan, which happens around the edge of the object, unless there's a perfect scatter correction. I have updated PrepView.py to avoid this issue by simply zeroing all negative p-values.

Mingye

lhr522857918 commented 6 months ago

Hi Thanks so much for your clarification and remarkable work!

Best