niftynet.utilities.download module

class niftynet.utilities.download.ConfigStore(parent_store_folder, remote_base_url)

Manages a configuration file store based on a remote repository with local caching

exists(example_id)

Returns True if a record exists for this example_id, either locally or remotely

update_if_required(example_id, download_if_already_existing=False)

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 niftynet.utilities.download.ConfigStoreCache(cache_folder)

A local cache for configuration files

exists(example_id)

Returns True if a record exists for this example_id, either locally or remotely

get_download_params(example_id)

Returns the local configuration file for this example_id

get_local_cache_folder()

Returns the folder in which the cached files are stored

get_local_path(example_id)

Returns the full path to the locally cached configuration file

class niftynet.utilities.download.RemoteConfigStore(base_url)

A remote configuration file store

exists(example_id)

Returns true if the record exists on the remote server

get_url(example_id)

Gets the URL for the record for this example_id

class niftynet.utilities.download.RemoteProxy(parent_store_folder, base_url)

A remote configuration file store with a local cache

exists(example_id)

Returns True if a record exists locally or remotely

get_download_params(example_id)

Returns the local configuration file for this example_id

get_local_path(example_id)

Returns the full path to the locally cached configuration file

update(example_id)

Retrieves the latest record from the remote store and puts locally into the remote cache

niftynet.utilities.download.download(example_ids, niftynet_base_folder=None, download_if_already_existing=False)

Downloads standard NiftyNet examples such as data, samples

Parameters:
  • example_ids – A list of identifiers for the samples to download
  • niftynet_base_folder – The base folder where downloads are stored
  • download_if_already_existing – If true, data will always be downloaded
niftynet.utilities.download.download_and_decompress(url, download_path)

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
niftynet.utilities.download.download_file(url, download_path)

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
niftynet.utilities.download.main()
niftynet.utilities.download.url_exists(url)

Returns true if the specified url exists, without any redirects