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

feat(imaging): write bigtiff for caiman processing for bruker files #178

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
35 changes: 21 additions & 14 deletions element_calcium_imaging/imaging_no_curation.py
Original file line number Diff line number Diff line change
Expand Up @@ -464,28 +464,35 @@ def make(self, key):
channel = caiman_params.get("channel_to_process", 0)

if ndepths == 1: # single-plane processing
if nchannels > 1:
if acq_software == "ScanImage":
if acq_software == "ScanImage":
if nchannels > 1:
# handle multi-channel tiff image before running CaImAn
tmp_dir = pathlib.Path(output_dir) / "channel_separated_tif"
tmp_dir.mkdir(exist_ok=True)
_process_scanimage_tiff(
[f.as_posix() for f in image_files], output_dir=tmp_dir
)
image_files = tmp_dir.glob(f"*_chn{channel}.tif")
elif acq_software == "PrairieView":
from element_interface.prairie_view_loader import (
PrairieViewMeta,
)
elif acq_software == "PrairieView":
from element_interface.prairie_view_loader import (
PrairieViewMeta,
)

pv_dir = pathlib.Path(image_files[0]).parent
PVmeta = PrairieViewMeta(pv_dir)
image_files = [
pv_dir / f
for f in PVmeta.get_prairieview_files(
channel=caiman_params.get("channel_to_process", 0),
)
]
pv_dir = pathlib.Path(image_files[0]).parent
PVmeta = PrairieViewMeta(pv_dir)
channel = (
channel
if PVmeta.meta["num_channels"] > 1
else PVmeta.meta["channels"][0]
)
image_files = [
PVmeta.write_single_bigtiff(
plane_idx=0,
channel=channel,
output_dir=output_dir,
caiman_compatible=True,
)
]

run_caiman(
file_paths=[f.as_posix() for f in image_files],
Expand Down
Loading