Skip to content

Commit

Permalink
Improve function parameters and reorganize modules
Browse files Browse the repository at this point in the history
  • Loading branch information
msorelli committed Oct 21, 2024
1 parent 32d5e78 commit a6bfa05
Show file tree
Hide file tree
Showing 11 changed files with 1,632 additions and 1,508 deletions.
20 changes: 7 additions & 13 deletions foa3d/__main__.py
Original file line number Diff line number Diff line change
@@ -1,29 +1,23 @@
from foa3d.input import get_cli_parser, load_microscopy_image
from foa3d.pipeline import (parallel_odf_at_scales, parallel_frangi_on_slices)
from foa3d.pipeline import parallel_odf_at_scales, parallel_frangi_on_slices
from foa3d.printing import print_pipeline_heading
from foa3d.utils import delete_tmp_folder


def foa3d(cli_args):

# load 3D microscopy image or 4D array of fiber orientation vectors
img, ts_msk, ch_ax, is_fovec, save_dir, tmp_dir, img_name = load_microscopy_image(cli_args)
# load 3D grayscale or RGB microscopy image or 4D array of fiber orientation vectors
in_img, save_dirs = load_microscopy_image(cli_args)

# conduct parallel 3D Frangi-based fiber orientation analysis on batches of basic image slices
if not is_fovec:
fbr_vec_img, iso_fbr_img, px_sz \
= parallel_frangi_on_slices(img, ch_ax, cli_args, save_dir[0], tmp_dir, img_name, ts_msk=ts_msk)

# skip Frangi filter stage if orientation vectors were directly provided as input
else:
fbr_vec_img, iso_fbr_img, px_sz = (img, None, None)
out_img = parallel_frangi_on_slices(cli_args, save_dirs, in_img)

# estimate 3D fiber ODF maps at the spatial scales of interest using concurrent workers
if cli_args.odf_res:
parallel_odf_at_scales(fbr_vec_img, iso_fbr_img, cli_args, px_sz, save_dir[1], tmp_dir, img_name)
parallel_odf_at_scales(cli_args, save_dirs, out_img['fbr_vec'], out_img['iso_fbr'],
out_img['px_sz'], in_img['name'])

# delete temporary folder
delete_tmp_folder(tmp_dir)
delete_tmp_folder(save_dirs['tmp'])


def main():
Expand Down
Loading

0 comments on commit a6bfa05

Please sign in to comment.