title: Create mask from ROI
body: <p>My target is to make a mask from .roi files. What I currently have is a .roi file (read with <code>read_roi_file</code> with a list of coordinates for each corner:</p>
  <pre><code>x = roi2['85']['x'] = [94, 95, 96, 97, 98, 99, 100, 101, 101, 102, 103, 104, 105, 106, 106, 107, 108, 108, 109, 110, 111, 111, 112, 112, 112, 111, 110, 109, 108, 108, 107, 106, 105, 105, 104, 104, 104, 103, 102, 101, 100, 99, 99, 99, 99, 98, 98, 98, 99, 99, 100, 100, 101, 101, 102, 103, 103, 104, 105, 105, 106, 107, 107, 108, 109, 109, 109, 109, 109, 109, 108, 107, 107, 106, 105, 105, 105, 106, 107, 108, 109, 110, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 119, 120, 120, 119, 118, 117, 116, 115, 114, 113, 112, 112, 112, 111, 111, 110, 110, 109, 109, 109, 109, 110, 110, 110, 111, 111, 111, 112, 112, 113, 113, 114, 114, 115, 115, 116, 116, 116, 117, 117, 118, 118, 117, 117, 116, 115, 114, 113, 112, 112, 111, 110, 109, 108, 107, 106, 105, 104, 103, 102, 101, 100, 99, 99, 98, 97, 96, 95]
  y = roi2['85']['y'] = [51, 51, 51, 51, 51, 51, 51, 51, 50, 50, 50, 50, 50, 50, 51, 51, 51, 52, 52, 52, 52, 53, 53, 54, 55, 55, 55, 55, 55, 54, 53, 53, 53, 54, 54, 55, 56, 56, 56, 56, 56, 56, 57, 58, 59, 59, 60, 61, 61, 62, 62, 63, 63, 64, 64, 64, 65, 65, 65, 66, 66, 66, 67, 67, 67, 68, 69, 70, 71, 72, 72, 72, 73, 73, 73, 74, 75, 75, 75, 75, 75, 75, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 73, 73, 72, 72, 72, 72, 72, 72, 71, 71, 71, 70, 69, 69, 68, 67, 66, 66, 65, 64, 63, 63, 62, 61, 61, 60, 59, 59, 58, 58, 57, 57, 56, 56, 55, 55, 54, 53, 53, 52, 52, 51, 51, 50, 50, 50, 50, 50, 50, 49, 49, 49, 49, 49, 49, 48, 48, 48, 48, 48, 48, 48, 48, 49, 49, 49, 49, 49]
  </code></pre>
  <p>For example point 1 has coordinates <code>x1 = (x[0], y[0])</code> - that doesn't look pretty, but works. I've already made a matrix in the shape of original image filled with 0 and ROI points set to 1:</p>
  <pre><code>import numpy as np
  zer = np.zeros((162, 162), dtype=int)
  for i in range (len(roi2['85']['x'])):
      x = roi2['85']['x'][i]
      y = roi2['85']['y'][i]
      zer[x][y] = 1
  </code></pre>
  <p>My problem is, whether I should swap each 0 inside ROI to 1 (each element inside ROI has &quot;1&quot; on the top, bottom, left and right) or there is any library to help me with that. My solution however has a weak spot, when there will be ROI looking for example like a ring - then all zeros inside ring will be swapped to ones even if they aren't inside my ROI.
  I've read that OpenCV might be helpful but I'm not familiar with this topic, that's why I'm looking for help.</p>