Re: IDL Average Value Graphs [message #61511 is a reply to message #61413] |
Thu, 17 July 2008 11:02  |
andybohn
Messages: 5 Registered: July 2008
|
Junior Member |
|
|
On Jul 17, 1:19 pm, Jean H <jghas...@DELTHIS.ucalgary.ANDTHIS.ca>
wrote:
>> I've been playing with POLYFILLV, and it (eventually) seems helpful.
>> It is a bit annoying that it returns a 1d array that has to be
>> converted back to a 2d array, but that's alright.
>
> ?? ... just use the 1D array when you do your math!
> pieCoord1D = [110,111,210,211]
> PiePixels = data2D[pieCoord1D]
>
> I'm still playing
>
>> with the pie slices at the moment, and I didn't think of it at the
>> time, but if I don't inscribe a circle in the square image, then I
>> will get unequal areas for each slice.
>
> ... yes... same thing will happen on the edge of the image.
>
>> So your pie program creates a 100 sided polygon that would emulate a
>> circle, then two more points to get back to the origin. Couldn't the
>> 100 sided polygon be created, then for finding the pixels in between
>> the two circles, use POLYFILLV on the larger circle, then subtract the
>> smaller one?
>
> Yes, this is correct. Though I would not use the pie program with an
> angle of 360 degrees (what would be the consequences of the line to the
> center of the circle??). Use a function to create a plain circle:http://www.dfanning.com/tips/make_circle.html
>
> Also, I really like the way you created the polygon
>
>> array, however I'm not entirely sure how arc_x and arc_y get added to
>> the final points.
>
> arc_X and arc_Y are the 100 points forming the arc.
> By doing x = [x_center, arc_x, x_center] , I simply add, in 1st and last
> position, the coord of the center of the circle. The X and Y arrays
> therefore represent the coord of the points starting at the center of
> the circle, going through the 100 points of the arc and then back to the
> center. It is a closed polygon.
>
> Jean
>
>
>
>> Thanks for the help!
>> Andy
I needed the 2d coordinates because I'm dealing with FITS images, so I
need to grab the value of each of the pixels in a given region, unless
I'm missing an easier way to do this.
Sorry, this is actually my first program in IDL, so I'm trying to get
my head out of C# and C++ syntax and methods and into IDL. I missed
the arc_x written in the middle of the array. This has been very
helpful. I have one more question about POLYFILLV. If a line goes
through a pixel, does it not include this pixel in the region? Does
it include it if it is more than half way inside the region? If so,
what happens to perfectly split pixels?
Thanks a lot for the help,
Andy
|
|
|