This is the Rolling Hough Transform, described in Clark, Peek, & Putman 2014, ApJ 789, 82 (arXiv:1312.1338).

The RHT is a machine vision code that measures linear intensity as a function of orientation in images. The RHT was used to discover that diffuse neutral hydrogen features in the Milky Way are very well aligned with the interstellar magnetic field (Clark, Peek, & Putman 2014, Clark et al. 2015).

This code is written and maintained by Susan E Clark, with contributions from lots of wonderful users. Special thanks to Rutger Jaspers for recent improvements. Please feel free to get in touch with any questions, and please create pull requests to suggest improvements.

Included is a modified RHT which distinguishes between pixels located at theta, and at theta+pi, in polar coordinates centered on any given image pixel. This is achieved by searching along radii with twice the dtheta of the diameters searched in the RHT. This Transform is still in development.


To run the RHT you'll need numpy, scipy, and astropy (for reading fits files).

Instructions For Use (interactive python environment)

  1. The RHT now supports Python 3. Ensure your Python Environment is as up-to-date as possible and contains the required imports. The code has been tested on both Windows and Mac operating systems.

    python --version //Currently Supports Python 2.7 and Python 3

  2. Ensure you are able to import the package:

    import rht

  3. Run the RHT for individual files or directories, given a number of parameters. Output will be placed alongside the input files in the .fits format, with a record of the parameters that created it:

    rht.main() Runs the RHT, after asking for user input, with default parameters

    rht.main('filepath') Runs the RHT for a given image or within a given directory with default parameters

    rht.main('filepath', flag=value, param=value) Runs with some flag set to a boolean and some param set to a number

  4. Explanation of rht.main() Flags and Parameters

    force=False: If True, forcefully overwrites existing RHT data with same parameter values.
    drht=False : If True, runs the directional RHT, which returns output on a full, rather than half, polar domain.

    wlen=55.0 : Set window diameter in pixels.
    smr=11.0 : Set smoothing radius in pixels.
    frac=0.70 : Set theta power threshold.

Instructions For Use (Terminal)

Command Line Argument Format: python filename.fits arg1 arg2 ... argn

For a list of possible arguments, run
python --help

Your first argument must be the .fits file to run the RHT on. After that you may assign any number of the following arguments:

Flags: '-f', '--force' : Force overwrite RHT output run with same parameters.
'-d', '--drht' : Compute Directional RHT (full polar domain).

'-w', '--wlen' =value : Sets window diameter
'-s', '--smr' =value : Sets smoothing radius '-t', '--thresh' =value : Sets theta power threshold

Other Information

Input: .fits file
Output: .fits file containing two HDUs: [0] RHT backprojection, or an image of RHT intensity integrated over all thetas.
1 coordinates in image space, and R(theta) for each image coordinate

The RHT is more expensive the larger your window length.

Publications that use the RHT

Please get in touch if you have a publication that you'd like to add to the list!


If use of the RHT results in a publication, please cite Clark, Peek, & Putman 2014, ApJ 789, 82

The RHT was originally developed by Susan Clark, Josh Peek, and Mary Putman, and modifications to this code were made by Columbia University undergraduate Lowell Schudel.