|
static Bool | FITSToImage (ImageInterface< Float > *&newImage, String &error, const String &imageName, const String &fitsName, uInt whichRep=0, Int whichHDU=0, uInt memoryInMB=64, Bool allowOverwrite=False, Bool zeroBlanks=False) |
| Convert a FITS file to a Casacore image. More...
|
|
static Bool | ImageToFITS (String &error, ImageInterface< Float > &image, const String &fitsName, uInt memoryInMB=64, Bool preferVelocity=True, Bool opticalVelocity=True, Int BITPIX=-32, Float minPix=1.0, Float maxPix=-1.0, Bool allowOverwrite=False, Bool degenerateLast=False, Bool verbose=True, Bool stokesLast=False, Bool preferWavelength=False, Bool airWavelength=False, const String &origin=String(), Bool history=True) |
| Convert a Casacore image to a FITS file. More...
|
|
static Bool | ImageHeaderToFITS (String &error, ImageFITSHeaderInfo &fhi, const ImageInterface< Float > &image, Bool preferVelocity=True, Bool opticalVelocity=True, Int BITPIX=-32, Float minPix=1.0, Float maxPix=-1.0, Bool degenerateLast=False, Bool verbose=True, Bool stokesLast=False, Bool preferWavelength=False, Bool airWavelength=False, Bool primHead=True, Bool allowAppend=True, const String &origin=String(), Bool history=True) |
|
static IPosition | copyCursorShape (String &report, const IPosition &shape, uInt imagePixelSize, uInt fitsPixelSize, uInt memoryInMB) |
| Helper function - used to calculate a cursor appropriate for the desired memory use. More...
|
|
static CoordinateSystem | getCoordinateSystem (Int &imageType, RecordInterface &headerRec, const Vector< String > &header, LogIO &os, uInt whichRep, IPosition &shape, Bool dropStokes) |
| Recover CoordinateSystem from header. More...
|
|
static ImageInfo | getImageInfo (RecordInterface &header) |
| Recover ImageInfo from header. More...
|
|
static Unit | getBrightnessUnit (RecordInterface &header, LogIO &os) |
| Recover brightness unit from header. More...
|
|
static void | restoreHistory (LoggerHolder &logger, ConstFitsKeywordList &kw) |
| Recover history from FITS file keyword list into logger. More...
|
|
static Bool | extractMiscInfo (RecordInterface &miscInfo, const RecordInterface &header) |
| Parse header record and set MiscInfo. More...
|
|
static void | readBeamsTable (ImageInfo &info, const String &filename, const DataType type) |
| Read the BEAMS table if present and add the restoring beams to info . More...
|
|
|
static Bool | ImageToFITSOut (String &error, LogIO &os, const ImageInterface< Float > &image, FitsOutput *output, uInt memoryInMB=64, Bool preferVelocity=True, Bool opticalVelocity=True, Int BITPIX=-32, Float minPix=1.0, Float maxPix=-1.0, Bool degenerateLast=False, Bool verbose=True, Bool stokesLast=False, Bool preferWavelength=False, Bool airWavelength=False, Bool primHead=True, Bool allowAppend=False, const String &origin=String(), Bool history=True) |
| Put a CASA image to an opened FITS image Parameters as in "ImageToFITS". More...
|
|
static Bool | QualImgToFITSOut (String &error, LogIO &os, ImageInterface< Float > &image, FitsOutput *outfile, uInt memoryInMB, Bool preferVelocity, Bool opticalVelocity, Int BITPIX, Float minPix, Float maxPix, Bool degenerateLast, Bool verbose, Bool stokesLast, Bool preferWavelength, Bool airWavelength, const String &origin, Bool history) |
| Put a CASA image with quality coordinate to an opened FITS file Parameters as in "ImageToFITS". More...
|
|
static Bool | removeFile (String &error, const File &outFile, const String &outName, Bool allowOverwrite) |
| If existing, remove the file, symlink, or directory given by outFile . More...
|
|
static Bool | openFitsOutput (String &error, FitsOutput *(&openFitsOutput), const String &fitsName, const Bool &allowOverwrite) |
| Create an open FITS file with the name given. More...
|
|
static void | _writeBeamsTable (FitsOutput *const &outfile, const ImageInfo &info) |
|
Interconvert between Casacore Images and FITS files.
Intended use:
Public interface
Review Status
- Date Reviewed:
- yyyy/mm/dd
Prerequisite
Synopsis
This class is a helper class that is used to interconvert between Casacore images and FITS files. This adds no functionality over the general abilities available in the underlying FITS classes, however it is a useful higher-level packaging.
There are two fundamental member functions in this class. FITSToImage
which turns a FITS file into a Casacore image, and ImageToFITS
which does the opposite.
We can read images from any HDU inside the FITS file (although this isn't well tested). Images with a quality axis (i.e. contain data and error values) are stored in the primary HDU (data) and an extension HDU (error). Other images are always written to the primary HDU.
Pixels in the FITS file which are blanked are masked out (the mask is set to False) in the output image. On conversion to FITS, masked values are blanked. The mask which is read is the current default mask.
Example
A FITS to image conversion may be accomplished as follows:
PagedImage<Float> *image = 0;
String fitsName = "exists.fits";
String imageName = "new.image";
String error;
if (!image)... error..\.
static Bool FITSToImage(ImageInterface< Float > *&newImage, String &error, const String &imageName, const String &fitsName, uInt whichRep=0, Int whichHDU=0, uInt memoryInMB=64, Bool allowOverwrite=False, Bool zeroBlanks=False)
Convert a FITS file to a Casacore image.
bool Bool
Define the standard types used by Casacore.
A couple of things to note:
-
If
ok
is False, the conversion failed and error
will be set.
-
The pointer "image" is set if the conversion succeeds. If it is zero the conversion failed and
error
will contain an error message.
-
The caller is responsible for deleting the pointer
image
when the conversion is successful.
Similarly, an image to FITS conversion may be accomplished as follows:
String imageName = argv[1];
PagedImage<Float> image =...;
String fitsName = "new.fits";
String error;
static Bool ImageToFITS(String &error, ImageInterface< Float > &image, const String &fitsName, uInt memoryInMB=64, Bool preferVelocity=True, Bool opticalVelocity=True, Int BITPIX=-32, Float minPix=1.0, Float maxPix=-1.0, Bool allowOverwrite=False, Bool degenerateLast=False, Bool verbose=True, Bool stokesLast=False, Bool preferWavelength=False, Bool airWavelength=False, const String &origin=String(), Bool history=True)
Convert a Casacore image to a FITS file.
A couple of similar remarks can be made about this example:
-
If
ok
is False, the conversion failed and error
will be set.
Motivation
FITS files are the fundamental transport format for images in Astronomy.
To Do
-
It might be useful to have functions that convert between FITS and general lattices.
-
Add support for PagedImage<Complex>
-
Convert multiple images at once?
-
Allow writing FITS files to an image extension in an existing FITS file.
Definition at line 170 of file ImageFITSConverter.h.