utils2p/main.py
def load_stack_batches(path, batch_size):
    """
    This function loads a stack in several batches to make sure
    the system does not run out of memory. It returns a generator
    that yields consecutive chunks of `batch_size` frames of the stack.
    The remaining memory is freed up by the function until the generator
    is called again.

    Parameters
    ----------
    path : string
        Path to stack.
    batch_size : int
        Number of frames in one chunk.

    Returns
    -------
    generator
        Generator that yields chunks of `batch_size` frames of the
        stack.
    """
    stack = load_img(path, memmap=True)
    if stack.ndim < 3:
        raise ValueError(
            f"The path does not point to a stack. The shape is {stack.shape}.")
    n_batches = int(stack.shape[0] / batch_size) + 1
    for i in range(n_batches):
        substack = np.array(stack[i * batch_size:(i + 1) * batch_size])
        yield substack

    This function loads a stack in several batches to make sure
    the system does not run out of memory. It returns a generator
    that yields consecutive chunks of `batch_size` frames of the stack.
    The remaining memory is freed up by the function until the generator
    is called again.

    Parameters
    ----------
    path : string
        Path to stack.
    batch_size : int
        Number of frames in one chunk.

    Returns
    -------
    generator
        Generator that yields chunks of `batch_size` frames of the
        stack.
    
This function loads a stack in several batches to make sure
the system does not run out of memory. It returns a generator
that yields consecutive chunks of `batch_size` frames of the stack.
The remaining memory is freed up by the function until the generator
is called again.

Parameters

path : string
Path to stack.
batch_size : int
Number of frames in one chunk.

Returns

generator
Generator that yields chunks of `batch_size` frames of the
stack.
This function loads a stack in several batches to make sure the system does not run out of memory . It returns a generator that yields consecutive chunks of ` batch_size ` frames of the stack . The remaining memory is freed up by the function until the generator is called again . Parameters path : string Path to stack . batch_size : int Number of frames in one chunk . Returns generator Generator that yields chunks of ` batch_size ` frames of the stack .
def load_stack_batches(path, batch_size):
    stack = load_img(path, memmap=True)
    if stack.ndim < 3:
        raise ValueError(
            f"The path does not point to a stack. The shape is {stack.shape}.")
    n_batches = int(stack.shape[0] / batch_size) + 1
    for i in range(n_batches):
        substack = np.array(stack[i * batch_size:(i + 1) * batch_size])
        yield substack
def load_stack_batches ( path , batch_size ) : stack = load_img ( path , memmap = True ) if stack . ndim < 3 : raise ValueError ( f"The path does not point to a stack. The shape is {stack.shape}." ) n_batches = int ( stack . shape [ 0 ] / batch_size ) + 1 for i in range ( n_batches ) : substack = np . array ( stack [ i * batch_size : ( i + 1 ) * batch_size ] ) yield substack
This function loads a stack in several batches to make sure
the system does not run out of memory.
This function loads a stack in several batches to make sure the system does not run out of memory .
"""
    This function loads a stack in several batches to make sure
    the system does not run out of memory. It returns a generator
    that yields consecutive chunks of `batch_size` frames of the stack.
    The remaining memory is freed up by the function until the generator
    is called again.

    Parameters
    ----------
    path : string
        Path to stack.
    batch_size : int
        Number of frames in one chunk.

    Returns
    -------
    generator
        Generator that yields chunks of `batch_size` frames of the
        stack.
    """
path
batch_size