def _h5N5FindCommonInternal(h5N5Files): """ Tries to find common internal path (containing data) Method is used, when a directory is selected and the internal path is, thus, unclear. Args: h5Files or hń5Files (list of strings): h5 or n5 files to be globbed internally Returns: list of internal paths """ h5 = OpStreamingH5N5Reader.get_h5_n5_file(h5N5Files[0], mode='r') internal_paths = set([x['name'] for x in lsH5N5(h5, minShape=2)]) h5.close() for h5N5File in h5N5Files[1::]: h5 = OpStreamingH5N5Reader.get_h5_n5_file(h5N5File, 'r') # get all files with with at least 2D shape tmp = set([x['name'] for x in lsH5N5(h5, minShape=2)]) internal_paths = internal_paths.intersection(tmp) return list(internal_paths)
def _findInternalStacks(h5N5File): """ Tries to find common internal path (containing data) Method is used, when a directory is selected and the internal path is, thus, unclear. Args: h5file or n5file (list of strings): h5 or n5 files to be globbed internally Returns: list of internal stacks """ pathComponents = PathComponents(h5N5File) if pathComponents.extension in (OpStreamingH5N5SequenceReaderM.H5EXTS + OpStreamingH5N5SequenceReaderM.N5EXTS): # get all internal paths with OpStreamingH5N5Reader.get_h5_n5_file(h5N5File, mode='r') as h5: internal_paths = lsH5N5(h5, minShape=2) return [x['name'] for x in internal_paths]