Skip to content

Commit b069915

Browse files
committed
Fixes #8: image ROI extraction now supports pixel size
1 parent 8c7cbc7 commit b069915

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

CHANGELOG.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,13 @@ for future and past milestones.
99

1010
* Region of interest (ROI) extraction feature for images:
1111
* ROI extraction was not working properly when the "Extract all regions of interest
12-
into a single image object" option was enabled if there was only one defined ROI
13-
* The result was an image positioned at the origin (0, 0) instead of the expected
14-
position (x0, y0) and the ROI rectangle itself was not removed as expected
15-
* [Issue #6](https://github.com/Codra-Ingenierie-Informatique/DataLab/issues/6) - 'Extract multiple ROI' feature: unexpected result for a single ROI
12+
into a single image object" option was enabled if there was only one defined ROI.
13+
The result was an image positioned at the origin (0, 0) instead of the expected
14+
position (x0, y0) and the ROI rectangle itself was not removed as expected.
15+
This is now fixed (see [Issue #6](https://github.com/Codra-Ingenierie-Informatique/DataLab/issues/6) - 'Extract multiple ROI' feature: unexpected result for a single ROI)
16+
* ROI extraction was not taking into account the pixel size (dx, dy) and the origin
17+
(x0, y0) of the image.
18+
This is now fixed (see [Issue #8](https://github.com/Codra-Ingenierie-Informatique/DataLab/issues/8) - Image ROI extraction: take into account pixel size)
1619
* Macro-command console is now read-only:
1720
* The macro-command panel Python console is currently not supporting standard input
1821
stream (`stdin`) and this is intended (at least for now)

cdl/core/computation/image/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -536,8 +536,8 @@ def extract_multiple_roi(src: ImageObj, group: gds.DataSetGroup) -> ImageObj:
536536
p = group.datasets[0]
537537
suffix = p.get_suffix()
538538
dst = dst_11(src, "extract_multiple_roi", suffix)
539-
dst.x0 += x0
540-
dst.y0 += y0
539+
dst.x0 += x0 * src.dx
540+
dst.y0 += y0 * src.dy
541541
dst.roi = None
542542
if len(group.datasets) == 1:
543543
p = group.datasets[0]
@@ -561,8 +561,8 @@ def extract_single_roi(src: ImageObj, p: gds.DataSet) -> ImageObj:
561561
"""
562562
dst = dst_11(src, "extract_single_roi", p.get_suffix())
563563
dst.data = src.data.copy()[p.y0 : p.y1, p.x0 : p.x1]
564-
dst.x0 += p.x0
565-
dst.y0 += p.y0
564+
dst.x0 += p.x0 * src.dx
565+
dst.y0 += p.y0 * src.dy
566566
dst.roi = None
567567
if p.geometry is RoiDataGeometries.CIRCLE:
568568
# Circular ROI

0 commit comments

Comments
 (0)