title: How to split multiple masks from a numpy array in single line?
body: <p>I have a <code>500,500,3</code> shaped numpy array containing repetitive integer values. I can use <code>np.unique</code> to get unique integer values present in the said array (because they can be different for every such array).</p>
  
  <p>Is there any way to split multiple masks in one line.</p>
  
  <hr>
  
  <blockquote>
    <p>Here <strong>masks</strong> is a numpy array. It contains different repetitive integer values</p>
  </blockquote>
  
  <pre><code> ids = np.unique(masks) # ids = [0, 1, 2] for example
   # currently doing this
   mask0 = masks == ids[0]
   mask1 = masks == ids[1]
   mask2 = masks == ids[2]
  </code></pre>
  
  <p>Is there any single line method to get a set of all binary masks. For example something like.</p>
  
  <pre><code> all_masks = masks == ids[:] # for example
  </code></pre>