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 numpy as np | |
import scipy as sp | |
import odl | |
from scipy import signal | |
class Convolve(odl.Operator): | |
def __init__(self, space, kernel): | |
super(Convolve, self).__init__(domain=space, range=space, | |
linear=True) |
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
"""Noise-free reconstruction. | |
Adapted from | |
https://github.com/odlgroup/odl/blob/master/examples/solvers/douglas_rachford_pd_tomography_tv.py | |
""" | |
import odl | |
from odl.contrib.fom import psnr | |
# Create ODL data structures |
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
# http://stackoverflow.com/questions/39921607/tensorflow-how-to-make-a-custom-activation-function-with-only-python | |
import tensorflow as tf | |
from tensorflow.python.framework import ops | |
import numpy as np | |
import odl | |
matrix = np.array([[1, 2], | |
[0, 0], | |
[0, 1]], dtype='float32') |
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 numpy as np | |
import odl | |
# --- Set-up geometry of the problem --- # | |
# Discrete reconstruction space: discretized functions on the rectangle | |
# [-20, 20]^2 with 300 samples per dimension. | |
reco_space = odl.uniform_discr( |
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 odl | |
import numpy as np | |
class L2SquaredSmart(odl.solvers.Functional): | |
def __init__(self, op, data): | |
self.data = data | |
self.op = op | |
self.optdata = op.adjoint(data) |
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
#!/bin/bash | |
#set -x | |
# Shows you the largest objects in your repo's pack file. | |
# Written for osx. | |
# | |
# @see https://stubbisms.wordpress.com/2009/07/10/git-script-to-show-largest-pack-objects-and-trim-your-waist-line/ | |
# @author Antony Stubbs | |
export LC_ALL=C |
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 fnmatch | |
import os | |
matches = [] | |
for root, dirnames, filenames in os.walk('E:/Github/ODL/odl'): | |
for filename in fnmatch.filter(filenames, '*.py'): | |
matches.append(os.path.join(root, filename)) | |
for match in matches: | |
with open(match) as f: |
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
# Copyright 2014-2016 The ODL development group | |
# | |
# This file is part of ODL. | |
# | |
# ODL is free software: you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by | |
# the Free Software Foundation, either version 3 of the License, or | |
# (at your option) any later version. | |
# | |
# ODL is distributed in the hope that it will be useful, |
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
"""Example of using the boolean ray transform with ODL. | |
This example is with the 2d ray transform, but you could easily change the | |
geometry to 3d and get the example you gave. See | |
github.com/odlgroup/odl/blob/master/examples/tomo/ray_trafo_parallel_3d.py | |
for an example. | |
Note that some rounding errors may occur. |
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 odl | |
import numpy as np | |
# Discrete reconstruction space: discretized functions on the rectangle | |
# [-20, 20]^2 with 300 samples per dimension. | |
reco_space = odl.uniform_discr( | |
min_pt=[-1, -1], max_pt=[1, 1], shape=[256, 256]) | |
# Make a parallel beam geometry with flat detector |
NewerOlder