Loop Recognition


  • Inputs: image of corona taken in one of 10 temperature filters on AIA

  • Outputs: list of endpoints (area defined by circle or polygon of solar coordinates) and time plus image with cool and hot loops highlighted

  • Problem: The loop recognition algorithm will start with an image taken in one of the 10 channels on AIA that can image the corona in a range of temperatures between 100,000 K and 20 MK. The loop recognition should identify the following types of loops in the image:
    • Loops stretching across the field of view
    • Loops that stretch perpendicular to the field of view (and appear to be almost 1 dimensional)
    • Individual loops tangled up in a bundle of loops (like �spaghetti�)
    • Cool loops with a sharp, thin appearance (�vermicelli�)
    • Hot loops with a fuzzy, thick appearance (�fettucine�)

The algorithm will identify a loop by highlighting it on the input image and creating a list of times and solar endpoints associated with the loop. The endpoints will be given as an area defined by solar coordinates (circular or polygonal area rather than a single point).

Ideally, identification of loops should extend from warmer to cooler parts of the corona. (Should this be an overlay of images, or an association of loops in different images, ie. A table of probable associated loops within a given solar area and time window?) Loops will most likely be identified in sets of �hot� and �cold�. If necessary, further subsets will be defined by temperature. All loops within a subset of temperatures will be identified with a false colour unique to that temperature; otherwise loops will be identified by one colour as �hot� and by a second colour as �cold�.

The loops identified in LoopRecognition will be associated with magnetic field lines found in MagneticFieldExtrapolation during the HelicityComputation analysis. In addition, electric current will be calculated on a pixel-by-pixel basis from the HMI magnetogram. The electric current values will be added to the pixel goodness weighting matrix that determines whether a pixel should be classified with a loop.

Literature Search

  • 'Comparison of five numerical codes for automated tracing of coronal loops' by Aschwanden,M.J., Lee,J.K., Gary,G.A., Smith,M., and Inhester,B. 2007, Solar Physics (submitted 2007-May-21).
  • 2007_tracing.pdf:

Related Topics:

Routines and Libraries

  • Strous loop pixel labelling algorithm, referred to by Lee, Newman and Gary
  • Oriented Connectivity Method, by Lee, Newman and Gary
  • Add electric current to pixel weighting in OCM method - ECA, 20/04/05
  • Carsten Steger's curve tracing routines (part of the 'GRASP' download) available at: http://www.lsc-group.phys.uwm.edu/~ballen/grasp-distribution/GRASP/src/timefreq/
  • Karthik Raghupathy's 'Improved Curve Tracing' MATLAB source code.

Test Data

TRACE images can be used for loop recognition testing. Wavelet, curvelet, and ridgelet algorithms can be investigated for loop recognition; curvelets are recommended for low-contrast loops. Cristina Mandrini has fortran code for solar loop wavelet analysis.


David Williams of MSSL (Solar & Stellar Physics Group) has suggested the 'Curvelet transform' as a possible starting point for the Loop Recognition algorithm to be deployed on the eSDO project. The transform offers improved image noise reduction and enhanced image contrast over the more well-established Wavelet transform technique, especially with anisotropic images such as coronal loops.

I have so far discovered two websites offering software add-ons for the Curvelet transform, one supporting MATLAB, the other IDL (see 'useful links' below). MATLAB support is provided by the BEAMLAB 200 library and is available as a free download. Unfortunately the installation is a mixture of readable MATLAB sources (.m files) and binaries, making it impossible to fully inspect the implementation of the algorithms. IDL support is provided by Multiresolution.com, a commercial installation consisting of IDL sources (.pro files) and binaries. -- MikeSmith

The paper on "Automated Detection of Solar Loops" by Lee, Newman, and Gary looks extremely useful. I have extracted out the algorithm steps for their oriented connectivity method at LoopRecognitionOCMsteps. --Main.ElizabethAuden

Coronal Loop Recognition experiments in �C�


