예제 #1
0
    def __init__(self,
                 domain,
                 range,
                 sinogram,
                 settings=None,
                 settings_file_name=None):
        if settings_file_name is None and settings is None:
            settings = {}
        elif settings_file_name is not None and settings is not None:
            raise ValueError('need either `settings_file_name` or `settings`')
        elif settings is not None:
            settings.update(settings_from_domain(domain))
            settings_file_name = make_settings_file(settings)
            self.umap_file_name = settings['UMAPFILENAME']

        self.settings_file_name = settings_file_name
        self.volume_file = tempfile.NamedTemporaryFile(mode='w+')
        self.scatter_file = tempfile.NamedTemporaryFile(mode='r')
        self.sinogram_in = tempfile.NamedTemporaryFile(mode='w+', delete=False)
        fortransino = np.asfortranarray(sinogram, dtype='float32')
        fortransino = fortransino.swapaxes(0, 2)
        self.sinogram_in.seek(0)
        self.sinogram_in.write(fortransino.tobytes())
        self.sinogram_in.flush()
        odl.Operator.__init__(self, domain, range, linear=False)
예제 #2
0
    def __init__(self, domain, range, geometry, settings):
        settings.update(settings_from_domain(range))
        settings_file_name = make_settings_file(settings)

        self.geometry = geometry
        self.settings_file_name = settings_file_name
        self.settings = settings
        self.sinogram_file = tempfile.NamedTemporaryFile(mode='w+')
        self.backproj_file = tempfile.NamedTemporaryFile(mode='r')
        odl.Operator.__init__(self, domain, range, linear=True)
예제 #3
0
    def __init__(self, domain, range, settings=None, settings_file_name=None):
        if settings_file_name is None and settings is None:
            settings = {}
        elif settings_file_name is not None and settings is not None:
            raise ValueError('need either `settings_file_name` or `settings`')
        elif settings is not None:
            settings.update(settings_from_domain(domain))
            settings_file_name = make_settings_file(settings)

        self.settings_file_name = settings_file_name
        self.sinogram_file = tempfile.NamedTemporaryFile(mode='w+')
        self.backproj_file = tempfile.NamedTemporaryFile(mode='r')
        odl.Operator.__init__(self, domain, range, linear=True)
예제 #4
0
    def __init__(self, domain, range, geometry, settings):
        settings.update(settings_from_domain(domain))
        settings_file_name = make_settings_file(settings)

        self.settings = settings
        self.settings_file_name = settings_file_name
        self.geometry = geometry
        self.volume_file = tempfile.NamedTemporaryFile(mode='w+')
        self.sinogram_file = tempfile.NamedTemporaryFile(mode='r')

        # Create reference sinogram file
        npsinogram = np.asarray(range.zero(), dtype='float32')
        sinogram_with_geom = np.hstack((self.geometry, npsinogram[:, None]))
        fortransinogram = np.asfortranarray(sinogram_with_geom,
                                            dtype='float32')
        self.reference_sinogram_file = tempfile.NamedTemporaryFile(mode='w+')
        self.reference_sinogram_file.write(fortransinogram.tobytes())
        self.reference_sinogram_file.flush()

        odl.Operator.__init__(self, domain, range, linear=True)