niftynet.utilities.download module
Downloading model zoo specifications and model zoo contents.
-
download(example_ids, download_if_already_existing=False, verbose=True)[source]
Downloads standard NiftyNet examples such as data, samples
| Parameters: |
- example_ids – A list of identifiers for the samples to download
- download_if_already_existing – If true, data will always be downloaded
- verbose – If true, download info will be printed
|
-
download_file(url, download_path)[source]
Download a file from a resource URL to the given location
| Parameters: |
- url – URL of the file to download
- download_path – location where the file should be saved
|
-
download_and_decompress(url, download_path, verbose=True)[source]
Download an archive from a resource URL and
decompresses/unarchives to the given location
| Parameters: |
- url – URL of the compressed file to download
- download_path – location where the file should be extracted
|
-
class
ConfigStore(global_config, verbose=True)[source]
Bases: object
Manages a configuration file store based on a
remote repository with local caching
-
exists(example_id)[source]
Returns True if a record exists for this example_id,
either locally or remotely
-
update_if_required(example_id, download_if_already_existing=False)[source]
Downloads data using the configuration file
if it is not already up to date.
Returns True if no update was required and no errors occurred
-
class
ConfigStoreCache(cache_folder)[source]
Bases: object
A local cache for configuration files
-
exists(example_id)[source]
Returns True if a record exists for this example_id,
either locally or remotely
-
get_local_path(example_id)[source]
Returns the full path to the locally cached configuration file
-
get_local_cache_folder()[source]
Returns the folder in which the cached files are stored
-
get_download_params(example_id)[source]
Returns the local configuration file for this example_id
-
class
RemoteProxy(parent_store_folder, base_url)[source]
Bases: object
A remote configuration file store with a local cache
-
exists(example_id)[source]
Returns True if a record exists locally or remotely
-
update(example_id)[source]
Retrieves the latest record from the remote store and
puts locally into the remote cache
-
get_download_params(example_id)[source]
Returns the local configuration file for this example_id
-
get_local_path(example_id)[source]
Returns the full path to the locally cached configuration file
-
class
RemoteConfigStore(base_url)[source]
Bases: object
A remote configuration file store
-
exists(example_id)[source]
Returns true if the record exists on the remote server
-
get_url(example_id)[source]
Gets the URL for the record for this example_id
-
raw_file_url(base_url, example_id=None)[source]
Returns the url for the raw file on a GitLab server
-
url_exists(url)[source]
Returns true if the specified url exists, without any redirects
-
progress_bar_wrapper(count, block_size, total_size)[source]
Uses the common progress bar in the urlretrieve hook format
-
main()[source]
Launch download process with user-specified options.