After several weeks trawling through literature dealing with a variety of curve detection methods, I settled upon the �Improved Curve Tracing in Images� work of Karthik Rangupathy as a starting point for own experiments into Coronal Loop Recognition. The point of such an experiment is to find and write in �C� a fast, effective alternative to OCM, i.e. one that doesn�t rely on magnetogram data as an input.

Rangupathy�s work - which was the basis of his Masters degree at Cornell University - distinguishes between the problems of curve detection and curve tracing. There are several good techniques available for detecting curves, but more often than not these don�t identify a curve as a human observer would, that is they fail to follow a curve as it crosses other curves, fades out and reappears. Curve tracing techniques, on the other hand, attempt to deal with these hurdles and identify a curve as a person would. Coronal Loop recognition is essentially a curve tracing problem, thus making Rangupathy�s work an attractive starting point.

Rangupathy�s work is current (his thesis was published in August 2004), so other contemporary curve detection processes have been considered. This includes the curvelet, which though excellent for curve detection in noisy images isn�t deemed a suitable curve tracing technique. Another advantage of Rangupathy�s method is that the detection process can filter on line width (in pixels). As the line thickness of coronal loops varies with temperature, the filter could be used to extract loops of a user-specified thermal range.

Rangupathy�s sees the problem of curve tracing as a 2-fold process: a local process and a global process. The local process identifies pixels in small (�local�) neighbourhoods that belong to the same curve, while the global process serves to identify disconnected curve segments as part of a larger curve.

Rangupathy�s local solution uses an improved version of the technique developed by Carsten Steger in the mid-1990�s, while the global solution uses the well-established RADON transform.


Clearly some kind of simple GUI is required to display original/processed images and I decided to create my own using the �C� GTK widget library. However, I found that converting a TRACE FITS input file to a format that GTK could cope with (�XPM�, for example) required a third-party graphics tool, such as �GIMP� or �xv�. Invariably this leads to the loss of some greyscale information and means introducing a manual step into the algorithm process.

I switched to �XFITSViewer� as my GUI for reading in a �FITS� file and displaying the unmodified and processed images. �XFITSviewer� is similar to �fv� in that it is available as open-source code, but is more compact and written exclusively in �C� (much of �fv� is in Tcl/Tk).

I obtained Carsten Steger�s curve tracing code (which is subject to the usual GNU licensing rules) from the open-source download of GRASP, a gravitational wave detection data analysis package.

After some initial scaling problems I managed to successfully integrate Carsten Steger�s code with XFITSviewer and obtained the result shown in Figure 1. I chose lt051998.fits as my input file - the same FITS file provided with the Jake Lee�s OCM IDL .sav bundle. Although there are discontinuities and spurious fragments in the output image, the result looks encouraging. The image is computed instantaneously (on the msslxx server) and doesn�t differ greatly from the output obtained from OCM.

Karthik Raghupathy has kindly agreed to let MSSL have copies of his Masters thesis and the MATLAB source code (with permission of his project supervisor Prof. Thomas Parks) used to demonstrate his �Improved Curve Tracing� method. I hope to extract from these the refinements made to Carsten Steger�s algorithm and the RADON transform and port these to our �C� code. These should help remove many of the anomalies and discontinuities in the current image with little effect on overall processing time.

  • Figure 1 - Result of Steger's curve tracing algorithm on lt051998.fits:
    Result of Steger's curve tracing algorithm on lt051998.fits


� Redraw is slow when re-sizing the GUI display window. Frame buffering should take care of this.

� Clicking on GUI causes a core dump.

� Need to overlay results on original image.

� Need to add improvements to Carsten Steger�s curve tracing method and RADON Transform.

� Add buttons to allow options, e.g. sigma, high/low values, to be modified.

-- MikeSmith - 01 Aug 2005

Useful links:

See also:

  • Ridgelet transform
  • Wavelet transform

Using the Coronal Loop algorithm

The code represents a first draft of the eSDO Coronal Loop Recognition algorithm. It is based on the Curvilinear Detection algorithm of Carsten Steger (Technical University of Munich) which has been adapted to work with FITS file images of coronal loops such as EITS and SOHO TRACE.

