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

bugfix in infer_output_dir #164

Merged
merged 5 commits into from
Feb 1, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
6 changes: 1 addition & 5 deletions element_calcium_imaging/imaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,13 +254,9 @@ def infer_output_dir(cls, key, relative=False, mkdir=False):
e.g.: sub4/sess1/scan0/suite2p_0
"""
acq_software = (scan.Scan & key).fetch1("acq_software")
filetypes = dict(
ScanImage="*.tif", Scanbox="*.sbx", NIS="*.nd2", PrairieView="*.tif"
)

scan_dir = find_full_path(
get_imaging_root_data_dir(),
get_calcium_imaging_files(key, filetypes[acq_software])[0],
get_calcium_imaging_files(key, acq_software)[0],
).parent
root_dir = find_root_directory(get_imaging_root_data_dir(), scan_dir)

Expand Down
11 changes: 4 additions & 7 deletions element_calcium_imaging/imaging_no_curation.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,13 +254,9 @@ def infer_output_dir(cls, key, relative=False, mkdir=False):
e.g.: sub4/sess1/scan0/suite2p_0
"""
acq_software = (scan.Scan & key).fetch1("acq_software")
filetypes = dict(
ScanImage="*.tif", Scanbox="*.sbx", NIS="*.nd2", PrairieView="*.tif"
)

scan_dir = find_full_path(
get_imaging_root_data_dir(),
get_calcium_imaging_files(key, filetypes[acq_software])[0],
get_calcium_imaging_files(key, acq_software)[0],
).parent
root_dir = find_root_directory(get_imaging_root_data_dir(), scan_dir)

Expand Down Expand Up @@ -369,6 +365,7 @@ def make(self, key):
task_mode, output_dir = (ProcessingTask & key).fetch1(
"task_mode", "processing_output_dir"
)
acq_software = (scan.Scan & key).fetch1("acq_software")

if not output_dir:
output_dir = ProcessingTask.infer_output_dir(key, relative=True, mkdir=True)
Expand Down Expand Up @@ -452,8 +449,8 @@ def make(self, key):
"Caiman pipeline is not yet capable of analyzing 3D scans."
)

# handle multi-channel tiff image before running CaImAn
if nchannels > 1:
if acq_software == "ScanImage" and nchannels > 1:
# handle multi-channel tiff image before running CaImAn
channel_idx = caiman_params.get("channel_to_process", 0)
tmp_dir = pathlib.Path(output_dir) / "channel_separated_tif"
tmp_dir.mkdir(exist_ok=True)
Expand Down
6 changes: 1 addition & 5 deletions element_calcium_imaging/imaging_preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,13 +444,9 @@ def infer_output_dir(cls, key, relative=False, mkdir=False):
e.g.: sub4/sess1/scan0/suite2p_0
"""
acq_software = (scan.Scan & key).fetch1("acq_software")
filetypes = dict(
ScanImage="*.tif", Scanbox="*.sbx", NIS="*.nd2", PrairieView="*.tif"
)

scan_dir = find_full_path(
get_imaging_root_data_dir(),
get_calcium_imaging_files(key, filetypes[acq_software])[0],
get_calcium_imaging_files(key, acq_software)[0],
).parent
root_dir = find_root_directory(get_imaging_root_data_dir(), scan_dir)

Expand Down