Skip to content

Commit e7ce1fb

Browse files
committed
Image segment profile: fix point coordinates inversion
Fix #88
1 parent c055877 commit e7ce1fb

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ See DataLab [roadmap page](https://datalab-platform.com/en/contributing/roadmap.
1515
* Thanks again to [@rolandmas](https://github.com/rolandmas) for reporting the issue in the context of the Debian packaging
1616
* Fixed [Issue #86](https://github.com/DataLab-Platform/DataLab/issues/86) - Average of N integer images overflows data type
1717
* Fixed [Issue #87](https://github.com/DataLab-Platform/DataLab/issues/87) - Image average profile extraction: `AttributeError` when trying to edit profile parameters
18+
* Fixed [Issue #88](https://github.com/DataLab-Platform/DataLab/issues/88) - Image segment profile: point coordinates inversion
1819

1920
## DataLab Version 0.16.2 ##
2021

cdl/core/gui/profiledialog.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -203,13 +203,19 @@ def shape_to_param(self) -> None:
203203
elif isinstance(self.shape, AnnotatedSegment):
204204
assert isinstance(p, cdl.param.SegmentProfileParam)
205205
x1, y1, x2, y2 = self.shape.get_rect()
206-
p.row1, p.row2 = sorted([int(np.round(y1)), int(np.round(y2))])
207-
p.col1, p.col2 = sorted([int(np.round(x1)), int(np.round(x2))])
206+
p.row1, p.row2 = int(np.round(y1)), int(np.round(y2))
207+
p.col1, p.col2 = int(np.round(x1)), int(np.round(x2))
208+
if p.col1 > p.col2:
209+
p.col1, p.col2 = p.col2, p.col1
210+
p.row1, p.row2 = p.row2, p.row1
208211
else:
209212
assert isinstance(p, cdl.param.AverageProfileParam)
210213
x1, y1, x2, y2 = self.shape.get_rect()
211-
p.row1, p.row2 = sorted([int(np.round(y1)), int(np.round(y2))])
212-
p.col1, p.col2 = sorted([int(np.round(x1)), int(np.round(x2))])
214+
p.row1, p.row2 = int(np.round(y1)), int(np.round(y2))
215+
p.col1, p.col2 = int(np.round(x1)), int(np.round(x2))
216+
if p.col1 > p.col2:
217+
p.col1, p.col2 = p.col2, p.col1
218+
p.row1, p.row2 = p.row2, p.row1
213219

214220
def param_to_shape(self) -> None:
215221
"""Param to shape"""

0 commit comments

Comments
 (0)