The algorithm scans in the FITS image, determines which image pixels represent loop points and attempts to group or link these into loops or contours. The output is written to a copy of the input FITS file and can be viewed with any standard FITS viewer.

The code makes extensive use of NASA's HEASARC cfitsio library for FITS file manipulation.

The code has been built and tested on the following Linux platforms:

Fedora Core 2

  • gcc (version 3.3.3)
  • cfitsio (version 3.004)

Fedora Core 5

  • gcc (version 4.1)
  • cfitsio (version 3.004)


The following lists the necessary source, include, library and miscellaneous files required to build the Loop Recognition executable. A number of test files have also been listed in order that the algorithm may be tested.

Sources: (CVSROOT/esdo/algorithms/CoronalLoops/src)

  • alloc.c
  • convol.c
  • correct.c
  • error.c
  • lines.c
  • link.c
  • loop_recog.c
  • normal.c
  • position.c
  • thresh.c
  • width.c

Includes: (CVSROOT/esdo/algorithms/CoronalLoops/src)

  • fitsio.h (cfitsio include)
  • lines.h
  • longnam.h (cfitsio include)

Libraries: (CVSROOT/esdo/algorithms/CoronalLoops/src)

  • libcfitsio.a (cfitsio library)

Test data files: (CVSROOT/esdo/algorithms/CoronalLoops/test)

  • 1t051998.fits (adapted TRACE)

Miscellaneous: (CVSROOT/esdo/algorithms/CoronalLoops/src)

  • Makefile


  1. Place the listed files in the desired working directory.

  1. Modify the HOME directive in the Makefile to reflect the user's own home directory. If the package isn't installed under the user's home directory then the BASE directive will need to be modified accordingly.

  1. Run 'make'.

Assuming there are no errors, an executable called 'LoopRecog' is created under the working directory.

Running LoopRecog

  1. At the command prompt type 'LoopRecog ', where.

  • is the filename of the input FITS file. A sample data file called '1t051998.fits' is provided for testing purposes. The file may be renamed and doesn't have to reside in the same directory as the executable, but it must be prefixed with the relative or absolute pathname. Maximum pathname length (including the filename) is 250 characters.

  • represents the value of sigma in the range 0.6 - 3.0 and adjusts the Gaussian kernel used in convolving the image). A starting value of 1.0 is recommended.

  • sets a loop tracing threshold. Loops containing fewer pixels than this will not be traced on the output image. A starting value of 20 is recommended.

  • is the filename of the output FITS file. The file may be given any name by the user and doesn't have to reside in the same directory as the executable, but it must be prefixed with the relative or absolute pathname. Maximum pathname length (including the filename) is 250 characters.

For example:

LoopRecog ../Input/lt051998.fits 1.0 20 ../Output/out.fits

  1. Processing takes a few seconds and then returns the user to the commandline prompt. Any errors encountered during processing will be displayed on screen.

  1. If processing is successful, then an output FITS file containing the detected loop data is created with the name and location specified by the user. The new file will include the original image with detected loops
overlayed, and an ASCII table extension containing the x-y pixel values of the footpoints of detected loops.

The input parameter values used in processing the file are recorded in the ASCII table extension header.

The input FITS file remains unmodified.

Work as of Nov '2006 ================

The TRACE image 1t051998.fits (included in the software package) was chosen for initial algorithm testing, as this formed the test case for another loop recognition algorithm we reviewed. We were thus able to compare efficiency and speed of the two methods. The results of the two methods are comparable in terms of loops detection but LoopRecog is immeasurably faster, taking a few seconds to process the 1024 * 1024 pixel test image, compared to approx 90 minutes for the other method.

The algorithm is capable of dealing with FITS images in the 5 standard FITS datatypes, namely byte, short, long, float and double, although to date only short (16 bit data) images have been available for testing.

The minimum loop points constraint was added to filter out spurious small loop segments that cluttered the overlayed image.

