Skip to content
Snippets Groups Projects
Commit a251cab0 authored by Christopher Randolph Rhodes's avatar Christopher Randolph Rhodes
Browse files

Basic support for bool data

parent 647683b8
No related branches found
No related tags found
No related merge requests found
......@@ -32,6 +32,9 @@ class GenericImageDataAccessor(ABC):
def is_3d(self):
return True if self.shape_dict['Z'] > 1 else False
def is_mask(self):
return self._data.dtype == 'bool'
def get_one_channel_data (self, channel: int):
c = int(channel)
return InMemoryDataAccessor(self.data[:, :, c:(c+1), :])
......@@ -133,7 +136,10 @@ def write_accessor_data_to_file(fpath: Path, accessor: GenericImageDataAccessor)
[3, 2, 0, 1],
[0, 1, 2, 3]
)
tifffile.imwrite(fpath, zcyx, imagej=True)
if accessor.is_mask():
tifffile.imwrite(fpath, zcyx.astype('uint8'), imagej=True)
else:
tifffile.imwrite(fpath, zcyx, imagej=True)
except:
raise FileWriteError(f'Unable to write data to file')
return True
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment