Example #1
0
 def __init__(self, directory, zip=False):
     """
     Parameters
     ----------
     directory : str
         The path to the images.
     zip : bool
         Whether or not `directory` points to a zip file.
     """
     super().__init__()
     if not zip:
         # load all DICOM files
         for basefile in os.listdir(directory):
             file = osp.join(directory, basefile)
             try:
                 image = WLImage(file)
             except:
                 pass  # not a DICOM file
             else:
                 self.append(image)
     else:
         files = load_zipfile(directory, read=True)
         for file in files:
             try:
                 image = WLImage(file)
             except:
                 pass  # not a DICOM file
             else:
                 self.append(image)
Example #2
0
    def load_zip(self, zip_file):
        """Load VMAT images from a ZIP file that contains both images.

        .. versionadded:: 0.8
        """
        zfiles = load_zipfile(zip_file)
        images = [BytesIO(zfiles.read(name)) for name in zfiles.namelist()]
        self.load_images(images, names=zfiles.namelist())
Example #3
0
    def load_zip(self, zip_file):
        """Load VMAT images from a ZIP file that contains both images.

        .. versionadded:: 0.8
        """
        zfiles = load_zipfile(zip_file)
        images = [BytesIO(zfiles.read(name)) for name in zfiles.namelist()]
        self.load_images(images, names=zfiles.namelist())