DataLab icon indicating copy to clipboard operation
DataLab copied to clipboard

ROIs: change the internal data model

Open PierreRaybaut opened this issue 1 year ago • 0 comments

Currently, the ROI data model is simplistic:

  • It stores all the ROI associated to a signal or an image in an integer NumPy array
  • For images, N rectangular and circular ROIs are serialized in a N x 4 array:
    • Each line of the array are coordinates: x0, y0, x1, y1
    • For rectangular ROIs, each line of the array simply contains the top-left (x0,y0) and bottom-right (x1,y1) coordinates
    • For circular ROIs, the four coordinates are the X-diameter coordinates (y0=y1)

The idea of this Issue would be to modify this model in order to be able to store:

  • Polygon ROIs (for images)
  • A parameter for each ROI: inside (current behavior) or outside - meaning that the ROI is inside or outside the defined area

The new internal data model could be a dictionary:

  • for signals:
    • keys: "segment" (the only key...)
    • value associated to "segment" would be a dictionary with the following keys:
      • "coords" (the NumPy array, identical to current roidata attribute)
      • "inside" (a 1D boolean NumPy array)
  • for images:
    • keys: "rectangle", "circle" (in the near future: "polygon")
    • values associated to each key:
      • "coords" (the NumPy array, identical to current roidata attribute)
      • "inside" (a 1D boolean NumPy array)

PierreRaybaut avatar Jul 29 '24 08:07 PierreRaybaut