@property<EOL><INDENT>def segments(self):<DEDENT>
segments = dict()<EOL>for i in range(len(self)):<EOL><INDENT>image = self[i]<EOL>for z, contour in image.as_segments.items():<EOL><INDENT>for byte_value, contour_set in contour.items():<EOL><INDENT>if byte_value not in segments:<EOL><INDENT>segments[byte_value] = dict()<EOL><DEDENT>if z not in segments[byte_value]:<EOL><INDENT>segments[byte_value][z] = contour_set<EOL><DEDENT>else:<EOL><INDENT>segments[byte_value][z] += contour_set                <EOL><DEDENT><DEDENT><DEDENT><DEDENT>return segments<EOL>
A dictionary of lists of contours keyed by z-index