Skip to content

Commit 5d53c9a

Browse files
committed
Updated Documentation
Updated the documentation to include details on using manual segmentation and pre-segmented masks.
1 parent 80d9a74 commit 5d53c9a

5 files changed

Lines changed: 88 additions & 15 deletions

File tree

0 Bytes
Binary file not shown.

docs/_static/manual_segui.png

123 KB
Loading

docs/_static/segui.png

-1.49 KB
Loading

docs/particle_analysis.rst

Lines changed: 52 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,28 +17,69 @@ Once you have chosen your segmentation parameters and successfully prepared a pr
1717
Particle Analysis will run the segmentation on your data and calculate a number of parameters for each particle.
1818

1919
The calculated parameters include:
20-
- Area
21-
- Equivalent circular diameter
22-
- Major and minor axes lengths
23-
- Circularity
24-
- Eccentricity
25-
- Total particle intensity
26-
- Zone axis (if atomic resolution images of fcc structure, looking to expand this!)
20+
21+
* Area
22+
23+
* Equivalent circular diameter
24+
25+
* Major and minor axes lengths
26+
27+
* Circularity
28+
29+
* Eccentricity
30+
31+
* Total particle intensity
32+
33+
* Zone axis (if atomic resolution images of fcc structure, looking to expand this!)
2734

2835
.. code-block:: python
2936
3037
>>> #Syntax for accessing particle properties.
3138
>>> particles.list[0].properties['area']
3239
40+
Combining Particles from Multiple Images
41+
----------------------------------------
42+
43+
It is possible to analyse particles from multiple images by passing a previously populated Particle_list object to :py:meth:`~.ParticleAnalysis` instead of returning a new Particle_list.
44+
For example:
45+
46+
.. code-block:: python
47+
48+
>>> ps.ParticleAnalysis(data, params, particles=particles)
49+
50+
EDS Analysis
51+
------------
52+
3353
In addition, Particle Analysis will also segment and process EDS data if given as an additional dataset in the data list.
3454

3555
Particle Analysis can do the following processing on EDS data:
36-
- Obtain the EDS spectrum of each particle.
37-
- Obtain elemental maps of each particle.
38-
- Get the composition of each particle if k-factors or zeta-factors are supplied in the parameters object.
56+
57+
* Obtain the EDS spectrum of each particle.
58+
59+
* Obtain elemental maps of each particle.
60+
61+
* Get the composition of each particle if k-factors or zeta-factors are supplied in the parameters object.
3962

4063
.. code-block:: python
4164
4265
>>> params = ps.parameters.load()
4366
>>> params.generate_eds(eds_method='CL',elements=['Pt','Au'],factors=[1.7,1.9],store_maps=False)
44-
>>> particles = ps.ParticleAnalysis(data, params)
67+
>>> particles = ps.ParticleAnalysis(data, params)
68+
69+
Particle Segmentation with a Pre-Generated Mask
70+
-----------------------------------------------
71+
72+
:py:meth:`~.ParticleAnalysis` will also accept pre-generated masks, either generated externally or through the manual option of :py:meth:`~.SegUI`.
73+
In order to use a pre-generated mask it is possible to pass a mask argument to :py:meth:`~.ParticleAnalysis`.
74+
75+
.. code-block:: python
76+
77+
>>> generated_mask = hs.load('maskfile')
78+
>>> params = ps.parameters.load() # This isn't used if you load a pre-generated mask but you still have to pass it.
79+
>>> particles = ps.ParticleAnalysis(data, params, mask=generated_mask)
80+
81+
If you have used the manual segmentation editor in :py:meth:`~.SegUI` you can simply pass 'UI' as the mask argument.
82+
83+
.. code-block:: python
84+
85+
>>> particles = ps.ParticleAnalysis(data, params, mask='UI')

docs/segmentation.rst

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Segmentation
77
ParticleSpy provides different options for the segmentation of particles from images.
88

99
Using a Pre-Segmented Mask
10-
==========================
10+
--------------------------
1111

1212
The most straightforward method is to supply ParticleSpy with a pre-segmented mask (boolean image).
1313

@@ -18,19 +18,29 @@ The most straightforward method is to supply ParticleSpy with a pre-segmented ma
1818
In this way other software (e.g. ImageJ) could be used to perform segmentation which is then used by ParticleSpy to segment particles.
1919

2020
Using the Segmentation User Interface
21-
=====================================
21+
-------------------------------------
2222

23-
ParticleSpy can also perform its own segmentation using functions from scikit-image. A number of methods and options for segmentation are included and therefore ParticleSpy parameterizes the segmentation process. In order to choose the correct parameters for your segmentation ParticleSpy provides a Segmentation User Interface, that can be launched from a python kernel using the :py:meth:`~.SegUI` function.
23+
ParticleSpy can also perform its own segmentation either using automated functions from scikit-image or using a fully manual approach.
24+
In order to assist with both methods, ParticleSpy provides a Segmentation User Interface.
25+
This can be launched from a python kernel using the :py:meth:`~.SegUI` function.
2426

2527
.. code-block:: python
2628
2729
>>> SegUI(image)
2830
29-
Once the Segmentation User Interface is launched the image is displayed and a number of options are available on the right hand side.
31+
Parameter Picking for Automated Segmentation
32+
============================================
33+
34+
Once the Segmentation User Interface is launched the 'Auto' panel is displayed.
35+
This panel provides a number of options that can be tuned to provide an optimal automated segmentation.
36+
Once you have chosen your parameters, pressing 'Update' will display a segmented image.
37+
'Update' will also save the current parameters to use later.
3038

3139
.. image:: _static/segui.png
3240
:align: center
3341

42+
The parameters for the automated segmentation are described here:
43+
3444
(1) Rolling ball size
3545

3646
The rolling ball algorithm is equivalent to a top hat filter. It acts to remove slowly varying background intensity at a size larger than the particle diameter. The default is to not apply a rolling ball (value = 0). To apply a rolling ball enter a value (in pixels) that is significantly larger than your particle diameter.
@@ -73,3 +83,25 @@ Prints the current parameters as output for reference.
7383
(10) Display
7484

7585
Option to display either the image with label boundaries displayed, or the solid labels coloured by label number.
86+
87+
Manual Segmentation
88+
===================
89+
90+
The second tab in the Segmentation User Interface provides an option to manually segment an individual image.
91+
You can get to this tab by clicking 'Manual' in the top bar.
92+
93+
Here, segmentation works by holding the left mouse button and drawing around the outside of a particle.
94+
Once you have completely enclosed the particle, release the left mouse button.
95+
If you are happy with your particle boundary, click on the particle centre with the right mouse button.
96+
You may notice the middle of the particle turn slightly blue (can be difficult to see).
97+
Continue to segment all of the particles in the image in this way until all are segmented.
98+
99+
Once you have segmented all of the particles, click 'Save Segmentation'.
100+
This will save the generated segmentation as an internal npy file that can be read when using :py:meth:`~.ParticleAnalysis`.
101+
102+
.. image:: _static/manual_segui.png
103+
:align: center
104+
105+
.. warning::
106+
Do NOT right-click on any part of the image that is not fully enclosed by a red circle.
107+
Doing so will ruin the segmentation and you will have to reload SegUI.

0 commit comments

Comments
 (0)