mProject(1) Re-project FITS images


mProject [-z factor] [-d level] [-s statusfile] [-h hdu] [-x scale] [-w weightfile] [-t threshold] [-X] [-f] in.fits out.fits hdr.template


mProject reprojects a single image to the scale defined in a FITS header template file (read more about header templates here). The program produces a pair of images: the reprojected image and an "area" image consisting of the fraction input pixel sky area that went into each output pixel. The "drizzle" algorithm is implemented. The algorithm proceeds by mapping pixel corners (as adjusted by drizzle, if called) from the input pixel space to the output pixel space, calculating overlap area with each output pixel, and accumulating an appropriate fraction of the input flux into the output image pixels. In addition, the appropriate fraction of the input pixel area is accumulated into the area image pixels. Projection of points from input pixel space to output pixel space is calculated in two steps: first map from input pixel space to sky coordinates; second map from sky coordinates to output pixel space.

One situation that has happened often enough to warrant special note: It is possible to define a FITS header with the reference location off the image. In particular, people often reference cylindrical projections (e.g., CAR, CEA) to location (0.,0.) (e.g., the Galactic center). This is not wrong in itself but does lead to extremely large pixel offsets (e.g., in the hundreds of thousands). Related to this, if you extract a header from an image with large offsets of this type, it is unlikely that you can simply change projection types without also adjusting the reference location/offsets. Most likely, you will end up with the reproject data all being off-scale.


-z factor
Processing is done utilizing the drizzle algorithm. factor is a floating point number; recommended drizzle factors are from 0.5 to 1.
-d level
Causes additional debugging information to be printed to stdout. Valid levels are 1-5 (for higher debugging levels, it is recommended to redirect the output to a file).
-s statusfile
Output and errors are written to statusfile instead of being written to stdout.
-h hdu
Use the specified FITS extension (default is to use the first HDU with image data)
-x scale
Apply a correction factor of scale to each pixel
-w weightfile
Path to a weight map to be used when reading values from the input image.
-t threshold
Pixels with weights below threshold will be treated as blank.
Makes the output region (originally defined in the header template) big enough to include all of the input images


Input FITS file to be reprojected.
Path of output FITS file to be created.
FITS header template to be used in generation of output image


Two files are created as output: the reprojected FITS file (out.fits), and an "area" image (out_area.fits) which records the amount of coverage (in output pixel space) provided by the input images.


[struct stat="OK", time=seconds]
Drizzle factor string (string) cannot be interpreted as a real number
Weight threshold string (string) cannot be interpreted as a real number
Flux scale string (string) cannot be interpreted as a real number
Cannot open status file: statusfile
HDU value (hdu) must be a non-negative integer
No overlap
Not enough memory for output data image array
Not enough memory for output area image array
Output wcsinit() failed.
Input wcsinit() failed.
FITS library error
All pixels are blank
Template file not found
Image file in.fits missing or invalid FITS
Weight file weightfile missing or invalid FITS


$ mProject rawdir/real_orig.fits projdir/base_unity.fits templates/galactic_orig.txt
[struct stat="OK", time=143]


The drizzle algorithm has been implemented but has not been tested in this release.

If a header template contains carriage returns (i.e., created/modified on a Windows machine), the cfitsio library will be unable to read it properly, resulting in the error: [struct stat="ERROR", status=207, msg="illegal character in keyword"]

It is best for the background correction algorithms if the area described in the header template completely encloses all of the input images in their entirety. If parts of input images are "chopped off" by the header template, the background correction will be affected. We recommend you use an expanded header for the reprojection and background modeling steps, returning to the originally desired header size for the final coaddition. The default background matching assumes that there are no non-linear background variations in the individual images (and therefore in the overlap differences). If there is any uncertainty in this regard, it is safer to turn on the "level only" background matching (the "-l" flag in mBgModel.


2001-2015 California Institute of Technology, Pasadena, California

If your research uses Montage, please include the following acknowledgement: "This research made use of Montage. It is funded by the National Science Foundation under Grant Number ACI-1440620, and was previously funded by the National Aeronautics and Space Administration's Earth Science Technology Office, Computation Technologies Project, under Cooperative Agreement Number NCC5-626 between NASA and the California Institute of Technology."

The Montage distribution includes an adaptation of the MOPEX algorithm developed at the Spitzer Science Center.