Skip to content

Downloader class to retrieve images from the QIM data repository + unittests + hotfix for ImgExamples() class for Windows users

ofhkr requested to merge downloader into main

The Downloader() class can be used similarly to the ImgExamples() class, where the user simply calls: ´qim3d.downloader.folder.file()´ in order to download the file of interest to the working directory.

in fact, the qim3d.io.Downloader() class is initialized in the __init__.py file when importing the package.

The user also has the option to call ´img = qim3d.downloader.folder.file(load_file = True)´ to both download the file and load it at the same time, so it is ready to be used.

#---------------

Furthermore, 4 unit tests have been made for the Downloader() class:

  • The smallest file possible is downloaded and its shape is asserted.
  • The size from a url with a file in the qim data repository is asserted.
  • The size from a url with no files is asserted to be equal to -1.
  • The presence of the link to the data repository in the opened and decoded url is asserted.

#---------------

Finally, a small change to the ImgExamples() class is made such that the link to the examples is forced to be a string. before, the path would include a \b, which would represent a backspace character rather than a path to a subfolder in Windows.

Edited by ofhkr

Merge request reports

Loading