def _slice(self, view): """ Extract a view from the 2D subset mask. """ # Combining multiple views: First a 2D slice into an ND array, then # the requested view from this slice if self.transpose: views = [self.view, 'transpose', view] else: views = [self.view, view] view = stack_view(self.subset.data.shape, *views) mask = self.subset.to_mask(view) return self._rgb_from_mask(mask)
def _slice(self, view): """ Extract a view from the 2D image. """ if self.override_image is not None: return self.override_image[view] # Combining multiple views: First a 2D slice into an ND array, then # the requested view from this slice if self.transpose: views = [self.view, 'transpose', view] else: views = [self.view, view] view = stack_view(self.data.shape, *views) return self.data[self.component, view]