Average Radial profile of 3D and 2D wave
Hello,
I have solved this long time ago by cumbersome code. On larger (especially 3D) waves my current solution seems to be getting slow. May be I am missing some obvious elegant (and faster) solution in the latest Igor versions simply by not knowing what to look for?
I have either 2D or 3D wave which has defined "center point" (p,q,(r), which I know). I want to know average of all values which have the same distance from the center (as function of the distance). Ideally with statistical analysis (average, standard deviation, etc.).
I can do ImageLineProfile on 2D wave through the center point, and I get line profile in a specific direction. But I need to get average over line profiles in all directions, for 2D and 3D waves.
My current solution creates new Distance wave, calculates distance from center for each point and puts this in this Distance wave. Then it converts these 2D or 3D waves into 1D waves, uses the Distance wave as sortKeyWave to sort the values and distances (as 1D wave) as increasing distance. Then it uses Histogram function to "bin" the results based on distances from the center. After some minor number gymnastics I get average value for each radial distance bin as well as standard deviation. So this works fine... Until we get to large waves where the number of points get large.
Is there any better, more elegant, solution I am missing? Any new useful Igor functions I am missing? Anything new planned for Igor 9?
Thanks
Jan
Did you see the results of my Radial Profiler package? Would that do what you need?
Edit: I see now that you want to do analysis from a center point in a 3-D system. The radial profiler analyzes a 2-D image.
One approach is to add to the code segment that I have for the "brute force" point-by-point to a 3-D level. Add an additional for(iz ...) endfor loop inside the x - y loop. The R distance is computed as R^2 = x^2 + y^2 + z^2.
February 21, 2020 at 12:47 pm - Permalink