Loop detection in EIT images, which are less contrasty than the example TRACE image, tend to produce less successful results: false positives, and some apparently obvious curves and curve segments are overlooked by the algorithm. Investigations into why this is, plus overall improvement of the algorithm are part of the ongoing 'future work' package below.

Input data file, sigma, min no. of loop points and output data file now added as commandline arguments. Input and output files can take any name and do not have to reside in the same directory as the executable.

Updates: ====

Date: Description:

------------ July, 2007 A new column has been added to the ASCII table extension to display the chain codes of each of the detected contours. Given a starting point (a contour footpoint in this case) the codes allow the path of a contour to be mapped using integers 0-7 to determine the direction of a neighboring pixel.

The chain code convention is as follows:

5 6 7 \ | / \|/ 4 ---X--- 0 /| / | 3 2 1

Each succesive integer represents a 45 deg clockwise change of direction to its predecessor. The starting point of each contour is a footpoint and this is represented as the first digit in the chain code - a '0'.

Chain codes have been added in order to make the Loop Recognition algorithm compatible with the Heliophysics Knowledgebase.

Future work =======

. Investigate why apparently obvious curves and curve segments are sometimes missed by the algorithm.

. Improve loop linkage, that is the algorithm's ability to deal with crossing loops and loops that fade then reappear.

N.B. An improved loop linkage method has been tried, which works fine for images with just a handful of loops, but doesn't transfer to complex coronal loop images.

. Add further command line parameters, e.g. line width, pixel thresholding limits.

. Improved error trapping/reporting.

. Footpoints to be expressed as heliographic coordinates. (Required ?)

. Devise a scoring system that selects the optimal value of sigma.

. Correlate with NLFFF magnetic extrapolations.

. Devise tests to measure the efficiency of the algorithm.

. Add a pixel error column to the ASCII table extension.

NOTE: All .fits files have been moved from the attachments table to http://msslxx.mssl.ucl.ac.uk:8080/eSDO/algorithms/CoronalLoops/CoronalLoops.html.

-- MikeSmith - 06 Aug 2007

-- ElizabethAuden - 11 Jan 2005

-- MikeSmith - 12 Jan 2005

-- ElizabethAuden - 24 Jan 2005, after meeting meeting on 10 Jan 2005 with MikeSmith, Len Culhane, and Lidia van Driel-Geszteyli.

-- ElizabethAuden 18 Feb 2005

  • 2007_tracing.pdf: Comparison of five numerical codes for automated tracing of coronal loops.

