Package skyview.sia

Class Checker


  • public class Checker
    extends ImageFinder
    This class sees if any pixels have coverage. if there are any pixels that overlap with the survey region. It duplicates the logic of the Border image finder, but terminates as soon as any pixel is found to overlap an input survey image.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected boolean checkNaNs
      Do we wish to check that the input image does not have a NaN value?
      static int CONSUMED  
      protected boolean cornersOnly
      Do we want to only check on the corners of the rectangles and not the edges.
      protected Transformer fromOut
      The transformation from the output pixels to the celestial sphere
      protected boolean[] imageUsed
      Is a given image used in the transformation
      protected int[] img
      The index giving the best image for each pixel
      protected Image[] input
      The input images.
      static int NO_COVERAGE  
      static int NON_PHYSICAL  
      protected Image output
      The output image
      protected int pixelCount  
      protected int rectCount  
      static int SPLIT_X  
      static int SPLIT_XY  
      static int SPLIT_Y  
      protected double[] t2
      Transformation temporaries
      protected double[] t3  
      static int UNCHECKED  
    • Constructor Summary

      Constructors 
      Constructor Description
      Checker()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected int bestFit​(int pix, boolean[] valid)
      Find the best image to use for a given unit vector.
      protected int cornerMatch​(int[] corners, boolean[] valid, boolean[] newValid)
      Check the corners of a rectangle.
      protected double criterion​(double mn, int i)  
      protected boolean edgeOff​(int match, int p0, int pe, int dp, boolean[] valid)
      Check whether all pixels on an edge of a rectangle all have the same best fit image.
      int[] findImages​(Image[] input, Image output)
      Find the best image for each output pixel.
      protected double[] getCelest​(int pix)
      Get the celestial coordinates corresponding to a given pixel.
      protected double[] getImage​(Image img, double[] inp)
      Convert an input unit vector to a position in an image.
      static boolean getStatus()  
      protected double minDist​(double x, double y, double a, double b)
      Given a point at x,y in an image of size a,b in the rectangle 0,a 0,b find the minimum distance to the edge.
      void setStrict​(boolean flag)
      Set a strict geometry.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • t2

        protected double[] t2
        Transformation temporaries
      • t3

        protected double[] t3
      • imageUsed

        protected boolean[] imageUsed
        Is a given image used in the transformation
      • fromOut

        protected Transformer fromOut
        The transformation from the output pixels to the celestial sphere
      • pixelCount

        protected int pixelCount
      • rectCount

        protected int rectCount
      • output

        protected Image output
        The output image
      • input

        protected Image[] input
        The input images.
      • checkNaNs

        protected boolean checkNaNs
        Do we wish to check that the input image does not have a NaN value?
      • cornersOnly

        protected boolean cornersOnly
        Do we want to only check on the corners of the rectangles and not the edges.
      • img

        protected int[] img
        The index giving the best image for each pixel
    • Constructor Detail

      • Checker

        public Checker()
    • Method Detail

      • getStatus

        public static boolean getStatus()
      • findImages

        public int[] findImages​(Image[] input,
                                Image output)
        Find the best image for each output pixel.
        Specified by:
        findImages in class ImageFinder
        Parameters:
        input - An array of images that may be sampled to get the output image.
        output - The output image. In this routine we are interested in its geometry, not its data.
        Returns:
        An index array which for each pixel in the output image gives the best image to sample. Note that this has dimension int[nx*ny] where nx changes most rapidly. The values of the index array can be:
        • >= 0: The pixel is best indexed with the given image.
        • -1: [internal] The best image for this pixel has not yet been determined.
        • -2: This pixel is not on any of the input images.
        • -3: This pixel does not represent a physical coordinate.
        • -4: [in other methods] this pixel has already been processed.
      • setStrict

        public void setStrict​(boolean flag)
        Set a strict geometry. This class ignores the strict geometry flag since it does boundary checking.
        Overrides:
        setStrict in class ImageFinder
        Parameters:
        flag - Do we want strict tests
      • edgeOff

        protected boolean edgeOff​(int match,
                                  int p0,
                                  int pe,
                                  int dp,
                                  boolean[] valid)
        Check whether all pixels on an edge of a rectangle all have the same best fit image.
        Parameters:
        match - The value each edge is to be compared against.
        p0 - The first pixel offset to be checked.
        pe - The last pixel offset to be checked.
        dp - The spacing between pixels (either 1 or the number of pixels in a row).
        valid - Should we consider this image?
        Returns:
        true if there is a discrepant pixel, or false if all values are the same as std.
      • cornerMatch

        protected int cornerMatch​(int[] corners,
                                  boolean[] valid,
                                  boolean[] newValid)
        Check the corners of a rectangle.
        Parameters:
        corners - The corners of the rectangle. It is assumed that there are four elements in corners, and they are in the order p00, p01, p10, p11
        valid - The images to be checked at the current level of recursion.
        newValid - The images to be checked at the next level of recursion. This routine will look at the corners of the image in relation to the bounds of the valid images to decide which images to search at a future level of recursion.
      • getCelest

        protected double[] getCelest​(int pix)
        Get the celestial coordinates corresponding to a given pixel.
        Parameters:
        pix - The pixel index.
        Returns:
        The celestial coordinates as a unit vector. This is returned as a pointer to the field t3.
      • minDist

        protected double minDist​(double x,
                                 double y,
                                 double a,
                                 double b)
        Given a point at x,y in an image of size a,b in the rectangle 0,a 0,b find the minimum distance to the edge. We assume that x,y is contained in the rectangle. If x,y is outside the rectangle, then this should return a negative number.
      • getImage

        protected double[] getImage​(Image img,
                                    double[] inp)
        Convert an input unit vector to a position in an image.
        Parameters:
        img - The image we are transforming into the plane of.
        inp - The input unit celestial coordinate unit vector.
        Returns:
        The coordinate plane tuple. This is returned as a pointer to the field t2.
      • bestFit

        protected int bestFit​(int pix,
                              boolean[] valid)
        Find the best image to use for a given unit vector.
        Parameters:
        pix - The output pixel we are testing (pix = x + width*y)
        valid - Should we test this image
        Returns:
        The best image, or special values.
      • criterion

        protected double criterion​(double mn,
                                   int i)