Skip to content

Commit 8af2f48

Browse files
committed
Merge branch 'topic/default/doc' into 'branch/default'
Improve documentation See merge request fluiddyn/fluidimage!125
2 parents 163538a + 5642b6c commit 8af2f48

21 files changed

+170
-113
lines changed

.hgignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ image_samples/*/*/params_*.xml
7575
image_samples/*/Images.bench
7676
image_samples/4th_PIV-Challenge_Case_E/E_Calibration_Images/Camera_0*/calib*.npz
7777
image_samples/Milestone/Images_many*
78+
image_samples/SurfTracking/Images.examples
7879

7980
image_samples/Karman/Images.civ/*
8081
image_samples/*/Images.*_example*

doc/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,4 +164,4 @@ open_html: html
164164
firefox _build/html/index.html
165165

166166
format:
167-
mdformat *.md
167+
mdformat *.md */*.md

doc/examples/bos_parallel.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
# BOS computation
22

3-
This minimal example presents how to carry out a simple BOS
4-
computation. See also the documentation of the class
5-
{class}`fluidimage.bos.Topology` and the work defined in
6-
the subpackage {mod}`fluidimage.works.piv`.
3+
This minimal example presents how to carry out a simple BOS computation. See also the
4+
documentation of the class {class}`fluidimage.bos.Topology` and the work defined in the
5+
subpackage {mod}`fluidimage.works.piv`.
76

87
```{literalinclude} bos_parallel.py
98
```

doc/examples/optflow_parallel.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# Optical flow computation in parallel with `TopologyOpticalFlow`
22

3-
This minimal example presents how to carry out a simple optical flow
4-
computation. See also the documentation of the class
5-
{class}`fluidimage.topologies.optical_flow.TopologyOpticalFlow` and the work
6-
defined in the subpackage {mod}`fluidimage.works.optical_flow`.
3+
This minimal example presents how to carry out a simple optical flow computation. See
4+
also the documentation of the class
5+
{class}`fluidimage.topologies.optical_flow.TopologyOpticalFlow` and the work defined in
6+
the subpackage {mod}`fluidimage.works.optical_flow`.
77

88
```{literalinclude} optflow_parallel.py
99
```

doc/examples/optflow_try_params.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
# How to find good optical flow parameters?
22

3-
Asynchronous topologies are not very convenient to look for the best parameters
4-
for a computation. It is better to use the optical flow work directly as in
5-
this example:
3+
Asynchronous topologies are not very convenient to look for the best parameters for a
4+
computation. It is better to use the optical flow work directly as in this example:
65

76
```{literalinclude} optflow_try_params.py
87
```
98

109
The parameters in `params.series` are used to define an object
11-
{class}`fluiddyn.util.serieofarrays.SeriesOfArrays`
12-
and to select one serie (which represents here a couple of images). It is also
13-
what is done internally in the topology. Have a look at
10+
{class}`fluiddyn.util.serieofarrays.SeriesOfArrays` and to select one serie (which
11+
represents here a couple of images). It is also what is done internally in the topology.
12+
Have a look at
1413
[our tutorial](https://fluiddyn.readthedocs.io/en/latest/tutorials/tuto_serieofarrays.html)
1514
to discover how to use this powerful tool!

doc/examples/piv_cluster.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# PIV computation on a cluster
22

3-
This minimal example presents how to carry out a simple PIV computation on a
4-
cluster. We need a script for the computation and a script to submit the job.
3+
This minimal example presents how to carry out a simple PIV computation on a cluster. We
4+
need a script for the computation and a script to submit the job.
55

6-
We call the script for the computation `piv_complete.py`. For idempotent job,
7-
it is important to set `params.saving.how = 'complete'`.
6+
We call the script for the computation `piv_complete.py`. For idempotent job, it is
7+
important to set `params.saving.how = 'complete'`.
88

99
```{literalinclude} piv_parallel_complete.py
1010
```

doc/examples/piv_parallel.md

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
11
# PIV computation in parallel with `TopologyPIV`
22

3-
This minimal example presents how to carry out a simple PIV computation. See
4-
also the documentation of the class
5-
{class}`fluidimage.topologies.piv.TopologyPIV` and the work defined in the
6-
subpackage {mod}`fluidimage.works.piv`.
3+
This minimal example presents how to carry out a simple PIV computation. See also the
4+
documentation of the class {class}`fluidimage.topologies.piv.TopologyPIV` and the work
5+
defined in the subpackage {mod}`fluidimage.works.piv`.
76

87
```{literalinclude} piv_parallel.py
98
```
109

11-
We now show a similar example but with a simple preprocessing (using a function
12-
`im2im`):
10+
We now show a similar example but with a simple preprocessing (using a function `im2im`):
1311

1412
```{literalinclude} piv_parallel_im2im.py
1513
```
1614

17-
The file `my_example_im2im.py` should be importable (for example in the same
18-
directory than `piv_parallel_im2im.py`)
15+
The file `my_example_im2im.py` should be importable (for example in the same directory
16+
than `piv_parallel_im2im.py`)
1917

2018
```{literalinclude} my_example_im2im.py
2119
```
@@ -25,8 +23,8 @@ Same thing but the preprocessing is done with a class `Im2Im`
2523
```{literalinclude} piv_parallel_im2im_class.py
2624
```
2725

28-
The file `my_example_im2im_class.py` should be importable (for example in the
29-
same directory than `piv_parallel_im2im_class.py`)
26+
The file `my_example_im2im_class.py` should be importable (for example in the same
27+
directory than `piv_parallel_im2im_class.py`)
3028

3129
```{literalinclude} my_example_im2im_class.py
3230
```

doc/examples/piv_try_params.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
# How to find good PIV parameters?
22

33
Fluidimage is designed to process several images in parallel with asynchronous
4-
"topologies". However, the asynchronous PIV topology is not very convenient to
5-
look for the best parameters for a PIV computation. It is better to use the PIV
6-
"work" directly as in these examples:
4+
"topologies". However, the asynchronous PIV topology is not very convenient to look for
5+
the best parameters for a PIV computation. It is better to use the PIV "work" directly as
6+
in these examples:
77

88
```{literalinclude} piv_try_params.py
99
```
1010

1111
The parameters in `params.series` are used to define a
12-
{class}`fluiddyn.util.serieofarrays.SeriesOfArrays`
13-
and to select one serie (which represents here a couple of images). It is also
14-
what is done internally in the PIV topology. Have a look at
12+
{class}`fluiddyn.util.serieofarrays.SeriesOfArrays` and to select one serie (which
13+
represents here a couple of images). It is also what is done internally in the PIV
14+
topology. Have a look at
1515
[our tutorial](https://fluiddyn.readthedocs.io/en/latest/tutorials/tuto_serieofarrays.html)
1616
to discover how to use this powerful tool!
1717

doc/examples/preproc.md

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ There are two main methods to preprocess images with Fluidimage:
55
1. with user-defined preprocessing functions or classes, or
66
2. with pre-defined preprocessing classes.
77

8-
For both methods, we use a `Work` class to try parameters and a `Topology`
9-
class to apply this work in parallel on a large serie of images.
10-
See the [](../overview_orga_package.md) for an explanation about this terminology.
8+
For both methods, we use a `Work` class to try parameters and a `Topology` class to apply
9+
this work in parallel on a large serie of images. See the [](../overview_orga_package.md)
10+
for an explanation about this terminology.
1111

1212
## 1. User-defined preprocessing
1313

14-
Let's assume that you have a function or a class which gets an image as
15-
argument and returns a new image. If it is importable, you can use Fluidimage
16-
to first investigate which are the better parameters for your case:
14+
Let's assume that you have a function or a class which gets an image as argument and
15+
returns a new image. If it is importable, you can use Fluidimage to first investigate
16+
which are the better parameters for your case:
1717

1818
```{literalinclude} im2im_try_params.py
1919
```
@@ -26,14 +26,13 @@ and then process a large serie of images in parallel with the class
2626

2727
## 2. Pre-defined preprocessing classes
2828

29-
Fluidimage also provides pre-defined preprocessing classes to apply many
30-
standard preprocessing to images.
29+
Fluidimage also provides pre-defined preprocessing classes to apply many standard
30+
preprocessing to images.
3131

3232
### Preprocessing one serie
3333

34-
To find the good parameter, you can use the class
35-
{class}`fluidimage.preproc.Work` (see also
36-
{mod}`fluidimage.preproc`).
34+
To find the good parameter, you can use the class {class}`fluidimage.preproc.Work` (see
35+
also {mod}`fluidimage.preproc`).
3736

3837
```{literalinclude} preproc_try_params.py
3938
```

doc/examples/surface_tracking.py

Lines changed: 39 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,48 @@
1+
import skimage
2+
13
from fluidimage.topologies.surface_tracking import Topology
24

5+
6+
def rescale_intensity(tuple_path_image):
7+
"""
8+
Rescale image intensities, between the specified minima and maxima,
9+
by using a multiplicative factor.
10+
11+
----------
12+
minima, maxima : float
13+
Sets the range to which current intensities have to be rescaled.
14+
15+
"""
16+
path, img = tuple_path_image
17+
# the processing can be adjusted depending on the value of the path.
18+
print("process file:\n" + path)
19+
minima = 0
20+
maxima = 4095
21+
out_range = (minima, maxima)
22+
img_out = skimage.exposure.rescale_intensity(img, out_range=out_range)
23+
return img_out
24+
25+
326
params = Topology.create_default_params()
427

5-
params.film.fileName = "film.cine"
6-
params.film.path = "../../../surfacetracking/111713"
7-
params.film.path_ref = "../../../surfacetracking/reference_water"
28+
path_src = "../../image_samples/SurfTracking/Images"
29+
30+
params.images.path = path_src
31+
params.images.path_ref = path_src
32+
params.images.str_subset = ":4:2"
33+
params.images.str_subset_ref = ":3"
34+
35+
params.surface_tracking.xmin = 200
36+
params.surface_tracking.xmax = 250
37+
params.surface_tracking.correct_pos = True
38+
39+
params.preproc.im2im = rescale_intensity
840

9-
# params.saving.how has to be equal to 'complete' for idempotent jobs
10-
# # (on clusters)
11-
params.saving.plot = False
12-
params.saving.how_many = 100
13-
params.saving.how = "complete"
14-
params.saving.postfix = "surface_tracking_example"
41+
params.saving.how = "recompute"
42+
# params.saving.path = str(self.path_out)
43+
params.saving.postfix = "examples"
1544

1645
topology = Topology(params, logging_level="info")
1746
# topology.make_code_graphviz('topo.dot')
18-
seq = False
19-
topology.compute(sequential=seq)
2047

21-
# not generating plots if seq mode is false
22-
if not seq:
23-
params.saving.plot = False
48+
topology.compute(executor="exec_sequential")

0 commit comments

Comments
 (0)