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 22, 2024
1 parent 32d5e78 commit ec544f5
Show file tree
Hide file tree
Showing 11 changed files with 2,131 additions and 1,666 deletions.
23 changes: 8 additions & 15 deletions foa3d/__main__.py
Original file line number Diff line number Diff line change
@@ -1,29 +1,22 @@
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_over_scales, parallel_frangi_over_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)
# parallel 3D Frangi-based fiber orientation analysis on batches of basic image slices
out_img = parallel_frangi_over_slices(cli_args, save_dirs, in_img)

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

# 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)
# generate 3D fiber ODF maps over the spatial scales of interest using concurrent workers
parallel_odf_over_scales(cli_args, save_dirs, out_img['vec'], out_img['iso'], 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 ec544f5

Please sign in to comment.