The code implements the method shown at "Toward real-time charged-particle image reconstruction using polar onion-peeling" by G.M. Roberts et-al, Rev. Sci. Instr. 80, 053104 (2009). It supports images of up to 4K and accepts arbitrary (even) beta parameters. Specific quadrants of the image can be selected in the analysis in case of image asymmetries. NaN values can be used for masking unwanted pixels or areas.
For more info regarding the method see: https://doi.org/10.1063/1.3126527
Natan (2019). PolarOnionPeeling (https://www.github.com/adinatan/PolarOnionPeeling), GitHub. Retrieved .
Hi Malte, I probably did that to play with the visibility of the deconvolved signal at higher r values, and forgot to un-comment it. the sqrt(r) is a just scaling factor,feel free to un-comment if you want to have the original code purpose. I'll edit this in the next round of updates...
while working with your code i noticed you had commented out the /sqrt(r) in lines 331 and 334 of POP.m.
Those remove the effect of pixelation as described in the paper.
Was there a specific reason for leaving them out?
Hi Paul and Bennet, I've updated the broken link (though the paper's details are mentioned above. Thanks for spotting this. Bennet, the "s.betas" typo was just in the commented code header, the output was always s.Betas as you saw with the pop_example.m script I've included. I've also added PESR to the output for what it's worth, I excluded it before because I didn't needed it, but now it is back again, as it doesn't cost anything, and it can be also calculated outside of the for loop.
Hi Natan, your link to the AIP paper in the description of your File Exchange entry (above) returns a 404 page not found.
I just looked over your new code and I think I found some discrepancies between what your introduction says the outputs would be, and whats actually in the structure "s".
You state that your output structure "s" always contains 8 fields. The actual output is missing "s.PESR", but additionally contains the deconvoluted "s.sqpde" field. Also "s.betas" is actually upper case "s.Betas".
As far as I can see "s.PESR" is actually calculated in the "tripolar" function (however its not 1D yet), but then discarded.
I am an amateur when it comes to Matlab, so maybe I'm missing something here.
I managed to fix the problem shortly after i posted here, so I didn't remember to check in again, sorry. Basicly (if I remember correctly) there was a problem with naming variables i.e. some 2d rectangular array suddenly changed its varable name inside the code so the script broke down. But you probably already found that yourself, since this version of the script works nicely. Thanks again for your work, it is very helpful.
On another note, the link in your description results in a 404 for me.
Hi Bennet, Can you please send me a sample of the code you are using, I manage to get the iradeconExp info... I'll also soon update the code with a more current version that allows for masking with NaN...
Hi Natan, your code is very useful and i appreciate the time you took making it public.
My problem it with the "experimental image". I cannot seem to get your code to work with the 'exp' parameter, the following error occurs:
Error using POP>t2f (line 294)
Not enough input arguments.
Error in POP (line 249)
Error in TESTBED (line 2)
s=POP(im,2:2:4, 1:4, 'exp');
I tired it with multiple of my own VMI-Spectra and your testfile, which all work perfect with the 'sim' setting.
I'm currently reading through your refereed paper and the code itself, so maybe I find the answer in there.
Thanks Natan for the inversion code. Hopefully it works for me. I will try it on my ion/electron raw images. :)
Your data is probably all zeros in some radius, so the interpolation is not possible. Just add to your data a negligible const value, like: data=data+eps; to solve it. I'll update the code with a try\catch case in that loop for this case in the future.
The code is very cool!
I tried my images, it works very well and fast.
It can also give higher order beta, amazing.
But still some of my images meet one error as:
??? Error using ==> interp1 at 184
There should be at least two data points.
Error in ==> POP at 234
My image size is 990*990 (double)as .mat file.
Would you please give me some advice?
@Luis, if you press "Download Submission" you'll get a zip file (pop.zip) that contains also delta_lut.mat ...
Tried to test it but couldn't find delta_lut.mat, thanks
Added documentation regarding the tripol function
supports negative values (difference images)
corrected link in the file description and included PESR - the radial projection of the raw data in the output
Support in NaN values for masking the raw images was added, the code is restructured for better readability and a sample script to demonstrate how it works was added.
The code supports images of up to 4K. bld_lut.m was added for radial basis set generation of arbitrary size. Code improvements include applying better matrix inversion method, avoiding divergences at the origin artifacts and other minor improvements.
Faster code, some minor debugging for the case of all zeros data, improved support in higher Legendre polynomials up to the floating point accuracy limit.
added Matlab version control to use the proper interpolator name.
Added support in specific image quadrants analysis in case of image asymmetries. Improved documentation and warnings\errors handling.
The code now supports higher order Legendre polynomials, this was done with the help of Adam Chatterley.