Added merge_headers to preserve original header contents.
Added use of merge_headers in resample_images