title: passing an array as an index to another array?
body: <p>alright so I'm writing some code used for image processing and most of it is converted from some old matlab code for the same process. At the point I'm at now(the final step in the process) I need to pass an array as an index to another array. </p>
  
  <p>a bit of background: I'm separating the images in to RGB bands or mask. earlier in the code I took all the images(as numpy arrays) and took a median along along the 3rd dimension. I'm trying to pass the RGB mask as arguments so I can get the median along those pixel values, and have 0's in place of the RB pixels.</p>
  
  <p>The code in Matlab to do this is pretty straightforward:</p>
  
  <pre><code>finalMedGreen_ROI(exp_i+1) = median(median(EXPMedian_ROI(GMask_ROI)));
  </code></pre>
  
  <p>where GMask_ROI is an array that is a region of interest of the raw image data, and EXPMedian_ROI is the Median of all the raw image data).</p>
  
  <p>I tried to replicate this in python:</p>
  
  <pre><code>self.final_median_green_roi[image+1] = np.median(np.median(self.exposure_median_roi(self.green_mask_roi)))
  </code></pre>
  
  <p>and I got this error:</p>
  
  <pre><code>TypeError: 'numpy.ndarray' object is not callable
  </code></pre>
  
  <p>I tried to simply pass both arrays as arguments in np.median. here's the thing, self.green_mask_roi is an array of boolean values(true for green pixels, false for everything else. when I ran this:</p>
  
  <pre><code>self.final_median_green_roi[0,1] = np.median(np.median(self.dark_median_roi,self.green_mask_roi))
  </code></pre>
  
  <p>I got this error:</p>
  
  <pre><code>ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
  </code></pre>
  
  <p>I'm not sure if it's suggesting those for the boolean array or the numeric median array and I'd rather get it right simply for the fact that I'm new to image processing and I'm unlikely to catch the mistake. any suggestions?</p>