µND - Hough Needles

1D-magnetic microstructures made of single magnetic microparticles or assemblies of magnetic nanoparticles can find applications in a wide variety of fields that includes composite materials, microfluidics and micro-mechanics. We recently report a method to produc bifunctional magnetic and fluorescent micro needles. To characterize their dimensions and properties in a high throughput automatic way, we setup a simple matlab implementation of the linear hough transform. This image analysis method can be used to automatically detect and analyse tens of such micro needles in microscopy images. The code is available on GitHub and its performance and use are described below.


   Download

Hough Transform principle

According to Wikipedia : The Hough transform is a feature extraction technique used in image analysis, computer vision, and digital image processing. The purpose of the technique is to find imperfect instances of objects within a certain class of shapes by a voting procedure. This voting procedure is carried out in a parameter space, from which object candidates are obtained as local maxima in a so-called accumulator space that is explicitly constructed by the algorithm for computing the Hough transform.

The linear Hough transform algorithm uses a two-dimensional array, called an accumulator, to detect the existence of a line described by \(r=x\cos \theta +y\sin \theta\). The dimension of the accumulator equals the number of unknown parameters, i.e., two, considering quantized values of \(r\) and \(\theta\) in the pair \((r,\theta)\). For each pixel at \((x,y)\) and its neighborhood, the Hough transform algorithm determines if there is enough evidence of a straight line at that pixel. If so, it will calculate the parameters \((r,\theta)\) of that line, and then look for the accumulator's bin that the parameters fall into, and increment the value of that bin. By finding the bins with the highest values, typically by looking for local maxima in the accumulator space, the most likely lines can be extracted, and their (approximate) geometric definitions read off. Since the lines returned do not contain any length information, it is often necessary, in the next step, to find which parts of the image match up with which lines.

This quick introduction comes from the Wikipedia article Hough Transform, which is released under the Creative Commons Attribution-Share-Alike License 3.0.

Example of micro needles analysis

Where to download it ?

You can download the matlab code archive or fork this project on GitHub.

Content

  • fluo.tif: fluorescence image taken with a X20 of micro needles
  • trans.tif: brigthfield image taken with a X20 of micro needles
  • HoughNeedlesGUI.fig: GUI definition for matlab
  • HoughNeedlesGUI.m: Matlab main file, launching the GUI
  • LICENSE.md: Licence
  • README.md: short tutorial (see also below)

How to cite this work?

Assembly and Characterisations of Bifunctional Fluorescent and Magnetic Microneedles With One Decade Length Tunability, Jean-Baptiste Lugagne et al., Advanced Functional Materials, 2017.

Do not hesitate to contact Gaelle Charron if you had any questions relate[d to producing such micro needles and analysing them with our software. Gaelle.Charron[[at]]univ-paris-diderot.fr

How to use it?

To run the program, launch HoughNeedlesGUI.m. Matlab will first ask you to select a transmitted light image on which to process the linear Hough Transform. It will then ask for a second image, the corresponding fluorescence image from which to process the fluorescence level per needle in case you need to extract the fluorescence of each needles. Note that this second image is optional and that you can proceed to the main GUI by clicking cancel in the file selection interface.

After the image(s) file(s) have been selected, the program proceeds to the main GUI. Note that, if the window is too small or too large for your screen, you can resize it. At this point, the GUI asks that you select a background region. Draw a region in the image without needles and then double click on it to launch the image processing.

Once the reference background region has been provided, the program launches the Hough needles processing. This operation may take a while depending on your machine, although it should not last more than a couple minutes. Once the hough operation is over, the GUI displays the identified needles, and allows you to select them and perform operations on them.

On the right hand side of the GUI window, a cheat sheet of the keyboard shortcuts and a info text are present. The keyboard shortcuts allow you to switch between the different possible operations to perform on the needles to correct the result of the Hough processing step. It is also possible to change parameters and redo the processing, and finally to save the data.

The different possible operations are:

  • Add segment mode ('a' key):
  • Move segment mode ('m' key):
  • Cut segment mode ('c' key):
  • Fuse segments mode ('f' key):
  • Delete segments mode ('d' key):
  • Reload needles map ('r' key):
  • Nothing mode ('0' key):
  • Hide/Un-hide segments ('h' key):
  • Toggle between images ('b' key):
  • Change threshold value ('t' key):
  • Update Hough processing ('u' key):
  • Save data to csv file ('s' key):
  • Save image file ('i' key):