Script to display image and center on a star
Script to display image and center on a star
I have an external application on Windows that performs a Database function on my FITS image library. What I want to do is using the DB manager to select an image and a specific star (x,y pixel coordinates) on the image and have AA display the image, center the image on the star and zoom to a specified level. Is this possible with the existing scripting language or does this require new image. functions?
I need something like this:
Image.Open(FITS image path)
Image.Center(x,y)
Image.Zoom(50%)
Image.Crosshairs(ON)
Craig
I need something like this:
Image.Open(FITS image path)
Image.Center(x,y)
Image.Zoom(50%)
Image.Crosshairs(ON)
Craig
Re: Script to display image and center on a star
Hello, may you give more details about the next steps? Or the script will end there?
For example, you may consider to isolate that region, for better visualization:
Image.Crop(x-50, y-50, x+50, y+50)
Is zoom 50% intended to shrink the image?
The crosshairs will be added automatically when the star is collected by:
Image.Stars.Find()
(after the region have been cropped)
Isn't RA and DEC available? You could collect the star with Image.Stars.Add(RA,DEC), then read its X,Y coordinate, then crop around it, etc.
Script commands can be easily added if required.
Fabio.
For example, you may consider to isolate that region, for better visualization:
Image.Crop(x-50, y-50, x+50, y+50)
Is zoom 50% intended to shrink the image?
The crosshairs will be added automatically when the star is collected by:
Image.Stars.Find()
(after the region have been cropped)
Isn't RA and DEC available? You could collect the star with Image.Stars.Add(RA,DEC), then read its X,Y coordinate, then crop around it, etc.
Script commands can be easily added if required.
Fabio.
Re: Script to display image and center on a star
The crop function might work, I will give it a try. Is "crop" relative or absolute? In other words, if I do a subsequent crop is it applied to the current crop or back to the original image?
The Stars Find might also work since I can add to it.
I will try both functions and come back. Hopefully a new script command is not needed.
Craig
The Stars Find might also work since I can add to it.
I will try both functions and come back. Hopefully a new script command is not needed.
Craig
Re: Script to display image and center on a star
I tried the Crop function but it is a bit awkward. The image is indeed cropped and the window migrates across the screen as various stars are viewed. I think a much better method would be to pan and zoom. Can we add this function:
Image.Pan(x,y) which centers the image in the window at x and y, and
this would be equivalent to moving mouse with right button down
Image.Zoom(%) which zooms in or our depending on the %. Same as the menu item zoom but instead of a table it uses a variable.
Craig
Image.Pan(x,y) which centers the image in the window at x and y, and
this would be equivalent to moving mouse with right button down
Image.Zoom(%) which zooms in or our depending on the %. Same as the menu item zoom but instead of a table it uses a variable.
Craig
Re: Script to display image and center on a star
So, the script needs to repeat the process on several zones of the same image? In this case I agree that the crop is not useful.
After panning and zooming the script to the given coordinates, is the script ended? This means that the user is then responsible for some manual tasks? If yes, for testing you can proceed this way: complete the script, without the final panning/zooming and let the user to pan/zoom manually (you can communicate the zone in several ways, printing the coordinates or drawing like in the subroutine below) then contact me by email to test the pan/zoom function which will be added for SP4. Here's an example:
After panning and zooming the script to the given coordinates, is the script ended? This means that the user is then responsible for some manual tasks? If yes, for testing you can proceed this way: complete the script, without the final panning/zooming and let the user to pan/zoom manually (you can communicate the zone in several ways, printing the coordinates or drawing like in the subroutine below) then contact me by email to test the pan/zoom function which will be added for SP4. Here's an example:
Code: Select all
sub DrawCircle(x,y)
r = 20
for i = 1 to 30
a = i / 30 * PI*2
Image.SetPixel(x+r*Cos(a), y+r*Sin(a), 30000)
next i
Image.Update
end sub
Re: Script to display image and center on a star
Correct, the application will jump to different locations on the image. Here is a bit more detail about my external software application.
The software program is written in Lazarus Pascal. It sets up a Data Base for several thousand CCD images that I have acquired over the last couple of years (photometry based research project). The program begins by listing all of the observational nights that contain images, there can be several hundred images per night. Clicking on an observation night then lists all of the images taken that night. Usually 2 or 3 targets imaged in Sloan SG,SR,SI filters. Selecting an image then displays a locally generated catalog of all the photometric stars on that image. Selecting a star then shows the photometric measurements for that star. So a sort of top down approach. In addition, the program displays all of the photometric measurements for that star for that night.
But sometimes the star may behave a bit odd and it is then desired to look at that measurement along with one or more other stars on the same image. So by clicking a display button the software then calls AA to display the image and center on the star. By clicking the other comparison stars AA would then jump to those to see if there was something unusual on this image, for example, a satellite trail passing though or nearby one of the stars, or a cosmic ray hit, either of which would throw off the photometric measurement.
So the desire is to easily look at one or more stars on the image by panning the image to the star, centering on it and zooming it to some level. After that I can use the controls on AA to move the pan or change the zoom level, and also do other things such as statistics or profiles, etc.
I will contact you by email to test the pan and zoom function. This will be a great addition to the scripting functions and I really appreciate you adding this.
Craig
The software program is written in Lazarus Pascal. It sets up a Data Base for several thousand CCD images that I have acquired over the last couple of years (photometry based research project). The program begins by listing all of the observational nights that contain images, there can be several hundred images per night. Clicking on an observation night then lists all of the images taken that night. Usually 2 or 3 targets imaged in Sloan SG,SR,SI filters. Selecting an image then displays a locally generated catalog of all the photometric stars on that image. Selecting a star then shows the photometric measurements for that star. So a sort of top down approach. In addition, the program displays all of the photometric measurements for that star for that night.
But sometimes the star may behave a bit odd and it is then desired to look at that measurement along with one or more other stars on the same image. So by clicking a display button the software then calls AA to display the image and center on the star. By clicking the other comparison stars AA would then jump to those to see if there was something unusual on this image, for example, a satellite trail passing though or nearby one of the stars, or a cosmic ray hit, either of which would throw off the photometric measurement.
So the desire is to easily look at one or more stars on the image by panning the image to the star, centering on it and zooming it to some level. After that I can use the controls on AA to move the pan or change the zoom level, and also do other things such as statistics or profiles, etc.
I will contact you by email to test the pan and zoom function. This will be a great addition to the scripting functions and I really appreciate you adding this.
Craig