How to use the pyconrad.setup_pyconrad function in pyconrad

To help you get started, we’ve selected a few pyconrad examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github csyben / PYRO-NN / examples / ct_reconstruction / exampe_learning_simple.py View on Github external
import numpy as np
import tensorflow as tf
import lme_custom_ops
import pyconrad as pyc
import matplotlib.pyplot as plt
pyc.setup_pyconrad()


from pyronn.ct_reconstruction.layers.projection_2d import parallel_projection2d
from pyronn.ct_reconstruction.layers.backprojection_2d import parallel_backprojection2d
from pyronn.ct_reconstruction.geometry.geometry_parallel_2d import GeometryParallel2D
from pyronn.ct_reconstruction.helpers.phantoms import shepp_logan
from pyronn.ct_reconstruction.helpers.trajectories import circular_trajectory
from pyronn.ct_reconstruction.helpers.filters import filters
import pyronn.ct_reconstruction.helpers.misc.generate_sinogram as generate_sinogram


def example_learning_simple():
    # ------------------ Declare Parameters ------------------

    # Volume Parameters:
    volume_size = 200
github csyben / PYRO-NN / deep_ct_reconstruction / ct_reconstruction / helpers / phantoms / circle.py View on Github external
import numpy as np

import pyconrad as pyc # TODO: get independent of pyconrad
pyc.setup_pyconrad()

def circle(shape, pos, radius, value):

    # create meshgrid of coords
    xx, yy = np.mgrid[:shape[1], :shape[0]]

    # calc squared distance to pos
    circle = (xx - pos[1]) ** 2 + (yy - pos[0]) ** 2

    return (circle <= radius**2) * value

def ellipse(shape, pos, half_axes, value, theta=0):

    # create meshgrid of coords
    xx, yy = np.mgrid[:shape[0], :shape[1]]
github csyben / PYRO-NN / examples / ct_reconstruction / example_parallel_3d.py View on Github external
sinogram = sinogram + np.random.normal(
           loc=np.mean(np.abs(sinogram)), scale=np.std(sinogram), size=sinogram.shape) * 0.02

        reco_filter = filters.ram_lak_3D(geometry)

        sino_freq = np.fft.fft(sinogram, axis=2)
        sino_filtered_freq = np.multiply(sino_freq,reco_filter)
        sinogram_filtered = np.fft.ifft(sino_filtered_freq, axis=2)

        result_back_proj = par_backprojection3d(sinogram_filtered,geometry)
        reco = result_back_proj.eval()
        import pyconrad as pyc
        pyc.setup_pyconrad()
        pyc.imshow(phantom)
        pyc.imshow(sinogram)
        pyc.imshow(reco)
        a = 5
        #plt.figure()
github csyben / PYRO-NN / examples / ct_reconstruction / example_iterative_reco.py View on Github external
def train(self, zero_vector, acquired_sinogram):
        import pyconrad as pyc
        pyc.setup_pyconrad()
        self.data_iterator = tf.data.Dataset.from_tensor_slices((zero_vector, acquired_sinogram)).batch(1)

        last_loss = 100000000
        for epoch in range(self.args.num_epochs):
            for images, labels in self.data_iterator:
                self.train_step(images, labels)
            if epoch % 25 is 0:
                pyc.imshow(self.model.reco.numpy(), 'reco')
            if epoch % 100 is 0:
                template = 'Epoch {}, Loss: {}'
                print(template.format(epoch, self.loss_v.numpy()))
            if self.loss_v.numpy() > last_loss*1.03:
                print('break at epoch', epoch)
                break
            last_loss = self.loss_v.numpy()

pyconrad

Python wrapper for CONRAD (https://www5.cs.fau.de/conrad/), a framework for cone beam radiography

GPL-3.0
Latest version published 4 years ago

Package Health Score

39 / 100
Full package analysis