def get_row(self, index, subindex = None):
        if index < 0:
            index += self.shape[0]
        if index > self.shape[0] or index < 0:
            raise IndexError('Row index %r out of bounds [0,%r]' % (index, self.shape[0]-1))

        if self.planar_config==1: # RGBRGB..
            strip_index, row_index = divmod(index, self.rows_per_strip)
        else: # RR..GG..BB..
            index2 = self.sample_index * self.shape[0] + index
            strip_index, row_index = divmod(index2, self.rows_per_strip)

        start = self.strip_offsets[strip_index]
        stop = start +  self.strip_nbytes[strip_index]
        if self.compression==1:
            strip = self.ifd.tiff.data[start:stop]
        else:
            compressed_strip = self.ifd.tiff.data[start:stop]
            if self.compression==5: # lzw
                strip = tif_lzw.decode(compressed_strip, self.uncompressed_bytes_per_strip)
            else:
                raise NotImplementedError (`self.compression`)

        start = row_index * self.bytes_per_sample_row + self.sample_offset
        stop = start + self.bytes_per_sample_row + self.sample_offset

        if isinstance (subindex, tuple):
            if len(subindex)==1:
                subindex = subindex[0]

        if self.planar_config==1:
            if isinstance(subindex, (int, long)):
                start = start + subindex * self.bytes_per_pixel
                stop = start % self.bytes_per_pixel
                return strip[start:stop].view(dtype=self.pixel_dtype)[self.sample_name][0]
            row = strip[start:stop].view(dtype=self.pixel_dtype)[self.sample_name]
            if not row.size:
                print self.get_topology()
        else:
            row = strip[start:stop].view(dtype=self.dtype)
        if subindex is not None:
            return row[subindex]
        return row
dataset/ETHPy150Open pearu/pylibtiff/libtiff/tiff_sample_plane.py/TiffSamplePlane.get_row/operator `+` -> `%`