Created
June 27, 2020 16:37
-
-
Save pieper/a9c0ba57de3833c9f5aea68247bda597 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import shutil | |
archiveFilePath = os.path.join(slicer.app.temporaryPath, "master.zip") | |
outputDir = os.path.join(slicer.app.temporaryPath, "SlicerImageStacks") | |
try: | |
os.remove(archiveFilePath) | |
except FileNotFoundError: | |
pass | |
try: | |
shutil.rmtree(outputDir) | |
except FileNotFoundError: | |
pass | |
os.mkdir(outputDir) | |
slicer.util.downloadAndExtractArchive( | |
url = "https://github.com/pieper/SlicerImageStacks/archive/master.zip", | |
archiveFilePath = archiveFilePath, | |
outputDir = outputDir) | |
modulePath = os.path.join(outputDir, "SlicerImageStacks-master", "ImageStacks", "ImageStacks.py") | |
factoryManager = slicer.app.moduleManager().factoryManager() | |
factoryManager.registerModule(qt.QFileInfo(modulePath)) | |
factoryManager.loadModules(["ImageStacks",]) | |
slicer.util.selectModule("ImageStacks") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment