Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions doc/examples/use_cases/fabry_perot.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,11 @@
# Configure line profile extraction
profile_param = sigima.proc.image.LineProfileParam()
profile_param.direction = "horizontal"
profile_param.row = center_y # Extract profile through image center
profile_param.y = center_y # Extract profile through image center (Y coordinate)

print("\n✓ Horizontal profile configured:")
print(f"Direction: {profile_param.direction}")
print(f"Row: {profile_param.row} (image center)")
print(f"Y: {profile_param.y} (image center)")

# Extract intensity profile
profile_signal1 = sigima.proc.image.line_profile(img1, profile_param)
Expand Down
7 changes: 4 additions & 3 deletions doc/examples/use_cases/laser_beam.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,16 +167,17 @@ def load_laser_beam_images():

line_profiles = []
for i, (img, centroid_coords) in enumerate(zip(clipped_images, centroids)):
# Create line profile parameters for horizontal line through centroid
# Create line profile parameters for horizontal line through centroid (the
# centroid and the profile coordinates are in the physical units of the image)
line_param = sigima.proc.image.LineProfileParam()
line_param.direction = "horizontal"
line_param.row = int(centroid_coords[1]) # Use centroid y-coordinate as row
line_param.y = centroid_coords[1] # Use centroid y-coordinate

# Extract line profile
profile = sigima.proc.image.line_profile(img, line_param)
profile.title = f"Line_profile_{img.title}"
line_profiles.append(profile)
print(f" ✓ Extracted line profile for {img.title} at row {line_param.row}")
print(f" ✓ Extracted line profile for {img.title} at y = {line_param.y:.1f}")

print(f"\n✓ Generated {len(line_profiles)} line profiles")

Expand Down
10 changes: 8 additions & 2 deletions doc/locale/fr/LC_MESSAGES/release_notes/release_1.04.po
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,18 @@ msgstr "**Centre de l'image** : `ImageObj.xc` et `ImageObj.yc` sont désormais l
msgid "**Ellipse coordinates**: `EllipseCoordinates` (`sigima.objects.shape`) now holds the 5 values `(x, y, a, b, theta)` of ellipse geometry results, which can thus be transformed."
msgstr "**Coordonnées d'ellipse** : `EllipseCoordinates` (`sigima.objects.shape`) contient désormais les 5 valeurs `(x, y, a, b, theta)` des résultats géométriques d'ellipse, qui peuvent ainsi être transformés."

msgid "**Operation contract versions**: The operation contracts keep version 1 in this release, although the result of some operations changed since 1.3.0 (for example `resampling`, `extract_roi` and the product of signals): the contracts had just been published with Sigima 1.3.0 and were not used yet. This one-off exception does not apply to later releases: from now on, the version of a contract is increased whenever a change of the computation changes its result, whatever the releases of the applications using Sigima, and calls recorded with an earlier version are refused instead of being replayed (see [Operation contracts and versions](../user_guide/contracts.rst))."
msgstr "**Versions des contrats d'opération** : les contrats d'opération conservent la version 1 dans cette version, bien que le résultat de certaines opérations ait changé depuis la 1.3.0 (par exemple `resampling`, `extract_roi` et le produit de signaux) : les contrats venaient d'être publiés avec Sigima 1.3.0 et n'étaient pas encore exploités. Cette exception ponctuelle ne s'applique pas aux versions ultérieures : désormais, la version d'un contrat est augmentée dès qu'une modification du calcul change son résultat, indépendamment des publications des applications utilisant Sigima, et les appels enregistrés avec une version antérieure sont refusés au lieu d'être rejoués (voir [Contrats d'opération et versions](../user_guide/contracts.rst))."
msgid "**Operation contract versions**: The operation contracts keep version 1 in this release, although the result of some operations changed since 1.3.0 (for example `resampling`, `extract_roi` and the product of signals): the contracts had just been published with Sigima 1.3.0 and were not used yet. This one-off exception does not apply to later changes: from now on, the version of a contract is increased whenever a change of the computation changes its result, whatever the releases of the applications using Sigima, and calls recorded with an earlier version are refused instead of being replayed (see [Operation contracts and versions](../user_guide/contracts.rst)). The image profiles, changed afterwards (see below), are thus at version 2."
msgstr "**Versions des contrats d'opération** : les contrats d'opération conservent la version 1 dans cette version, bien que le résultat de certaines opérations ait changé depuis la 1.3.0 (par exemple `resampling`, `extract_roi` et le produit de signaux) : les contrats venaient d'être publiés avec Sigima 1.3.0 et n'étaient pas encore exploités. Cette exception ponctuelle ne s'applique pas aux modifications ultérieures : désormais, la version d'un contrat est augmentée dès qu'une modification du calcul change son résultat, indépendamment des publications des applications utilisant Sigima, et les appels enregistrés avec une version antérieure sont refusés au lieu d'être rejoués (voir [Contrats d'opération et versions](../user_guide/contracts.rst)). Les profils d'image, modifiés ensuite (voir ci-dessous), sont donc en version 2."

