Repository: silx-kit/silx
Issue: Assertion while playing with ProfileImageLineROI

While working on a profile for the CompareImage plot, i found that the coords/profile returned by `ProfileImageLineROI` can mismatch by 1.

This could be due to my setup and changes. But this also could be due to other stuffs.

```
Traceback (most recent call last):
  File "/nobackup/lvalls1/valls/workspace/silx.git/build/lib.linux-x86_64-3.7/silx/gui/plot/tools/profile/manager.py", line 892, in __displayResult
    window.setProfile(lastData)
  File "/nobackup/lvalls1/valls/workspace/silx.git/build/lib.linux-x86_64-3.7/silx/gui/plot/tools/profile/manager.py", line 348, in setProfile
    self._setRgbaProfile(data)
  File "/nobackup/lvalls1/valls/workspace/silx.git/build/lib.linux-x86_64-3.7/silx/gui/plot/tools/profile/manager.py", line 314, in _setRgbaProfile
    legend="green", color="green")
  File "/nobackup/lvalls1/valls/workspace/silx.git/build/lib.linux-x86_64-3.7/silx/gui/plot/PlotWidget.py", line 1209, in addCurve
    curve.setData(x, y, xerror, yerror, baseline=baseline, copy=copy)
  File "/nobackup/lvalls1/valls/workspace/silx.git/build/lib.linux-x86_64-3.7/silx/gui/plot/items/curve.py", line 292, in setData
    copy=copy)
  File "/nobackup/lvalls1/valls/workspace/silx.git/build/lib.linux-x86_64-3.7/silx/gui/plot/items/core.py", line 1629, in setData
    assert len(x) == len(y)
AssertionError
```

Printing the coords and profile shape returned me:
```
(378,) (378,)
(379,) (378,)
(379,) (378,)
```

Changed files:
src/silx/gui/plot/tools/profile/rois.py

diff --git a/src/silx/gui/plot/tools/profile/rois.py b/src/silx/gui/plot/tools/profile/rois.py
index 276983d53..14fc74699 100644
--- a/src/silx/gui/plot/tools/profile/rois.py
+++ b/src/silx/gui/plot/tools/profile/rois.py
@@ -294,10 +294,11 @@ class _DefaultImageProfileRoiMixIn(core.ProfileRoiMixIn):
         scale = item.getScale()
         method = self.getProfileMethod()
         lineWidth = self.getProfileLineWidth()
+        roiInfo = self._getRoiInfo()
 
         def createProfile2(currentData):
             coords, profile, _area, profileName, xLabel = core.createProfile(
-                roiInfo=self._getRoiInfo(),
+                roiInfo=roiInfo,
                 currentData=currentData,
                 origin=origin,
                 scale=scale,
@@ -1072,9 +1073,16 @@ class _DefaultImageStackProfileRoiMixIn(_DefaultImageProfileRoiMixIn):
 
         assert kind == "2D"
 
+        currentData = numpy.array(item.getStackData(copy=False))
+        origin = item.getOrigin()
+        scale = item.getScale()
+        colormap = item.getColormap()
+        method = self.getProfileMethod()
+        roiInfo = self._getRoiInfo()
+
         def createProfile2(currentData):
             coords, profile, _area, profileName, xLabel = core.createProfile(
-                roiInfo=self._getRoiInfo(),
+                roiInfo=roiInfo,
                 currentData=currentData,
                 origin=origin,
                 scale=scale,
@@ -1082,12 +1090,6 @@ class _DefaultImageStackProfileRoiMixIn(_DefaultImageProfileRoiMixIn):
                 method=method)
             return coords, profile, profileName, xLabel
 
-        currentData = numpy.array(item.getStackData(copy=False))
-        origin = item.getOrigin()
-        scale = item.getScale()
-        colormap = item.getColormap()
-        method = self.getProfileMethod()
-
         coords, profile, profileName, xLabel = createProfile2(currentData)
 
         profileManager = self.getProfileManager()