Skip to content

Commit

Permalink
Merge pull request #164 from ttngu207/main
Browse files Browse the repository at this point in the history
bugfix in `infer_output_dir`
  • Loading branch information
kushalbakshi authored Feb 1, 2024
2 parents b6b4b69 + e514ff7 commit 2480906
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 17 deletions.
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

0 comments on commit 2480906

Please sign in to comment.