mProjectCube reprojects a single cube to the scale defined in a FITS header template file (read more about header templates here). The program produces a pair of files: the reprojected cube 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 cube 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.