Imagelineprofile /RAD flag and number of data points
Hi,
I am interested in getting the line profile of points from an image and I am interested in only a defined arc, subset of the circle. I am using the imagelineprofile with the /RAD flag. To get a subset of the circle I am paying attention to the number of data points. Per the documentation the last parameter in the /Rad is the angle in radians. When I set that value to 0.001 I get 6283 datapoints as expected (2*pi=6.283 radians). However as in this code, I set the angle delta to 0.01 with the expectation of getting 628 datapoints, but the resulting wave, w_imagelineprofile, has 5026 datapoints. Hence my confusion. What should I expectation be for the number of datapoints for the path depending on the angle delta?
DFREF saved = getdataFolderDFR()
setdataFolder root:
wave tem,radius
//radius wave has X,Y coordinates for point 1, center, point 2
variable ulna
//calculate the radial distance as 0.9 the average of the 2 points
ulna = sqrt((radius[1][0] -radius[0][0])^2 +(radius[1][1] -radius[0][1])^2)
ulna = 0.9*(ulna +sqrt((radius[1][0] -radius[2][0])^2 +(radius[1][1] -radius[2][1])^2))/2
imagelineProfile /RAD={radius[1][0],radius[1][1],ulna,20,0.01} srcwave =tem
setdataFolder saved
end
Andy
Here is an example:
•newimage ddd
ImagelineProfile/RAD={100,100,24.5,0,0.01} srcWave=ddd
print numpnts(w_imageLineProfile)
628
ImagelineProfile/RAD={100,100,24.5,5,0.01} srcWave=ddd
print numpnts(w_imageLineProfile)
628
October 1, 2024 at 03:12 pm - Permalink
Hi,
I am having trouble reproducing your results. Attached is a minimal experiment. I set a variable that sets the angle delta. Why aren't I getting similar results.
Andy
DFREF saved = getdataFolderDFR()
setdataFolder root:
wave radius,tem
//radius wave has X,Y coordinates for point 1, center, point 2
variable ulna
ulna = sqrt((radius[1][0] -radius[0][0])^2 +(radius[1][1] -radius[0][1])^2)
ulna = (ulna +sqrt((radius[1][0] -radius[2][0])^2 +(radius[1][1] -radius[2][1])^2))/2
imagelineProfile /RAD={radius[1][0],radius[1][1],ulna,20,angleDelta} srcwave =tem
wave ILP = W_ImageLineProfile
print numpnts(ILP)
setdataFolder saved
end
October 1, 2024 at 04:12 pm - Permalink
Andy,
Running your experiment here (IP9.03 Mac) I changed your print line to:
I then run your command:
6283 6283
I also tested with the 9.06 nightly build and I get the same results.
October 3, 2024 at 11:25 am - Permalink
In reply to Andy, Running your… by Igor
What happens when you run calc_circum(0.01)? The expected result is 628, but when I run it I get 5706 and that is what I am trying to understand.
.
Andy
October 3, 2024 at 12:42 pm - Permalink
Andy,
When you reduce the differential angle (say to 0.1) you are passing "circles" consisting of 63 straight line segments to the lineProfile sampler. As is the case with other paths, the operation determines the required output resolution for the path that is calculated for each one of the line segments. In a normal application of ImageLineProfile you have the option to use the /V flag to restrict the operation to computing the profile only at the vertices that you specify. For some reason, this flag was considered incompatible with /RAD (I take full responsibility).
The actual calculation uses approximately the number of pixels within the segment. If that number of samples is too large for you and you want to sample at a lower rate, the workaround is to create a pair of XY waves for the circle having the exact number of segments that you desire and then execute ImageLineProfile using the /V flag.
AG
October 3, 2024 at 04:10 pm - Permalink