Apply Cosmic Ray Filter


The Apply Cosmic Ray Filter method is used by the Calibrate Images command to identify and remove cosmic ray hits from an image. This filter uses a contrast detection algorithm which evaluates each pixel as a potential cosmic ray by comparison with its neighboring values. If the pixel exceeds some threshold of difference from its neighbors, then it is replaced with a value typical of its neighbors. As an alternative, cosmic rays may be detected and removed from an image set using the Clean Image Set command.

To process the image, each pixel is examined in turn. The standard deviation is computed from nearby pixels using the selected Rejection Statistic. The rejection criterion is set to be Threshold times the standard deviation. In the example shown above, each pixel is compared with a threshold value of 2.2 sigmas above the standard deviation in a local neighborhood of 16 surrounding pixels. If the pixel exceeds the threshold, it is replaced by the average value of its surroundings.

Choosing the Threshold

A good starting point which allows reasonable cosmic ray removal is a Threshold value of 5 to 10. The best strategy is to choose a large value, like 10, and apply it to the image. Examine the results with the image magnified and/or centered on a particular area of interest. If there are too many pixels deleted (including the tops of stars) or other artifacts, use Ctrl+Z to Undo the processing, increase the threshold, and run the cosmic ray cleaning again. If there was not enough action the previous time, use Undo, decrease the threshold, and run again. Repeat this process until you have a good sense of what works for this image or generally for your image data.

Related Topics

Repairing Artifacts and Cosmetic Defects, Clean Image Set, Blemish Mask Editor, Image Calibration, Spatial Filters (cosmic ray filter).