msgid "**Image profiles in physical coordinates**: The line, segment, average and radial profiles of images are now defined and returned in the physical coordinates of the image, like regions of interest and analysis results, instead of pixel indices. Their parameters were renamed, so that scripts using the former names fail explicitly instead of silently using another meaning: `LineProfileParam.row`/`col` became `y`/`x` (the row or column whose pixel centers are the nearest), `SegmentProfileParam.row1`/`col1`/`row2`/`col2` and `AverageProfileParam.row1`/`col1`/`row2`/`col2` became `x1`/`y1`/`x2`/`y2` (for the average profile, `None` stands for the edge of the image instead of `-1`, and the pixels are those whose centers lie in the rectangle, like rectangular ROIs), and `RadialProfileParam.x0`/`y0` became `xc`/`yc`. The X axis of the profiles holds physical coordinates or distances, with the unit and label of the corresponding axis of the image. Segment and radial profiles are sampled in steps of the smallest distance between pixel centers, so that the radial profile is circular for anisotropic pixels and non-uniform coordinates; they are refused when the X and Y units of the image differ. Coordinates outside the image are refused instead of being clamped. On images without calibration (origin 0, pixel size 1), results are unchanged. The contracts of `line_profile`, `segment_profile`, `average_profile` and `radial_profile` are at version 2."
msgstr "**Profils d'image en coordonnées physiques** : les profils ligne, segment, moyen et radial des images sont désormais définis et renvoyés dans les coordonnées physiques de l'image, comme les régions d'intérêt et les résultats d'analyse, au lieu d'indices de pixels. Leurs paramètres ont été renommés, afin que les scripts utilisant les anciens noms échouent explicitement au lieu d'utiliser silencieusement un autre sens : `LineProfileParam.row`/`col` deviennent `y`/`x` (la ligne ou la colonne dont les centres de pixels sont les plus proches), `SegmentProfileParam.row1`/`col1`/`row2`/`col2` et `AverageProfileParam.row1`/`col1`/`row2`/`col2` deviennent `x1`/`y1`/`x2`/`y2` (pour le profil moyen, `None` désigne le bord de l'image au lieu de `-1`, et les pixels retenus sont ceux dont le centre est dans le rectangle, comme pour les ROI rectangulaires), et `RadialProfileParam.x0`/`y0` deviennent `xc`/`yc`. L'axe X des profils contient des coordonnées ou des distances physiques, avec l'unité et le libellé de l'axe correspondant de l'image. Les profils de segment et radiaux sont échantillonnés par pas égaux à la plus petite distance entre centres de pixels, de sorte que le profil radial est circulaire pour des pixels anisotropes et des coordonnées non uniformes ; ils sont refusés lorsque les unités X et Y de l'image diffèrent. Les coordonnées hors de l'image sont refusées au lieu d'être ramenées au bord. Sur les images sans calibration (origine 0, taille de pixel 1), les résultats sont inchangés. Les contrats de `line_profile`, `segment_profile`, `average_profile` et `radial_profile` sont en version 2."

msgid "🛠️ Bug Fixes since version 1.3.0"
msgstr "🛠️ Corrections de bugs depuis la version 1.3.0"

