| Build Status | Code Coverage |
|---|---|
AstroImage.jl allows you to plot images from an
astronomical FITS file using the
popular Images.jl
and Plots.jl Julia packages.
AstroImage.jl uses FITSIO.jl to
read FITS files.
AstroImage.jl is available for Julia 1.0 and later versions, and can be
installed with Julia built-in package
manager.
pkg> add AstroImagesAfter installing the package, you can start using it with
julia> using AstroImagesYou can load and read the the first extension of a FITS file with the load
function, from FileIO.jl:
julia> load("file.fits")
1300×1200 Array{UInt16,2}:
[...]The second argument of this load method is the number of the extension to
read. Read the third extension of the file with:
julia> load("file.fits", 3)
1300×1200 Array{UInt16,2}:
[...]The package provides a new type, AstroImage to integrate FITS images with
Julia packages for plotting and image processing. The AstroImage function has
the same syntax as load. This command:
julia> img = AstroImage("file.fits")
AstroImages.AstroImage{UInt16,ColorTypes.Gray,1,Float64}[...]will read the first valid extension from the file.fits file and wrap its content in
a NTuple{N, Matrix{Gray}}, that can be easily used with Images.jl and related packages.
If you are working in a Jupyter notebook, an AstroImage object is
automatically rendered as a PNG image.
AstroImage automatically extracts and store wcs information of images in a NTuple{N, WCSTransform}.
AstroImage can automatically construct a RGB image if 3 different colour band data is given.
julia> img = AstroImage(RGB, ("file1.fits","file2.fits", "file3.fits"))Where 1st index of file1.fits, file2.fits, file3.fits contains band data of red, blue and green channels respectively.
Optionally, ccd2rgb method can be used to form a coloured image from 3 bands without creating an AstroImage.
The formed image can be accessed using img.property.rgb_image.
set_brightness! and set_contrast! methods can be used to change brightness and contrast of formed rgb_image.
add_label! method can be used to add/store Astronomical labels in an AstroImage.
reset! method resets brightness, contrast and label fields to defaults and construct a fresh rgb_image without any brightness, contrast operations.
An AstroImage object can be plotted with Plots.jl package. Just use
julia> using Plots
julia> plot(img)and the image will be displayed as a heatmap using your favorite backend.
The AstroImages.jl package is licensed under the MIT "Expat" License. The
original author is Mosè Giordano.