def get_frame(self, j):
        # PIL does not support random access. If we need to rewind, re-open
        # the file.
        if j < self.cur:
            self.im = Image.open(self._filename)
            self.im.seek(j)
        elif j > self.cur:
            self.im.seek(j)
        elif j > len(self):
            raise IndexError("out of bounds; length is {0}".format(len(self)))
        # If j == self.cur, do nothing.
        self.cur = self.im.tell()
        res = np.reshape(self.im.getdata(),
                         self._im_sz).astype(self._dtype)
        return Frame(self.process_func(res), frame_no=j,
                     metadata=self._read_metadata())
Extracts the jth frame from the image sequence.
dataset/ETHPy150Open soft-matter/pims/pims/tiff_stack.py/TiffStack_pil.get_frame