def test_2d_along_t(self): data = numpy.random.randint(0, 255, (20, 100, 200, 3)).astype(numpy.uint8) expected_axistags = vigra.AxisTags([ vigra.AxisInfo("t", typeFlags=vigra.AxisType.Time), vigra.AxisInfo("y", typeFlags=vigra.AxisType.Space), vigra.AxisInfo("x", typeFlags=vigra.AxisType.Space), vigra.AxisInfo("c", typeFlags=vigra.AxisType.Channels), ]) with tempdir() as d: tiff_path = d + "/test-2d-{slice_index:02d}.tiff" tiff_glob_path = d + "/test-2d-*.tiff" for slice_index, t_slice in enumerate(data): vigra.impex.writeImage( vigra.taggedView(t_slice, "yxc"), tiff_path.format(slice_index=slice_index), dtype="NATIVE", mode="w", ) op = OpTiffSequenceReader(graph=Graph()) op.SequenceAxis.setValue("t") op.GlobString.setValue(tiff_glob_path) assert op.Output.ready() assert op.Output.meta.axistags == expected_axistags assert (op.Output[5:10, 50:100, 100:150].wait() == data[5:10, 50:100, 100:150]).all()
def _attemptOpenAsTiffStack(self, filePath): if not ('*' in filePath or os.path.pathsep in filePath): return ([], None) try: opReader = OpTiffSequenceReader(parent=self) opReader.SequenceAxis.connect(self.SequenceAxis) opReader.GlobString.setValue(filePath) return ([opReader], opReader.Output) except OpTiffSequenceReader.WrongFileTypeError as ex: return ([], None)