apm_process_image_stack

Description: Processes a binary tif stack, with the option to remove disconnected voxels based on an undirected graph. The number of clusters to retain can be specified and connectivity is defined on a 26 point basis, i.e faces, edges and corners. Standard outputs include the processed tif image stack, an aperture map and offset map based on the processed image. Offset maps are filtered based on gradient steepness to provide a smoother surface. Data gaps left by zero apeture zones or filtering are filled by linear and nearest interpolation methods to prevent artificial features.

For usage information run: apm_process_image_stack -h

Written By: Matthew stadelman
Date Written: 2016/08/30
Last Modfied: 2017/04/23

apmapflow.scripts.apm_process_image_stack.calculate_offset_map(img_data)[source]

Handles calculation of an offset map based on image data

apmapflow.scripts.apm_process_image_stack.filter_high_gradients(data_map)[source]

Filters the offset field to reduce the number of very steep gradients. The magnitude of the gradient is taken and all values less than or greater than +-99th percentile are removed and recalculated.

apmapflow.scripts.apm_process_image_stack.generate_adjacency_matrix(conns, nonzero_locs)[source]

generates a ajacency matrix based on connectivity array

apmapflow.scripts.apm_process_image_stack.generate_index_map(nonzero_locs, shape)[source]

Determines the i,j,k indicies of the flattened array

apmapflow.scripts.apm_process_image_stack.generate_node_connectivity_array(index_map, data_array)[source]

Generates a node connectivity array based on faces, edges and corner adjacency

apmapflow.scripts.apm_process_image_stack.main()[source]

Driver program to load an image and generate maps. Memory requirements when processing a large TIFF stack can be very high.

apmapflow.scripts.apm_process_image_stack.patch_holes(data_map)[source]

Fills in any areas with a non finite value by taking a linear average of the nearest non-zero values along each axis

apmapflow.scripts.apm_process_image_stack.process_image(img_data, num_clusters, **kwargs)[source]

Processes a tiff stack on retaining voxels based on node connectivity. The clusters are sorted by size and the large N are retained.

apmapflow.scripts.apm_process_image_stack.remove_isolated_clusters(conns, nonzero_locs, num_to_keep, **kwargs)[source]

Identifies and removes all disconnected clusters except the number of groups specified by “num_to_keep”. num_to_keep=N retains the N largest clusters

apmapflow.scripts.apm_process_image_stack.save_cluster_image(cs_ids, groups, counts, locs, img_shape, img_name)[source]

Saves an 8 bit image colored by cluster number