Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add minisblack photometric to tiff writing #46

Merged
merged 2 commits into from
Mar 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions brainglobe_utils/image_io/save.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def to_nii(img, dest_path, scale=None, affine_transform=None):
nib.save(img, dest_path)


def to_tiff(img_volume, dest_path):
def to_tiff(img_volume, dest_path, photometric="minisblack"):
"""
Save the image volume (numpy array) to a tiff stack.

Expand All @@ -51,9 +51,13 @@ def to_tiff(img_volume, dest_path):

dest_path : str
Where to save the tiff stack.

photometric: str
Color space of image (to pass to tifffile.imwrite)
Use 'minisblack' (default) for grayscale and 'rgb' for rgb
"""
dest_path = str(dest_path)
tifffile.imwrite(dest_path, img_volume)
tifffile.imwrite(dest_path, img_volume, photometric=photometric)


def to_tiffs(img_volume, path_prefix, path_suffix="", extension=".tif"):
Expand Down
Loading