Hi, thank you for maintaining NDStorage!
Sometimes when an acquisition fails it'll write out a 0-byte tif file in the dataset directory which causes the open from ndtiff_dataset to fail. Is there a way to skip 0 byte files for opening the NDTiff dataset?
One solution I've considered is instead of getting the tif files from the directory glob, could we use the index to get the files?
|
tiff_names = [ |
|
self.file_io.path_join(self.path, tiff) for tiff in self.file_io.listdir(self.path) if tiff.endswith(".tif") |
|
] |
|
self._readers_by_filename = {} |
|
self.summary_metadata = {} |
|
self.major_version, self.minor_version = (0, 0) |
|
# Count how many files need to be opened |
|
num_tiffs = 0 |
|
count = 0 |
|
for file in self.file_io.listdir(self.path): |
|
if file.endswith(".tif"): |
|
num_tiffs += 1 |
|
# populate list of readers and tree mapping indices to readers |
|
for tiff in tiff_names: |
|
print("\rOpening file {} of {}...".format(count + 1, num_tiffs), end="") |
|
count += 1 |
|
new_reader = SingleNDTiffReader(tiff, file_io=self.file_io) |
|
self._readers_by_filename[tiff.split(os.sep)[-1]] = new_reader |
|
# Should be the same on every file so resetting them is fine |
|
self.major_version, self.minor_version = new_reader.major_version, new_reader.minor_version |
Happy to implement a pull request as well.
Hi, thank you for maintaining NDStorage!
Sometimes when an acquisition fails it'll write out a 0-byte
tiffile in the dataset directory which causes the open fromndtiff_datasetto fail. Is there a way to skip 0 byte files for opening the NDTiff dataset?One solution I've considered is instead of getting the
tiffiles from the directory glob, could we use the index to get the files?NDStorage/python/ndstorage/ndtiff_dataset.py
Lines 82 to 101 in b2b8383
Happy to implement a pull request as well.