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

This seems to be an orphaned fragment of something else

parent 83f63a7f
No related branches found
No related tags found
No related merge requests found
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