We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 126a9a9 commit 2cdb576Copy full SHA for 2cdb576
nibabel/filebasedimages.py
@@ -571,3 +571,13 @@ def to_bytes(self):
571
file_map = self.make_file_map({'image': bio, 'header': bio})
572
self.to_file_map(file_map)
573
return bio.getvalue()
574
+
575
+ @classmethod
576
+ def from_url(klass, url):
577
+ """ Fetch image from remote location and construct an image
578
579
+ Requires the ``requests`` library to be installed.
580
+ """
581
+ import requests
582
+ res = requests.get(url)
583
+ return klass.from_bytes(res.content)
0 commit comments