Return image series in OME-TIFF files.

def _omeseries(self):
        """Return image series in OME-TIFF files."""
        root = ElementTree.XML(self.pages[0].tags['image_description'].value)
        uuid = root.attrib.get('UUID', None)
        self._tiffs = {uuid: self}
        modulo = {}
        result = []
        for element in root:
            if element.tag.endswith('BinaryOnly'):
                warnings.warn("not an OME-TIFF master file")
                break
            if element.tag.endswith('StructuredAnnotations'):
                for annot in element:
                    if not annot.attrib.get('Namespace',
                                            '').endswith('modulo'):
                        continue
                    for value in annot:
                        for modul in value:
                            for along in modul:
                                if not along.tag[:-1].endswith('Along'):
                                    continue
                                axis = along.tag[-1]
                                newaxis = along.attrib.get('Type', 'other')
                                newaxis = AXES_LABELS[newaxis]
                                if 'Start' in along.attrib:
                                    labels = range(
                                        int(along.attrib['Start']),
                                        int(along.attrib['End']) + 1,
                                        int(along.attrib.get('Step', 1)))
                                else:
                                    labels = [label.text for label in along
                                              if label.tag.endswith('Label')]
                                modulo[axis] = (newaxis, labels)
            if not element.tag.endswith('Image'):
                continue
            for pixels in element:
                if not pixels.tag.endswith('Pixels'):
                    continue
                atr = pixels.attrib
                axes = "".join(reversed(atr['DimensionOrder']))
                shape = list(int(atr['Size'+ax]) for ax in axes)
                size = numpy.prod(shape[:-2])
                ifds = [None] * size
                for data in pixels:
                    if not data.tag.endswith('TiffData'):
                        continue
                    atr = data.attrib
                    ifd = int(atr.get('IFD', 0))
                    num = int(atr.get('NumPlanes', 1 if 'IFD' in atr else 0))
                    num = int(atr.get('PlaneCount', num))
                    idx = [int(atr.get('First'+ax, 0)) for ax in axes[:-2]]
                    idx = numpy.ravel_multi_index(idx, shape[:-2])
                    for uuid in data:
                        if uuid.tag.endswith('UUID'):
                            if uuid.text not in self._tiffs:
                                fn = uuid.attrib['FileName']
                                try:
                                    tf = TIFFfile(os.path.join(self.fpath, fn))
                                except (IOError, ValueError):
                                    warnings.warn("failed to read %s" % fn)
                                    break
                                self._tiffs[uuid.text] = tf
                            pages = self._tiffs[uuid.text].pages
                            try:
                                for i in range(num if num else len(pages)):
                                    ifds[idx + i] = pages[ifd + i]
                            except IndexError:
                                warnings.warn("ome-xml: index out of range")
                            break
                    else:
                        pages = self.pages
                        try:
                            for i in range(num if num else len(pages)):
                                ifds[idx + i] = pages[ifd + i]
                        except IndexError:
                            warnings.warn("ome-xml: index out of range")
                result.append(Record(axes=axes, shape=shape, pages=ifds,
                                     dtype=numpy.dtype(ifds[0].dtype)))

        for record in result:
            for axis, (newaxis, labels) in modulo.items():
                i = record.axes.index(axis)
                size = len(labels)
                if record.shape[i] == size:
                    record.axes = record.axes.replace(axis, newaxis, 1)
                else:
                    record.shape[i] //= size
                    record.shape.insert(i+1, size)
                    record.axes = record.axes.replace(axis, axis+newaxis, 1)

        return result