# ISAAC Parallel Image Processing IP2

The primary motivation for the IP2 pipeline is to apply the emerging availability of parallel computing to algorithms for astronomical image processing that are extremely valuable but also computationally intensive. The first to be addressed is the image differencing technique known as Optimal Image Subtraction (OIS). For ground-based telescopes, atmospheric conditions and optics fluctuate at varying degrees leading to temporally invariant transfer functions known as the point spread function (PSF). In the case of comparing two images, such as for detecting any spatial or brightness changes, it becomes critical to first normalize the images. The OIS technique convolves one image with a spatially-varying convolution kernel until the first image matches the second image to the degree specified. This process becomes increasingly complex due to pixel and sub-pixel scale image offsets and rotations that redistribute the PSF in unpredictable ways. OIS uses a convolution kernel, PSF, to smear the sharper image to match the quality of the second image. In the case of a field with no variable objects, a reference image R convolved with an ideal kernel K should equal another image I. The difference image D between the convolved reference and the second image must then yield a constant field (to the level of the background noise).

Any significant deviation from the constant value in the difference image D, positive or negative, identifies the position of variable objects in the image field. For large fields of view the PSF can vary across the image. Therefore, in practice a single kernel would not always perform well across the entire image. In this spatially-varying convolution, the kernel is allowed to vary across the image with the changing distortions across the image such that,

where B_{i} is a basis function, scaled by a bivariate polynomial an. Where a_{n}(x,y) is a polynomial of order n. In this case the kernel is now unique for every pixel location (x,y). The zeroth order polynomial compensates for changes in the width of the PSF, the first order corrects for lateral translation, and the second order addresses rotational translation.

Before images can be processed with OIS, they often require other simpler operations to prepare them for subtraction. Thus, IP2 also provides functionality for basic calibration, co-alignment, and co-addition (stacking), all utilizing multi-core and many-core implementations.

**Figure 1 Basic high-level architecture of IP2**

- ISAAC Parallel Image Processing (IP2)
- Infrastructure for Astrophysics Applications Computing (ISAAC)
- Mixed technology Multi-core and Many-core Parallelization
- C/C++ Based
- CUDA GPU for image pixel processing
- OpenMP for small loops and optionally for pixel processing
- OpenMP for subroutines with significant branch divergence
- MPI for cluster scaling, multiple pipelines on multiple nodes
- Data persistence for reduced I/O bottlenecks
- Astronomy Image Processing for Synoptic Surveys
- Basic calibration operations
- Dark and bias subtraction, flat field, scaling
- Image rotation and translation
- Image alignment based on World Coordinate System (WCS)
- Piece-wise spline sub-pixel interpolation
- Optimal Image Subtraction (OIS)
- PSF matching image subtraction
- 2
^{nd}order Dirac delta function (DFB) spatially-varying kernel convolution

##### Figure 2 Spatially-varying convolution times using 2nd order DFB on a single compute node. Performance of the DFB spatially-varying kernel convolution is shown for a range of image sizes using various platforms. The spatially-varying kernel is generated from polynomial coefficients uniquely at every pixel and then convolution for the pixel is performed. For larger images OpenMP shows good scaling (3 OpenMP Processors used in this example), but the many-core GPU implementation shows significant advantage. The times shown include memory transfer overhead to and from the GPU global memory for CUDA, and thus are valid comparisons for time to results. The large improvement over IDL is the result of the algorithm being inherently pixel specific, and thus unable to utilize many of IDL's built-in matrix operation optimizations.

### DOCUMENTATION

**For IP2 code. Getting started.**

### DOWNLOAD CODE »

### PUBLICATIONS

- GPU Acceleration of Image Convolution using Spatially-varying Kernel, Steven Hartung, Hemant Shukla, J. Patrick Miller, Carlton Pennypacker, IEEE ICIP 2012
- Fast Image Subtraction Using Multi-cores and GPUs, Steven Hartung, Hemant Shukla, American Astronomical Society, AAS Meeting #221, #240.06