comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Pixel positions passing trough a curve
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Pixel positions passing trough a curve [message #93735 is a reply to message #93734] Tue, 11 October 2016 07:01 Go to previous messageGo to previous message
Helder Marchetto is currently offline  Helder Marchetto
Messages: 520
Registered: November 2011
Senior Member
On Tuesday, October 11, 2016 at 3:06:01 PM UTC+2, Helder wrote:
> On Tuesday, October 11, 2016 at 2:36:44 PM UTC+2, miguelfigue...@gmail.com wrote:
>> Hi everyone,
>>
>> I am trying to construct a program that produces a position-velocity diagram whose shape can be fitted by a certain equation (and plotted).
>>
>> I wanted to know if it was possible to obtain somehow the pixels position trough a path I choose. For example, I draw a line (in ds9) from (0,0) to (10,0) and I want to know which pixels represent the line. In this case, the program would give (0,0), (1,0), (2,0),...,(10,0). The thing is that I want to draw an arbitrary path (not necesarily in ds9) and get automatically the points.
>>
>> For the moment, I put a circle, in ds9, in each pixel of the path and obtain the list of pixel positions and saving the region in xy format. I use this catalogue as an input of my program.
>> If there is a way to do it automatically (or some ideas) or an already existing program, I would like to know more.
>>
>> Thank you,
>> Miguel
>
> A counter-question: if going from (0,0) to (10,10), would you want:
> (a) (0,0), (1,1), (2,2),...,(9,9),(10,10)
> (b) (0,0), (1*cos(45),1*sin(45)), (2*cos(45),2*sin(45)), ...
>
> That said, as you can see, it's all about trigonometry and getting the details right. I've done this quite a few time using approach (b). If you wish, I can clean this up a bit and send it to your private email. Be aware that I've added a small degree of complexity by averaging along the perpendicular of x-pixel width (smoothens out the signal a bit).
>
> cheers, Helder

Ok, so I just put all the code online. Notice that I follow solution (b).
You can find the code in the post:
http://idl.marchetto.de/getting-line-profiles/

Let me know if you can recommend any improvements of any type or if you find any bugs. I haven't really made any checks to make sure the point are inside or are not too close to one another and so on...

Cheers,
Helder

PS: if you want to use a circle, you can obviously calculate the points as [2,n] array, however it is quite important to get the n value right, otherwise things don't work so well...
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: IDL intro
Next Topic: ncdf_varput for NetCDF coordinate axes

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 11:34:23 PDT 2025

Total time taken to generate the page: 0.00446 seconds