File Exchange

image thumbnail

Polar Onion Peeling

version 1.6 (15.9 MB) by

Apply polar onion peeling method for analyzing velocity map imaging (VMI) data.

7 Downloads

Updated

View License

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

Comments and Ratings (13)

Natan

Natan (view profile)

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...

Hey Natan,
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?

Natan

Natan (view profile)

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.

Paul Kassebaum

Paul Kassebaum (view profile)

Hi Natan, your link to the AIP paper in the description of your File Exchange entry (above) returns a 404 page not found.

Bennet Krebs

Hey Natan,
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.

Bennet Krebs

Hello Natan,
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.

Natan

Natan (view profile)

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...

Bennet Krebs

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)
zz=t2f(iradeconExp,l,PPR,AngleInc);

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.

Ablikim

Thanks Natan for the inversion code. Hopefully it works for me. I will try it on my ion/electron raw images. :)

Natan

Natan (view profile)

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.

Pengju

Pengju (view profile)

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
sqp(ii,:)=interp1(1:nzpr(ii),iraraw(ii,1:nzpr(ii)),linspace(1,nzpr(ii),N),'spline');

My image size is 990*990 (double)as .mat file.

Would you please give me some advice?

Natan

Natan (view profile)

@Luis, if you press "Download Submission" you'll get a zip file (pop.zip) that contains also delta_lut.mat ...

Luis

Luis (view profile)

Tried to test it but couldn't find delta_lut.mat, thanks

Updates

1.6

......

1.6

corrected link in the file description and included PESR - the radial projection of the raw data in the output

1.6

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.

1.5

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.

1.4

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.

1.3

added Matlab version control to use the proper interpolator name.

1.2

Added support in specific image quadrants analysis in case of image asymmetries. Improved documentation and warnings\errors handling.

1.1

The code now supports higher order Legendre polynomials, this was done with the help of Adam Chatterley.

MATLAB Release
MATLAB 8.2 (R2013b)

MATLAB Online Live Editor Challenge

Win cash prizes and have your live script featured on our website

Learn more

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video