Skip to content

Commit

Permalink
Image segment profile: fix point coordinates inversion
Browse files Browse the repository at this point in the history
Fix #88
  • Loading branch information
PierreRaybaut committed Jul 3, 2024
1 parent c055877 commit e7ce1fb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ See DataLab [roadmap page](https://datalab-platform.com/en/contributing/roadmap.
* Thanks again to [@rolandmas](https://github.com/rolandmas) for reporting the issue in the context of the Debian packaging
* Fixed [Issue #86](https://github.com/DataLab-Platform/DataLab/issues/86) - Average of N integer images overflows data type
* Fixed [Issue #87](https://github.com/DataLab-Platform/DataLab/issues/87) - Image average profile extraction: `AttributeError` when trying to edit profile parameters
* Fixed [Issue #88](https://github.com/DataLab-Platform/DataLab/issues/88) - Image segment profile: point coordinates inversion

## DataLab Version 0.16.2 ##

Expand Down
14 changes: 10 additions & 4 deletions cdl/core/gui/profiledialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,13 +203,19 @@ def shape_to_param(self) -> None:
elif isinstance(self.shape, AnnotatedSegment):
assert isinstance(p, cdl.param.SegmentProfileParam)
x1, y1, x2, y2 = self.shape.get_rect()
p.row1, p.row2 = sorted([int(np.round(y1)), int(np.round(y2))])
p.col1, p.col2 = sorted([int(np.round(x1)), int(np.round(x2))])
p.row1, p.row2 = int(np.round(y1)), int(np.round(y2))
p.col1, p.col2 = int(np.round(x1)), int(np.round(x2))
if p.col1 > p.col2:
p.col1, p.col2 = p.col2, p.col1
p.row1, p.row2 = p.row2, p.row1
else:
assert isinstance(p, cdl.param.AverageProfileParam)
x1, y1, x2, y2 = self.shape.get_rect()
p.row1, p.row2 = sorted([int(np.round(y1)), int(np.round(y2))])
p.col1, p.col2 = sorted([int(np.round(x1)), int(np.round(x2))])
p.row1, p.row2 = int(np.round(y1)), int(np.round(y2))
p.col1, p.col2 = int(np.round(x1)), int(np.round(x2))
if p.col1 > p.col2:
p.col1, p.col2 = p.col2, p.col1
p.row1, p.row2 = p.row2, p.row1

def param_to_shape(self) -> None:
"""Param to shape"""
Expand Down

0 comments on commit e7ce1fb

Please sign in to comment.