def __init__(self, volpath, ext='.npz', nb_restart_cycle=None, name='single_vol', fixed_vol_size=True):
    volfiles = _get_file_list(volpath, ext, vol_rand_seed)
    nb_files = len(volfiles)
    assert (nb_files > 0), ('Could not find any files at %s with extension %s' % (volpath, ext))
    if (nb_restart_cycle is None):
        nb_restart_cycle = nb_files
    vol_data = _load_medical_volume(os.path.join(volpath, volfiles[0]), ext)
    if (data_proc_fn is not None):
        vol_data = data_proc_fn(vol_data)
        [f for f in _npz_headers(npz, namelist=['vol_data.npy'])][0][1]
    nb_patches_per_vol = 1
    if (fixed_vol_size and (patch_size is not None) and all(((f is not None) for f in patch_size))):
        nb_patches_per_vol = np.prod(pl.gridsize(vol_data.shape, patch_size, patch_stride))
    assert (nb_restart_cycle <= (nb_files * nb_patches_per_vol)), ('%s restart cycle (%s) too big (%s) in %s' % (name, nb_restart_cycle, (nb_files * nb_patches_per_vol), volpath))
def __init__(self, volpath, ext='.npz', nb_restart_cycle=None, name='single_vol', fixed_vol_size=True):
    volfiles = _get_file_list(volpath, ext, vol_rand_seed)
    nb_files = len(volfiles)
    assert (nb_files > 0), ('Could not find any files at %s with extension %s' % (volpath, ext))
    if (nb_restart_cycle is None):
        nb_restart_cycle = nb_files
    vol_data = _load_medical_volume(os.path.join(volpath, volfiles[0]), ext)
    if (data_proc_fn is not None):
        vol_data = data_proc_fn(vol_data)
        [f for f in _npz_headers(npz, namelist=['vol_data.npy'])][0][1]
    nb_patches_per_vol = 1
    if (fixed_vol_size and (patch_size is not None) and all(((f is not None) for f in patch_size))):
        nb_patches_per_vol = np.prod(pl.gridsize(vol_data.shape, patch_size, patch_stride))
    assert (nb_restart_cycle <= (nb_files * nb_patches_per_vol)), ('%s restart cycle (%s) too big (%s) in %s' % (name, nb_restart_cycle, (nb_files * nb_patches_per_vol), volpath))