Job creation and action scheduling¶
Create a job, then schedule the desired actions in a job, then run the job.
Quick start example:
from shinestacker import *
job = StackJob("job", "E:/focus_stacking/project_directory/", input_path="tiff_images")
job.add_action(CombinedActions("align", actions=[AlignFrames(), BalanceFrames()]))
job.add_action(FocusStackBunch("batches", PyramidStack(), frames=12, overlap=2))
job.add_action(FocusStack("stack", PyramidStack(), prefix='pyram_'))
job.add_action(FocusStack("stack", DepthMapStack(), prefix='dmap_'))
job.run()
job = StackJob(name, working_path [, input_path])
Arguments are:
working_path: the directory that contains input and output images, organized in subdirectories as specified by each actionname: the name of the job, used for printoutinput_path(optional): the subdirectory withinworking_paththat contains input images for subsequent action. If not specified, at least the first action must specify aninput_path.callbacks(optional, default:None): dictionary of callback functions for internal use. If equal to'tqdm', a progress bar is shown in either text mode or jupyter notebook.enabled(optional, default:True): allows to switch on and off all actions within a job.
Schedule multiple actions based on a reference image: align and/or balance images¶
The class CombinedActions runs multiple actions on each of the frames appearing in a path.
job.add_action(CombinedActions(name, [...], *options))
Arguments for the constructor of CombinedActions are for the :
name: the name of the action, used for printout, and possibly for output path.actions: array of action object to be applied in cascade.input_path(optional): the subdirectory withinworking_paththat contains input images to be processed. If not specified, the last output path is used, or, if this is the first action, theinput_pathspecified with theStackJobconstruction is used. If theStackJobspecifies noinput_path, at least the first action must specify aninput_path.output_path(optional): the subdirectory withinworking_pathwhere aligned images are written. If not specified, it is equal toname.working_path(optional): the directory that contains input and output image subdirectories. If not specified, it is the same asjob.working_path.plot_path(optional, default:plots): the directory withinworking_paththat contains plots produced by the different actions.resample(optional, default: 1): take every nth frame in the selected directory. Default: take all frames.reference_index(optional, default: 0): the index of the image used as reference. Images are numbered starting from one to N. -1 is interpreted as the last image, 0 as the median index.step_process(optional): if equal toTrue(default), each image is processed with respect to the previous or next image, depending if its file is placed in alphabetic order after or befor the reference image.enabled(optional, default:True): allows to switch on and off this module.scratch_output_dir(optional, default:True): scratch output directory before processing. This avoids that existing files pollute the output.delete_output_at_end(optional, default:False): delete output after processing. This cleans disk space in case of processing an intermediate step that is not part of the final output.max_threads(optional, default:2): number of parallel processes allowed. The number of actual threads will not be greater than the number of available CPU cores.chunk_submit(optional, default:True): submit at mostmax_threadsparallel processes. Ifchunk_submitis greater thanmax_threadsa moderate performance gain is achieved at the cost of a possibly large memory occupancy.