Class Imager


  • public class Imager
    extends Object
    This class generates an image or images from user inputs. Output images are created by sampling one or more input images into a user specified grid of pixels.
    Usage:
    java skyview.geometry.test.Imager [key=value] [key=value] ...
    If the code is being executed from Jar file, then use
    java -jar skyview.jar [key=value] [key=value]...
    The field keys are not case sensitive but the values may be.

    Valid field keys include:

    Lon: The longitude of the center of the output image in the coordinate system selected. Note that the default coordinate system is J2000, so the longitude is the right ascension. The value is specified in decimal degrees.

    Lat: The latitude of the center of the output image in the coordinate system selected. J2000 is the default coordinate system, so by default Lat corresponds to declination. The value is specified in decimal degrees.

    Position : The comma separated longitude and latitude. If Position and Lon/Lat are specified then the values specified in Lon/Lat override those in position.

    CopyWCS : An existing FITS file may be used to define the WCS to be used for the output. If this argument is specified any other argument that specifies the output image geometry is ignored.

    Coordinates : A string describing the coordinate system to be used for the output image. It comprises an inital letter which gives the coordiante system, which prefixes a number giving the epoch of the coordiante system.

    • J: Julian (FK5) coordiantes, e.g., J2000.
    • B: Besselian coordinates, e.g., B1950.
    • E: Julian Ecliptic coordinates, e.g., E2000.
    • H: Helioecliptic coordinates (i.e., coordinates centered on the instantaneous position of the sun), e.g., H2002.4356.
    • G: Galactic coordinates. Characters after the first are ignored.
    • I: ICRS coordinates. Characters after the first are ignored.

    Projection: The projection used to convert from celestial to plane coordinates. The projection string is the 3 character string used in the FITS WCS papers, with only the first letter capitalized. Supported output projections include:

    • Tan: The tangent plane on gnomonic projection.
    • Sin: The sine or orthographic projection.
    • Ait: The Hammer-Aitoff projection.
    • Car: The cartesian or plate-caree projection.
    • Zea: The Zenithal equal area projection
    • Csc: The COBE sperical cube projection.
    • Toa: The HTM TOAST projection

    Sampler: The sampler defines how the input images are sampled to get values at the putput pixels. Sampling algorithims include:

    • NN: Nearest Neighbor.
    • LI: [Bi-]Linear interpolation.
    • Lanczos[n]: A Lanczos smoothly truncated Sinc interpolator of order n. Lanczos defaults to order 3.
    • Spline[n]: The n'th order spline interpolation. Defaults to cubic splines. The order may range from 2 to 5.
    • Clip: A flux conserving exact area resampler where output pixels serve as clipping windows on the input image.

    Scale: The size of the output pixels in degrees. If the pixels are square only a single values is given. Non-square pixels can be specified as Scale=xsize,ysize.

    Size: The size of the entire image in degrees.

    Pixels: The number of output pixels along an edge. If the output image is not square this can be specified as Pixels=xPixels,yPixels

    Rotation: A rotation in the output plane to be applied to the data (in decimal degrees)

    Survey: The survey from which the output image is to be created. More than one survey can be specified as survey1,survey2,survey3,...

    Ebins: For surveys with a third dimension, the binning to be applied in this dimension. Currently this is specified using as x0,dx,n where x0 is the starting bin for the first output bin, dx is the width of the output bins, and n is the number of output bins. These are expressed in terms of the input energy bins, such that if the survey data has 10 bins, the first bin ranges from 0-1, the second from 1-2 and the last from 9-10. If we wished to rebin this data into four evenly spaced bins excluding the first and last bins, then Ebins=1,2,4. A default binning is defined for each 3-d survey included in SkyView.

    Output: The output file name. If data is being created from more than one survey, then the survey short name will be appended to the name. The default output filename is output.fits. The strings "-" or "stdout" are used to specify writing to the standard output.

    Compress: Write the output in GZIP compressed form. The value field is ignored.

    Float: Write output in 4 byte reals rather than 8 byte. The value field is ignored.

    The following options control where the imager task finds survey data.

    XMLRoot: The directory containing the XML survey descriptions

    Cache: Directory location (or locations) where cached files (survey files retrieved from remote locations) are to be found. The first cache location is also used when a remote file is retrieved.

    PurgeCache: Should files cached during this retrieval be deleted after processing? Only files cached during the current operation will be deleted. If there are survey files in the cache area from previous requests that are used in the current request, these will be retained.

    SurveyXML: Gives the name of a file containing an XML description of a survey. This allows the user to create an image from a survey they are describing. Use a "," to separate multiple survey files.

    The following operations allow the user to override the basic processing operations.

    The following options control the classes that are used in processing the user request. Most users can ignore these.

    SurveyFinder: The class of the object that finds the appropriate survey object for the surveys the user has requested.

    ImageFinder The class of the object that finds the appropriate images within a survey for each pixel of the output object.

    PreProcessor: One or more objects that do image pre-processing.

    Mosaicker: The object that actually generates the output image melding together the input images.

    PostProcessor: One or more classes of object that do image post processing. One example used by default in some surveys is the skyview.geometry.Deedger. You can force de-edging by specifying the class, or turn it off by setting PostProcessor=null.

    NoFITS: Do not create a FITS output file. This could be used for debugging, or more likely in combination with graphics output created by the skyview.ij.IJProcessor where the user wants only a JPEG or GIF and does not need a FITS file. See the help for the IJProcessor for details on supported formats and other options.

    • Field Detail

      • bin0

        protected double bin0
        The beginning of the first pixel in energy space.
      • dBin

        protected double dBin
        The width of pixels in energy space
      • s

        protected Scaler s
        The Scaler object for the output image.
      • p

        protected Projection p
        The Projection object for the output image.
      • c

        protected CoordinateSystem c
        The CoordinateSystem object for the output image.
      • samp

        protected Sampler samp
        The sampler object used to create the output image.
      • dsamp

        protected DepthSampler dsamp
        The energy sampler object used when creaing the output image.
      • lon

        protected double lon
        The lon/lat (or RA/dec) coordinates of the output image.
      • lat

        protected double lat
        The lon/lat (or RA/dec) coordinates of the output image.
      • surv

        protected Survey surv
        The current Survey object being used.
      • cand

        protected Image[] cand
        The candidate images for use in resampling
      • output

        protected Image output
        The current output image
    • Constructor Detail

      • Imager

        public Imager()
        Initialize the imager. Make sure that choices have been made for the basic elements needed for running the code.
    • Method Detail

      • main

        public static void main​(String[] args)
                         throws Exception
        Generate an image given the input parameters. See class documentation for usage.
        Throws:
        Exception
      • getVersion

        public static String getVersion()
      • getSamplerName

        public String getSamplerName()
        Get the sampler name.
      • getScaler

        public Scaler getScaler()
        Get the Scaler used for the output image.
      • getImageData

        public Object getImageData()
        Get the output data as 1-d double array
      • getLon

        public double getLon()
        Get the central longitude/RA of the output image
      • getLat

        public double getLat()
        Get the central latitude/declination of the output image
      • getSurvey

        public Survey getSurvey()
        Get the current survey being processed
      • getEdgeAdjustments

        public double[] getEdgeAdjustments()
        Get any adjustments made to image intensities to minimize edge effects.
      • getCandidates

        public Image[] getCandidates()
        Get the candidate images that may be used for resampling
      • getPixelDepth

        public int getPixelDepth()
        Get the energy depth of the output image
      • getPixelWidth

        public int getPixelWidth()
        Get the width of the output image in pixels
      • getPixelHeight

        public int getPixelHeight()
        Get the height of the output image in pixels
      • run

        public void run​(String[] args)
                 throws Exception
        Run an image with a given set of arguments. Retained for compatibility with V1.00. Putting the argument handling in the main code allows more flexibility in creating Image objects.
        Throws:
        Exception
      • checkUpdateSettings

        public void checkUpdateSettings()
      • reuseMatch

        protected int[] reuseMatch​(String surveyID)
      • clearImageCache

        public void clearImageCache()
        Clear out state that may confuse subsequent processing
      • haveImage

        protected skyview.executive.Imager.ImageState haveImage​(String surveyID,
                                                                WCS wcs)
      • processSurvey

        public void processSurvey​(String surveyID)
                           throws Exception
        Process a particular survey.
        Throws:
        Exception
      • getSum

        public static double getSum​(double[] arr)
      • createFitsFile

        public void createFitsFile()
                            throws Exception
        Create the FITS file
        Throws:
        Exception
      • getImager

        public static Imager getImager()
        Get an Imager object -- normally the last one created.