pystack3d.stack3d module

Class ‘Stack3d’ used to process stacks from FIB-SEM images. The class has ‘pathdir’ attribute wich is the path to the directory where the data is stored and ‘params’ attribute which is a dictionary of processing parameters

class pystack3d.stack3d.Stack3d(input_name=None)

Bases: object

Class dedicated to the Stack3d workflow

pathdir

Path related to the dirname where the .tif images are stored with the related metadata

Type:

Path

last_step_dir

Dirname related to the last step of the workflow execution. For the first step, ‘last_step_dir’ corresponds to ‘pathdir’

Type:

str

fname_toml

Filename of the ‘.toml’ file defining the workflow parameters

Type:

str

params

Dictionary defining the workflow parameters

Type:

dict

Parameters:

input_name (str, optional) –

Pathname related to the project dirname where the .tif images are stored

OR the filename related to the .toml file defining all the workflow parameters (requiring to set the project ‘dirname’ parameter inside).

If None, consider the directory where the python script has been launched and the .toml and .tif files located inside.

channels(process_step)

Return the list of channels according to the ‘process_step’

process_dirname(process_step, channel)

Return the process dirname wrt to ‘process_step’ and ‘channel’

fnames(input_dirname)

Return the .tif filenames related to the input_dirname

shape(fnames)

Return the shape of the stack

create_partition(fnames, nproc, overlay=0)

Return a filenames partition related to a multiprocessing execution

Parameters:
  • fnames (list of str or list of Path) – List of the input filenames to consider

  • nproc (int) – Number of cpus to consider to create the partition

  • overlay (int, optional) – Number of overlaid frames to ensure continuity in the processing

Returns:

  • fnames_part (list of lists of str) – List of filenames partitions

  • ind_part (list of lists of int) – List of indexes partitions

eval(process_steps=None, nproc=None, serial=True, show_pbar=True)

Method to apply a process step to the stack object

Parameters:
  • process_steps (list of str or str) – Name(s) of the processing step(s) to apply to the stack If None: ‘process_steps’ is defined from ‘params’

  • nproc (int, optional) – Number of cpus to use. If None: ‘nproc’ is defined from ‘params’ If nproc=0: the workflow is executed without calculation

  • serial (bool, optional) – Activation key to consider a serialized workflow. If False, each process takes data located in the ‘input’ data folder

  • show_pbar (bool, optional) – Activation key to display the progress bar during the processing

cleanup()

Remove the .tif files except the ones related to the last process

concatenate_tif(process_step=None, save_metadata=True, dirname_out=None, name_out='big.tif')

Concatenate .tif files issued from a process step into a single one

Parameters:
  • process_step (str, optional) – Process step name to handle. If ‘input’ concatenate the input .tif files If None (default) concatenate the .tif files related to the last process execution extracted from the ‘history’ in the .toml file

  • save_metadata (bool, optional) – Activation key to save metadata in the .tif file

  • dirname_out (str or WindowsPath, optional) – Dirname associated to the big .tif file saving. If None, consider the same dirname as the input dirname related to the ‘process_step’

  • name_out (str, optional) – Name of the big .tif file

pystack3d.stack3d.plot(process_step, output_dirname, input_dirname, kwargs)

Plot statistics and specific values related to the ‘process_step’

pystack3d.stack3d.plot_stats_xy(input_dirname, output_dirname, skip_factors=(10, 10, 10))

Plot statistics in x et y directions considering ‘skip_factors’ when loading the full 3D stack

pystack3d.stack3d.pbar_update(queue_incr, nslices, overlay, nproc)

Progress bar