msgid "**Image profiles**: The radial profile centered on the image center was computed around a wrong point on calibrated images (the physical center was used as pixel indices), and could even contain undefined values. Vertical profiles were labeled with the unit of the X axis instead of the Y axis, and all profiles with the unit of the image although their X axis was in pixels. Anti-diagonal segment profiles (e.g. from the top-right to the bottom-left corner) were extracted along the other diagonal."
msgstr "**Profils d'image** : le profil radial centré sur le centre de l'image était calculé autour d'un mauvais point sur les images calibrées (le centre physique était utilisé comme indices de pixels), et pouvait même contenir des valeurs indéfinies. Les profils verticaux portaient l'unité de l'axe X au lieu de l'axe Y, et tous les profils l'unité de l'image alors que leur axe X était en pixels. Les profils de segment anti-diagonaux (par exemple du coin supérieur droit au coin inférieur gauche) étaient extraits le long de l'autre diagonale."

msgid "**Exact integer import**: Integer data that does not fit any integer type supported by the destination object (for example `uint32` counts above 2 147 483 647 in an image, or large integers in a signal) is now converted to a floating-point type that represents every value exactly. Such data was previously converted to `float32` when the source used 4-byte integers, which rounded counts above 16 777 216. A warning is now emitted when no supported floating-point type is exact (integers beyond 2⁵³)."
msgstr "**Import exact des entiers** : les données entières qui ne tiennent dans aucun type entier pris en charge par l'objet de destination (par exemple des comptages `uint32` supérieurs à 2 147 483 647 dans une image, ou de grands entiers dans un signal) sont désormais converties vers un type flottant représentant chaque valeur exactement. Ces données étaient auparavant converties en `float32` lorsque la source utilisait des entiers sur 4 octets, ce qui arrondissait les comptages au-delà de 16 777 216. Un avertissement est désormais émis lorsqu'aucun type flottant pris en charge n'est exact (entiers au-delà de 2⁵³)."

Expand Down
4 changes: 3 additions & 1 deletion doc/release_notes/release_1.04.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,12 @@ The [user guide](../user_guide/overview.rst) shows how readers and connectors at
* **Replay of processing in image ROIs**: The selection of image pixels by regions of interest is now recorded with each call on images carrying regions of interest (rule `sigima.image.roi.pixel_centers`, `sigima.proc.contracts.IMAGE_ROI_CONVENTION`, in the execution context described by `describe_call` and `prepare_execution`). Applications that replay recorded processing (e.g. DataLab capsules) refuse to replay such calls recorded with earlier versions, which selected other pixels, instead of reporting a different result. Calls on images without regions of interest are not concerned.
* **Image center**: `ImageObj.xc` and `ImageObj.yc` are now the center of the pixel grid (halfway between the centers of the first and last pixels), for uniform and non-uniform coordinates: they were half a pixel off for uniform coordinates. `width` and `height` are unchanged.
* **Ellipse coordinates**: `EllipseCoordinates` (`sigima.objects.shape`) now holds the 5 values `(x, y, a, b, theta)` of ellipse geometry results, which can thus be transformed.
* **Operation contract versions**: The operation contracts keep version 1 in this release, although the result of some operations changed since 1.3.0 (for example `resampling`, `extract_roi` and the product of signals): the contracts had just been published with Sigima 1.3.0 and were not used yet. This one-off exception does not apply to later releases: from now on, the version of a contract is increased whenever a change of the computation changes its result, whatever the releases of the applications using Sigima, and calls recorded with an earlier version are refused instead of being replayed (see [Operation contracts and versions](../user_guide/contracts.rst)).
* **Operation contract versions**: The operation contracts keep version 1 in this release, although the result of some operations changed since 1.3.0 (for example `resampling`, `extract_roi` and the product of signals): the contracts had just been published with Sigima 1.3.0 and were not used yet. This one-off exception does not apply to later changes: from now on, the version of a contract is increased whenever a change of the computation changes its result, whatever the releases of the applications using Sigima, and calls recorded with an earlier version are refused instead of being replayed (see [Operation contracts and versions](../user_guide/contracts.rst)). The image profiles, changed afterwards (see below), are thus at version 2.
* **Image profiles in physical coordinates**: The line, segment, average and radial profiles of images are now defined and returned in the physical coordinates of the image, like regions of interest and analysis results, instead of pixel indices. Their parameters were renamed, so that scripts using the former names fail explicitly instead of silently using another meaning: `LineProfileParam.row`/`col` became `y`/`x` (the row or column whose pixel centers are the nearest), `SegmentProfileParam.row1`/`col1`/`row2`/`col2` and `AverageProfileParam.row1`/`col1`/`row2`/`col2` became `x1`/`y1`/`x2`/`y2` (for the average profile, `None` stands for the edge of the image instead of `-1`, and the pixels are those whose centers lie in the rectangle, like rectangular ROIs), and `RadialProfileParam.x0`/`y0` became `xc`/`yc`. The X axis of the profiles holds physical coordinates or distances, with the unit and label of the corresponding axis of the image. Segment and radial profiles are sampled in steps of the smallest distance between pixel centers, so that the radial profile is circular for anisotropic pixels and non-uniform coordinates; they are refused when the X and Y units of the image differ. Coordinates outside the image are refused instead of being clamped. On images without calibration (origin 0, pixel size 1), results are unchanged. The contracts of `line_profile`, `segment_profile`, `average_profile` and `radial_profile` are at version 2.