Topic attachments
I Attachment History Action Size Date Who Comment
PDFpdf 2007_tracing.pdf r1 manage 2772.2 K 2007-05-22 - 15:20 MikeSmith Comparison of five numerical codes for automated tracing of coronal loops.
PNGpng 8504_1600_31-MAR-99_c.png r1 manage 43.1 K 2006-03-03 - 16:30 ElizabethAuden Trace 1.6 MK img for AR 8504 31 March 1999
PNGpng 8504_171_31-MAR-99_c.png r1 manage 35.2 K 2006-03-03 - 16:30 ElizabethAuden Trace 171 img for AR 8504 31 March 1999
PNGpng 8504_MDI_31-MAR-99_c.png r1 manage 43.2 K 2006-03-03 - 16:30 ElizabethAuden Trace MDI img for AR 8504 31 March 1999
Unknown file formatpn 8504_MDI_NoWl1600_3-APR-99_c.pn r1 manage 43.9 K 2006-03-03 - 16:30 ElizabethAuden Trace MDI img for AR 8504 3 April 1999
PNGpng 8504_SXT_31-MAR-99_c.png r1 manage 40.8 K 2006-03-03 - 16:30 ElizabethAuden Yohkoh SXT img for AR 8504 31 March 1999
Unknown file formatpn 8504_SXT_NoWl1600_3-APR-99_c.pn r1 manage 30.0 K 2006-03-03 - 16:30 ElizabethAuden Yohkoh SXT img for AR 8504 3 April 1999
PNGpng 8504_WL_31-MAR-99_c.png r1 manage 44.2 K 2006-03-03 - 16:30 ElizabethAuden White light img for AR 8504 31 March 1999
PNGpng 8595_171_22-JUN-99_c.png r1 manage 37.1 K 2006-03-03 - 16:30 ElizabethAuden Trace 171 img for AR 8595 22 June 1999
PNGpng 8595_171_24-JUN-99_c.png r1 manage 35.9 K 2006-03-03 - 16:30 ElizabethAuden Trace 171 img for AR 8595 24 June 1999
PNGpng 8595_MDI_22-JUN-99_c.png r1 manage 44.2 K 2006-03-03 - 16:30 ElizabethAuden Trace MDI img of AR 8595 22 June 1999
PNGpng 8595_MDI_24-JUN-99_c.png r1 manage 44.7 K 2006-03-03 - 16:30 ElizabethAuden Trace MDI img for AR 8595 24 June 1999
PNGpng 8595_SXT_22-JUN-99_c.png r1 manage 40.0 K 2006-03-03 - 16:30 ElizabethAuden Yohkoh SXT img for AR 8595 22 June 1999
PNGpng 8595_SXT_24-JUN-99_c.png r1 manage 35.9 K 2006-03-03 - 16:30 ElizabethAuden Yohkoh SXT img for AR 8595 24 June 1999
Texttxt AboutImgProcessingHelp.txt r1 manage 2.5 K 2006-03-03 - 16:30 MikeSmith Automated Loop Recognition - Text file 1
Texttxt AboutOCMHelp.txt r1 manage 5.2 K 2006-03-03 - 16:30 MikeSmith Automated Loop Recognition - Text file 2
Texttxt AboutSWHelp.txt r1 manage 4.3 K 2006-03-03 - 16:30 MikeSmith Automated Loop Recognition - Text file 4
Texttxt AboutSemiManualHelp.txt r1 manage 2.1 K 2006-03-03 - 16:30 MikeSmith Automated Loop Recognition - Text file 3
Unknown file formatsav CoronaImgAnalysis_BetaV1.sav r1 manage 97.2 K 2006-03-03 - 16:30 MikeSmith Automatic Loop Recognition code (IDL .sav) Lee et al
Postscriptps LeeNewmanGary.ps r1 manage 6690.9 K 2006-03-03 - 16:30 MikeSmith Automated Loop Recognition abstract (Lee et al)
PDFpdf MSthesis.pdf r1 manage 735.2 K 2006-03-03 - 16:30 MikeSmith "Curve Tracing and Curve Detection in Images" - MSc thesis by Karthik Raghupathy.
PNGpng snapshot2.png r1 manage 30.2 K 2006-03-03 - 16:30 MikeSmith Result of Steger's curve tracing algorithm on lt051998.fits
Texttxt trace_sdo.txt r1 manage 2.0 K 2006-03-03 - 16:30 ElizabethAuden Comments from Chris Goff on reducing Trace data
PNGpng traceloops1.png r1 manage 86.4 K 2006-03-03 - 16:30 MikeSmith traceloops1 after Steger processing
PNGpng traceloops2.png r1 manage 37.0 K 2006-03-03 - 16:30 MikeSmith traceloops2 after Steger processing
PNGpng traceloops3.png r1 manage 10.5 K 2006-03-03 - 16:30 MikeSmith traceloops3 after Steger processing
PNGpng traceloops4.png r1 manage 34.2 K 2006-03-03 - 16:30 MikeSmith traceloops4 after Steger processing
PNGpng traceloops5.png r1 manage 21.5 K 2006-03-03 - 16:30 MikeSmith traceloops5 after Steger processing
PNGpng traceloops6.png r1 manage 18.4 K 2006-03-03 - 16:30 MikeSmith traceloops6 after Steger processing

This topic: SDO > WebHome > SolarAlgorithms > LoopRecognition
Topic revision: r21 - 2008-01-10 - ElizabethAuden
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2020 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback