MCPcopy Create free account
hub / github.com/Slicer/Slicer / downloadFromURL

Function downloadFromURL

Modules/Scripted/SampleData/SampleData.py:19–47  ·  view source on GitHub ↗

Download and optionally load data into the application. :param uris: Download URL(s). :param fileNames: File name(s) that will be downloaded (and loaded). :param nodeNames: Node name(s) in the scene. :param checksums: Checksum(s) formatted as `` : `` to verify the downlo

(uris=None, fileNames=None, nodeNames=None, checksums=None, loadFiles=None,
                    customDownloader=None, loadFileTypes=None, loadFileProperties={})

Source from the content-addressed store, hash-verified

17# SampleData methods
18
19def downloadFromURL(uris=None, fileNames=None, nodeNames=None, checksums=None, loadFiles=None,
20 customDownloader=None, loadFileTypes=None, loadFileProperties={}):
21 """Download and optionally load data into the application.
22
23 :param uris: Download URL(s).
24 :param fileNames: File name(s) that will be downloaded (and loaded).
25 :param nodeNames: Node name(s) in the scene.
26 :param checksums: Checksum(s) formatted as ``<algo>:<digest>`` to verify the downloaded file(s). For example, ``SHA256:cc211f0dfd9a05ca3841ce1141b292898b2dd2d3f08286affadf823a7e58df93``.
27 :param loadFiles: Boolean indicating if file(s) should be loaded. By default, the function decides.
28 :param customDownloader: Custom function for downloading.
29 :param loadFileTypes: file format name(s) (if not specified then the default file reader will be used).
30 :param loadFileProperties: custom properties passed to the IO plugin.
31
32 If the given ``fileNames`` are not found in the application cache directory, they
33 are downloaded using the associated URIs.
34 See ``slicer.mrmlScene.GetCacheManager().GetRemoteCacheDirectory()``
35
36 If not explicitly provided or if set to ``None``, the ``loadFileTypes`` are
37 guessed based on the corresponding filename extensions.
38
39 If a given fileName has the ``.mrb`` or ``.mrml`` extension, it will **not** be loaded
40 by default. To ensure the file is loaded, ``loadFiles`` must be set.
41
42 The ``loadFileProperties`` are common for all files. If different properties
43 need to be associated with files of different types, downloadFromURL must
44 be called for each.
45 """
46 return SampleDataLogic().downloadFromURL(
47 uris, fileNames, nodeNames, checksums, loadFiles, customDownloader, loadFileTypes, loadFileProperties)
48
49
50def downloadSample(sampleName):

Callers

nothing calls this directly

Calls 2

SampleDataLogicClass · 0.85
downloadFromURLMethod · 0.80

Tested by

no test coverage detected