### 🛠️ Bug Fixes since version 1.3.0 ###

* **Image profiles**: The radial profile centered on the image center was computed around a wrong point on calibrated images (the physical center was used as pixel indices), and could even contain undefined values. Vertical profiles were labeled with the unit of the X axis instead of the Y axis, and all profiles with the unit of the image although their X axis was in pixels. Anti-diagonal segment profiles (e.g. from the top-right to the bottom-left corner) were extracted along the other diagonal.
* **Exact integer import**: Integer data that does not fit any integer type supported by the destination object (for example `uint32` counts above 2 147 483 647 in an image, or large integers in a signal) is now converted to a floating-point type that represents every value exactly. Such data was previously converted to `float32` when the source used 4-byte integers, which rounded counts above 16 777 216. A warning is now emitted when no supported floating-point type is exact (integers beyond 2⁵³).
* **Image resampling**: Resampling an image onto its own grid now gives back the same image. The output pixels were sampled half a pixel away from the requested positions, so that every value was shifted and the last row and column were filled with NaN, while the output origin claimed the requested position. The `xmin`/`xmax` and `ymin`/`ymax` parameters of `resampling` are now the coordinates of the centers of the first and last output pixels, like the `xmin`/`xmax` of an image, and default to the source grid. In pixel size mode, the requested pixel size is now kept exactly (the last pixel is the last one not beyond `xmax`/`ymax`).
* **Real and complex signals**: The sum, average, product and standard deviation of several signals, and their conversion into an image, no longer depend on the order of the signals: when a real signal came first, the imaginary parts of the complex signals were discarded.
Expand Down
14 changes: 14 additions & 0 deletions sigima/locale/fr/LC_MESSAGES/sigima.po
Original file line number Diff line number Diff line change
Expand Up @@ -1812,3 +1812,17 @@ msgstr "Barycentre"
msgid "Plot dialog"
msgstr "Fenêtre de tracé"

msgid "Y coordinate of the row (nearest pixel center)"
msgstr "Coordonnée Y de la ligne (centre de pixel le plus proche)"

msgid "X coordinate of the column (nearest pixel center)"
msgstr "Coordonnée X de la colonne (centre de pixel le plus proche)"

msgid "Start point"
msgstr "Point de départ"

msgid "End point"
msgstr "Point d'arrivée"

msgid "None: edge of the image"
msgstr "Aucune valeur : bord de l'image"
4 changes: 3 additions & 1 deletion sigima/params.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@
- :class:`Resampling2DParam`: Updates bounds based on signal range
- :class:`ResizeParam`: Updates bounds based on image dimensions
- :class:`TranslateParam`: Updates bounds based on image dimensions
- :class:`LineProfileParam`: Updates line coordinates based on image dimensions
- :class:`LineProfileParam`, :class:`SegmentProfileParam`,
:class:`RadialProfileParam`: Set profile coordinates inside the image (physical
units)
- :class:`BandPassFilterParam`, :class:`BandStopFilterParam`,
:class:`HighPassFilterParam`, :class:`LowPassFilterParam`: Update frequency bounds

Expand Down
Loading
Loading