Skip to content
Snippets Groups Projects
Commit 322fac8f authored by Plougonven Erwan's avatar Plougonven Erwan
Browse files

Update README.md

parent df65f633
No related branches found
No related tags found
No related merge requests found
......@@ -19,17 +19,20 @@ Python code for reading profilometry data from a Veeco Wyko NT9100, preprocessi
- [ ] Run the code.
## Example
The following figure shows an example of the process on data from a face of a 2 mm polyhedral particle.
Illustration of the steps the code performs, form left to right: reading, cleaning, filling.
![Illustration of the three steps, reading, cleaning, filling.](assets/Example.png)
![Illustration of the processing steps](assets/Example.png)
*Illustration of the steps the code performs, form left to right: reading, cleaning, filling.*
## Functions
The data passed between function is stored in a [NumPy array](https://numpy.org/doc/stable/reference/arrays.html).
### `extract_Wyko_ASCII_data`
Simple usage, the only parameter is the input file name. It outputs the profilometry data, what I call the height field `hfld`, as well as an intensity field `ifld`. Here's an illustration of the intensity field from the data shown in the example above:
Simple usage, the only parameter is the input file name. It outputs the profilometry data, what I call the height field `hfld`, as well as an intensity field `ifld`.
![Illustration of an intensity field.](assets/Example_intensity.png)
*The intensity field from the data shown in the example above.*
### `removePeaks`
......@@ -44,7 +47,8 @@ The algorithm has three parts:
2. For all defined pixels, compute the local *gradient* as the absolute difference between its value and the average of its (defined) neighbours. If above `diffth` AND part of one of the flagged size 2 connected components, then remove it and its neighbour (because there's no way of determining whether it's that pixel or the neighbour that's the peak). If above `diffth` and is NOT part of the flagged connected components, then add that pixel to an ordered set (ordered by decreasing *gradient*).
3. Iteratively remove the peaks, starting from the highest. For each peak in that ordered set (starting with the one with largest gradient), check if it's still a peak, and if so, set the pixel value to the average of its neighbours. This had to be done iteratively because with high peaks, its neighbours can also be flagged as peaks, as their local gradient is influenced by the peak. The illustration below shows this in one dimension. With this iterative process, the central pixel (the real peak) is filtered, so when we next look at the neighbours, their local gradient is no longer above `diffth`, and are therefore no touched.
![Illustration of the need for an iterative process to remove the peaks. The left graph shows pixels values in a one-dimensional image, along a line, with a high peak in the centre. The right graph shows the local gradients, while the dotted line shows the threshold `diffth`, meaning that the neighbours of the peak are also flagged as peaks.](assets/diffth_example.png)
![Graphs showing a peak and the gradient.](assets/diffth_example.png)
*Illustration of the need for an iterative process to remove the peaks. The left graph shows pixels values in a one-dimensional image, along a line, with a high peak in the centre. The right graph shows the local gradients, while the dotted line shows the threshold `diffth`, meaning that the neighbours of the peak are also flagged as peaks.*
This method is optimal in the sense that is modifies the minimum amount of pixels values (compared to a blunt filter like a median).
......@@ -81,3 +85,4 @@ This function can be generalised to any text file format, if you give it the hea
## Acknowledgements
Thanks to [Laura Manceriu](https://my.uliege.be/tr/view2.do?as_codULg=U224648) for the acquisitions and for providing the data.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment