will.flanagan |
05/19/2009 05:41PM (Read 4325 times)
|
|
|
Status: offline
Registered: 04/25/2009
Posts: 6
|
Hi IRAFers,I have a question that is very basic but I can't figure out nonetheless:If you have a dither pattern of say 9 images (partially overlapping images) and you want to trim out the points that are in less than say 5 images - how would you do that? That is, I only want to combine the images where they overlap in at least 5 images, for example.Or simpler yet, what if I have to images and I want to trim both the images where they don't overlap...I've been looking at the imcombine and imcopy keywords, but haven't found what I'm looking for. You can assume that the images have good world coordinates to use for figuring out overlap.Cheers and thanks in advance for any comments!
-Will
|
|
|
|
DAstronomer |
05/19/2009 05:41PM
|
|
|
Status: offline
Registered: 05/14/2009
Posts: 2
|
Hia Will,Yep, there's a way to do it. Use IMALIGN and then IMCOMBINE. What I would do is read thru the help file and get familiar with it. There's a simple way to generate the shifts file: Use IMCOMBINE, with offsets="wcs". Make a dummy out list and ignore it, using only the text output generated. You can find the text output by simply using vi or vim (or whatever text editor you want) to look at the logfile. Name it something obvious and grab the shifts from it. Save the shifts as your new shifts file for IMALIGN.And when I think about it, you don't have to ignore the outputted files. You can check your output from IMCOMBINE against the output from IMALIGN+IMCOMBINE and see how closely they agree.IMALIGN does require reference coords (in pixel coordinates). These don't need to be very accurate; within 3 pixels is ok. Choose 3-5 stars that are common to each image and put their coordinates into a file called "whatever.coord". Now you have your reference image (the first image on the input list, the one that the stellar coordinates are derived from), your coords file (with the stellar coords), and you're now set. The keywords to set is trimimages=yes & shifts="shiftsfile" (whiere shiftsfile is a file with the offsets from the first run of IMCOMBINE).This will trim the input images to only the areas that are common to all of the images. After running IMALIGN, run IMCOMBINE again, this time with the offsets="none". This will output your final, trimmed image.This is a little roundabout, but it goes quickly after a few practice rounds :-)
Cheers,
-DAstronomer
|
|
|
|
will.flanagan |
05/19/2009 05:41PM
|
|
|
Status: offline
Registered: 04/25/2009
Posts: 6
|
First off - Thanks DAstronomer!Second - I was also wondering if there are any more automatic ways to do it since I need to do this to ~1000 images. All of the images have good world coordinates to begin with so specifying pixel/coordinate inputs for various stars in each image seems redundant.I appreciate any input - Thanks!
Will
|
|
|
|
valdes |
05/19/2009 05:41PM
|
|
|
Status: offline
Registered: 11/11/2005
Posts: 728
|
Hello Will,It is true that imcombine is designed to give you the maximum image that contains all the input data; i.e. the union. What I guess you want is the intersection and imcombine doesn't provide this though I think I thought about this once.You comment about a criterion such as "at least five images overlapping" points me to the idea of using the output of imcombine that gives you the number combined in some way. However, the only easy thing I can think of is to use it to set all pixels with too few contributions to some number (with imexpr). How to then find the rectangular border containing the remaining data is not clear though it would be possible to write a script. The IRAF way would be to somehow generate an image section string, then a simple imcopy with the section concatenated to the image would do the trimming. But I don't see a simple way to compute the section. It would possibly be done by taking projections (collapsing the image or the number combined mask) to 1D along x and y, dump the values to text with listpix, and have a loop that goes from each end to the point where are enough pixels, and finally use the variables to create the section string.A question is why you need the image trimmed. If it is to save space then you do need to trim. But if it is to run an application that only considers data with sufficient overlap then maybe the application can make use of masks or can exclude data with values below or above some threshold (i.e. apply the mask with imexpr to set the image values to some magic value such as zero of -1000, etc.)I hope this helps.Yours,
Frank Valdes
|
|
|
|
Arp |
05/19/2009 05:41PM
|
|
|
Status: offline
Registered: 06/15/2009
Posts: 34
|
Hi Will!Did you found a solution? Because I have to do this too for about 400 images. But I dont care how many images overlap...But I have mosaics, not dithered images. And such a mosaic is, depending on the imaged fields, not rectangular.
|
|
|
|