Skip to content

Commit

Permalink
Add a measurement page to the PyDIP User Manual.
Browse files Browse the repository at this point in the history
  • Loading branch information
crisluengo committed Dec 12, 2024
1 parent 76349c6 commit 0a47c9c
Show file tree
Hide file tree
Showing 7 changed files with 300 additions and 52 deletions.
1 change: 1 addition & 0 deletions doc/src/PyDIP/00_toc.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ These pages will get you started using *DIPlib* within Python. If you are famili
1. \subpage pum_indexing
1. \subpage pum_tensor_images
1. \subpage pum_filtering
1. \subpage pum_measurement
1. \subpage pum_display
1. \subpage pum_numpy
1. \subpage pum_dipjavaio
Expand Down
Binary file removed doc/src/PyDIP/basics-16.png
Binary file not shown.
54 changes: 2 additions & 52 deletions doc/src/PyDIP/basics.md
Original file line number Diff line number Diff line change
Expand Up @@ -251,43 +251,7 @@ print(m)
4 | 209.0 | 0.9698 | 61.63 | 25.80 | 0.3937 | -0.7994 | 215.5 |
5 | 462.0 | 0.9665 | 62.10 | 20.27 | 0.7329 | 0.1613 | 478.0 |
6 | 611.0 | 0.9745 | 81.17 | 17.92 | -0.3812 | -0.2219 | 627.0 |
7 | 80.00 | 0.9816 | 83.10 | 15.72 | 0.1468 | -0.7721 | 81.50 |
8 | 205.0 | 0.9762 | 52.92 | 32.19 | 0.1556 | -1.183 | 210.0 |
9 | 419.0 | 0.9836 | 41.60 | 30.24 | 0.8653 | -0.3741 | 426.0 |
10 | 363.0 | 0.9041 | 71.56 | 22.25 | -0.2541 | -0.5946 | 401.5 |
11 | 487.0 | 0.9740 | 57.81 | 25.17 | 0.05945 | -0.4846 | 500.0 |
12 | 383.0 | 0.9746 | 53.10 | 24.60 | 0.6360 | -0.3009 | 393.0 |
13 | 250.0 | 0.9709 | 50.21 | 30.08 | 0.6251 | -0.8159 | 257.5 |
14 | 137.0 | 0.9786 | 64.47 | 22.41 | 0.5215 | -0.8983 | 140.0 |
15 | 378.0 | 0.9668 | 64.85 | 21.35 | 0.3866 | -0.5561 | 391.0 |
16 | 392.0 | 0.9043 | 48.06 | 31.20 | 0.4776 | -0.8514 | 433.5 |
17 | 230.0 | 0.9746 | 70.43 | 23.68 | -0.2813 | -0.6269 | 236.0 |
18 | 262.0 | 0.9686 | 62.26 | 25.31 | 0.3051 | -0.7452 | 270.5 |
19 | 637.0 | 0.9245 | 52.94 | 23.86 | 0.8441 | -0.08530 | 689.0 |
20 | 341.0 | 0.9757 | 54.94 | 25.06 | 0.8843 | -0.3705 | 349.5 |
21 | 501.0 | 0.9747 | 51.85 | 24.15 | 0.9221 | -0.05920 | 514.0 |
22 | 556.0 | 0.8580 | 60.65 | 22.53 | 0.5287 | -0.3121 | 648.0 |
23 | 592.0 | 0.8889 | 58.28 | 29.00 | 0.1195 | -1.026 | 666.0 |
24 | 172.0 | 0.9718 | 68.47 | 23.14 | 0.3064 | -0.9392 | 177.0 |
25 | 566.0 | 0.9792 | 41.71 | 30.85 | 0.7348 | -0.5709 | 578.0 |
26 | 842.0 | 0.9268 | 53.14 | 26.75 | 0.1291 | -0.4931 | 908.5 |
27 | 209.0 | 0.9676 | 56.00 | 26.01 | 0.5350 | -0.8241 | 216.0 |
28 | 147.0 | 0.9545 | 65.14 | 24.51 | 0.3733 | -0.9707 | 154.0 |
29 | 375.0 | 0.9766 | 71.89 | 21.69 | 0.06353 | -0.7623 | 384.0 |
30 | 385.0 | 0.9637 | 51.05 | 27.73 | 0.6729 | -0.5471 | 399.5 |
31 | 223.0 | 0.9612 | 63.78 | 25.31 | 0.1825 | -0.4636 | 232.0 |
32 | 347.0 | 0.9734 | 55.33 | 26.30 | 0.5900 | -0.7111 | 356.5 |
33 | 604.0 | 0.9527 | 50.44 | 26.84 | 0.6709 | -0.5829 | 634.0 |
34 | 354.0 | 0.9739 | 42.53 | 33.74 | 0.6403 | -0.9280 | 363.5 |
35 | 543.0 | 0.9696 | 50.64 | 24.14 | 1.068 | 0.3071 | 560.0 |
36 | 147.0 | 0.9515 | 67.05 | 22.61 | 0.2393 | -0.5154 | 154.5 |
37 | 405.0 | 0.9000 | 83.24 | 23.60 | -0.9721 | 0.0003058 | 450.0 |
38 | 577.0 | 0.9714 | 30.64 | 31.71 | 1.246 | 0.2249 | 594.0 |
39 | 497.0 | 0.9717 | 61.73 | 18.86 | 1.101 | 0.3655 | 511.5 |
40 | 525.0 | 0.9813 | 34.06 | 31.89 | 1.047 | -0.1825 | 535.0 |
41 | 803.0 | 0.9634 | 54.23 | 25.55 | 0.4471 | -0.5974 | 833.5 |
42 | 253.0 | 0.9750 | 59.83 | 25.32 | 0.4961 | -0.8077 | 259.5 |
43 | 193.0 | 0.9772 | 65.91 | 23.49 | 0.4554 | -0.8702 | 197.5 |
<snip>
```

The `dip.Measurement` object `m` can be indexed in three levels: the measurement name ('Statistics'),
Expand All @@ -309,18 +273,4 @@ np.asarray(m[30]) # returns a 2D NumPy array for a single row of the measuremen
np.asarray(m['Solidity']) # returns a 2D NumPy array for a column
```

We can paint the objects with one of the measurements, which can be useful for display:
```python
c = dip.ObjectToMeasurement(b, m['Solidity'])
c.Show(colormap='viridis')
```
![Image where the intensity of each object is its 'Solidity' value](basics-16.png)

Here we plot size vs solidity:
```python
import matplotlib.pyplot as plt
plt.scatter(np.asarray(m['Size']), np.asarray(m['Solidity']))
plt.xlabel('Size (μm²)')
plt.ylabel('Solidity')
```
![2D scatter plot of size vs solidity, there's no correlation](basics-17.png)
See \ref pum_measurement for a more in-depth look at the measurement object.
Binary file added doc/src/PyDIP/measurement-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/src/PyDIP/measurement-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Loading

0 comments on commit 0a47c9c

Please sign in to comment.