pySISF Documentation

Module contents

pySISF.

pySISF.sisf.create_metadata(version, dtype, channel_count, mchunk, res, size)[source]
pySISF.sisf.create_shard(fname_data: str, fname_meta: str, data, chunk_size, compression, compression_opts=None, thread_count=8, chunk_batch=1024, crop=None, progress=True) None[source]

Function to create a SISF shard.

Parameters:
  • fname_data (str) – Name of the data file to create.

  • fname_meta (str) – Name of the metadata file to create.

  • data (3D numpy array-like) – Raw data for the chunk.

  • chunk_size (3-tuple of int) – Size of each chunk

  • compression (int) – compression codec to use

  • thread_count (int, default 8) – number of threads to use for data packing

  • chunk_batch (int, default 1024) – number of jobs to allocate per thread for load balancing

  • crop (3-tuple of int, default None) – if set, encodes a crop factor into the shard

  • progress (bool, default True) – prints a loading bar using tqdm

pySISF.sisf.create_shard_worker(data, coords, compression, compression_opts=None)[source]
pySISF.sisf.create_sisf(fname: str, data, mchunk_size, chunk_size, res, enable_status=True, downsampling=None, compression=1, thread_count=8, compression_opts=None) None[source]

Function to create a SISF archive.

Parameters:
  • fname (string) – Name of the folder to place the SISF archive into, created if does not exist.

  • data (numpy array-like) – Represents the data to be converted in CXYZ format.

  • mchunk_size (3-tuple) – size of metachunks to create, e.g. (2000,2000,2000).

  • res (3-tuple) – resolution of the dataset in nanometers (nm), e.g. (100,100,100).

  • enable_status (bool, default True) – If true, print out a loading bar for creation using tqdm.

  • downsampling (int, default None) – How many downsample tiers to generate.

  • compression (int, default 1->ZSTD) – What compression codec to use.

  • thread_count (int, default 8) – How many threads to use for data packing.

pySISF.sisf.get_dtype_code(i)[source]
pySISF.sisf.iterate_bounded(max_val, step_size)[source]
class pySISF.sisf.sisf(fname)[source]

Bases: object

get_chunk(x, y, z, c, s)[source]
parse_metadata()[source]
property shape
class pySISF.sisf.sisf_chunk(fname_data, fname_meta, parent=None)[source]

Bases: object

find_index(x, y, z)[source]
get_chunk(idx)[source]
get_chunk_coords(idx)[source]
get_chunk_numpy(idx)[source]
get_chunk_size(idx)[source]
get_metadata(idx)[source]
static iterate_chunks(rstart, rstop, cs)[source]
parse_metadata()[source]
read_pixel(x, y, z)[source]
property shape

Module contents

pySISF.sndif_utils.downsample(in_array, out_array)[source]

Utility function to downsample a 3D image by a factor of 2X in all dimensions.

Parameters:
  • in_array (numpy) – 3D array containing the input image

  • out_array (numpy) – identical-sized 3D array to write the output to

Returns:

Numpy array containing the downsampled image

pySISF.sndif_utils.load_from_zip(file_name, stack_size=2000, stack_select=None, thread_count=1)[source]

Load image frames from a SNDIF ZIP archive.

Parameters:
  • file_name (str) – Name of the input ZIP file.

  • stack_size (int) – Number of frames expected.

  • stack_select (slice) – A parameter passed to the file list to select inputs.

  • thread_count (int) – Number of threads to launch on the ThreadPoolExecutor.

Returns:

Numpy array containing the loaded frames

Module contents

class pySISF.vidlib.EncoderType(value)

Bases: Enum

An enumeration.

AV1_AOM = 3
AV1_SVT = 4
X264 = 1
X265 = 2
pySISF.vidlib.decode_stack(input_blob, dims=(128, 128), method='libx264', debug=False, fps='24/1')[source]
pySISF.vidlib.encode_stack(input_stack, method=EncoderType.X264, debug=False, fps=24, compression_opts=None)[source]