Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def get_filename(cls):
return retrieve_demo_file(url='flatsym_demo.dcm')
def from_demo_images(cls):
"""Construct a CBCT object from the demo images."""
demo_file = retrieve_demo_file(url=cls._demo_url)
return cls.from_zip(demo_file)
def get_image_classifier(img_type):
"""Load the CBCT HU slice classifier model. If the classifier is not locally available it will be downloaded."""
if img_type == 'single':
classifier = 'singleimage_classifier.pkl.gz'
elif img_type == 'vmat':
classifier = 'vmat_classifier.pkl.gz'
classifier_file = osp.join(osp.dirname(__file__), 'demo_files', classifier)
# get the classifier if it's not downloaded
if not osp.isfile(classifier_file):
logger.info("Downloading classifier from the internet...")
classifier_file = retrieve_demo_file(classifier)
logger.info("Done downloading")
with gzip.open(classifier_file, mode='rb') as m:
clf = pickle.load(m)
return clf
def from_demo_images(cls):
"""Instantiate using the demo images."""
demo_file = retrieve_demo_file(url='winston_lutz.zip')
return cls.from_zip(demo_file)
def from_demo_image(cls):
"""Instantiate and load the demo image."""
demo_file = retrieve_demo_file(url=cls._demo_filename)
return cls(demo_file)
def from_demo(cls, exclude_beam_off=True):
"""Load and instantiate from the demo trajetory log file included with the package."""
demo_file = io.retrieve_demo_file(url='Tlog.bin')
return cls(demo_file, exclude_beam_off)