While my question is similar to this one, the suggestions offered there won't work for my specific situation. For over a month I've been trying to find software capable of this but it's been an unsuccessful search. I don't think the software exists; however, I haven't asked this group yet. I sure hope I'm wrong.

The Problem

  • if I crop a fits image, the WCS is lost (which makes sense, the image has changed) but the cropping software won't recompute the WCS for the new area and add it back into the new header

The Data Set

  • a collection of .fits image files created by a CCD (not tables or any other kind of .fits file)
  • each individual image is large in terms of degrees of sky
  • minimum number of files in set: ~1,150 and max number is: ~15,000
  • each image has the WCS info in the header
  • each image is registered on a sub pixel level to the others

Software Requirements

  • IS NOT PYTHON unless it has a GUI interface hiding all evidence of Python code
  • runs in local Windows environment, not cloud based
  • works in a batch or bulk mode
  • copies the header from the original but updates the WCS entries
  • updates the other headers as necessary such as NAXIS1

Additional info: why standard methods don't work

  • the images can't be plate solved by astrometry dot net (they are very out of focus (on purpose with a diffuser) or the plate scale is extreme at over 20 arc-secs per pixel which looks out of focus but isn't)
  • while the crop with WCS update could be done in Python, this project requires a GUI

I've tried SAOimageDS9, AstroImajeJ, PixInsight, Mira, and MaxIm DL 6 Pro but they don't recompute the WCS entries. My goal is to create a procedure to do aperture photometry on special data sets without using Python but first I need to determine if it's possible. A crop is required before all else due to the size of the data.

When working with other data sets, cropping issue isn't a problem. The images are registered, then the crop is performed (as well as any 'rotate 180 deg' or mirror left/right/top/bottom). It removes the WSC headers but plate solving the new, smaller, postage stamp image puts the corrected ones back in.

If anyone knows of software to crop fits images and return correct WCS headers, it would help tremendously.

  • 3
    $\begingroup$ You say both that you want it to have a GUI and that you want it to work in batch mode (which is understandable for processing thousands of images). Could you clarify what needs to happen in the GUI and what would happen non-interactively? I’m trying to understand better what your use case is here, and especially what the role of the GUI is. $\endgroup$ Jul 23 '20 at 0:37
  • 1
    $\begingroup$ Just to correct something from the question, AstroImageJ does have a crop option, including for a stack of images. Just choose the rectangle tool, drag, and then choose Image->Crop. It doesn't save the WCS, though apparently that is on the development roadmap. SAOImage ds9 also has a crop option in the menus, though I couldn't figure out how to make it work, at least on the Mac version - it kept reverting to the original image. $\endgroup$ Jul 23 '20 at 13:18
  • 5
    $\begingroup$ Python doesn't mean "no GUI." See Tkinter, PyQt, wxPython... $\endgroup$
    – Mike G
    Jul 23 '20 at 15:26
  • 1
    $\begingroup$ saods9 can recompute the WCS. You got to File->Save Image->FITS. This writes the displayed image as a new FITS file, complete with any cropping and zooming included in the WCS. If you change your window size to be what you want to crop, this will do the cropping (if zoom=1). You can do Match->Frame->WCS to match each image before you do the saving. Of course it's easier to just crop the FITS table then decrement CRPIX1 and CRPIX2 headers by how much you have chopped off the side. $\endgroup$
    – xioxox
    Jul 27 '20 at 14:58
  • 1
    $\begingroup$ Aladin (aladin.u-strasbg.fr) does cropping. You can load the FITS images as separate planes. Then go to Image->Crop Image Area. Draw a rectangle. Then you can save the loaded images ("planes") by going to File->Export Planes. $\endgroup$
    – xioxox
    Jul 27 '20 at 15:17

Skycat also stores the WCS information when selecting an image region from a fits file. Not sure how exactly this can be done in non-interactive mode but many features can in fact be "batched". Give it a try. Best luck!


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.