dltk package

dltk.utils module

class dltk.utils.SlidingWindow(img_shape, window_shape, has_batch_dim=True, striding=None)[source]

Bases: object

Sliding window iterator which produces slice objects to slice in a sliding window. This is useful for inference.

Constructs a sliding window iterator

Parameters:
  • img_shape (array_like) – shape of the image to slide over
  • window_shape (array_like) – shape of the window to extract
  • has_batch_dim (bool, optional) – flag to indicate whether a batch dimension is present
  • striding (array_like, optional) – amount to move the window between each position
next()[source]
dltk.utils.sliding_window_segmentation_inference(session, ops_list, sample_dict, batch_size=1)[source]

Utility function to perform sliding window inference for segmentation

Parameters:
  • session (tf.Session) – TensorFlow session to run ops with
  • ops_list (array_like) – Operators to fetch assemble with sliding window
  • sample_dict (dict) – Dictionary with tf.Placeholder keys mapping the
  • placeholders to their respective input
  • batch_size (int, optional) – Number of sliding windows to batch for calculation
Returns:

List of np.arrays corresponding to the assembled outputs of

ops_list

Return type:

list

Module contents