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

Removed trivial diffs from chaeo_extension

parent d09fe9c9
No related branches found
No related tags found
No related merge requests found
......@@ -34,8 +34,6 @@ class GenericImageDataAccessor(ABC):
def is_3d(self):
return True if self.shape_dict['Z'] > 1 else False
# TODO: implement is_probability
def is_mask(self):
return is_mask(self._data)
......@@ -117,6 +115,10 @@ class TifSingleSeriesFileAccessor(GenericImageFileAccessor):
axs.append('C')
da = np.expand_dims(da, len(da.shape))
if 'Z' not in axs:
axs.append('Z')
da = np.expand_dims(da, len(da.shape))
yxcz = np.moveaxis(
da,
[axs.index(k) for k in order],
......
def get_tif_seq(where, prefix=None, verbose=True):
files = [ff for ff in os.listdir(where) if ff.startswith(prefix)]
files.sort()
paths = [where / fn for fn in files]
ndas = [imread(pa.__str__()) for pa in paths]
assert all([n.shape == ndas[0].shape and n.dtype == ndas[0].dtype for n in ndas])
if verbose:
print(f'Successfully read {len(ndas)} x {ndas[0].shape} px images of type {ndas[0].dtype} from:\n{where}')
return ndas
def write_tif_zstack(data, desc, dtype='uint16', subdir='output'):
where = root / subdir
filename = desc + '.tif'
if not os.path.exists(where):
os.makedirs(where)
abspath = where / filename
imwrite(
abspath,
np.array(data).astype(dtype),
imagej=True
)
print(f'Successfully wrote {len(data)} x {data[0].shape} px images of type {dtype} to:\n{abspath}')
\ No newline at end of file
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