コード例 #1
0
currDir = os.path.dirname(os.path.realpath(__file__))
rootDir = os.path.abspath(os.path.join(currDir, '..'))
if rootDir not in sys.path:  # add parent dir to paths
    sys.path.append(rootDir)

import numpy as np
import Demos.geometry as geometry
import Test_data.data_loader as data_loader
import scipy.io
import Utilities.plotting_utils as plotter

from _Ax import Ax

TIGRE_parameters = geometry.TIGREParameters(high_quality=False)

head = data_loader.load_head_phantom(number_of_voxels=TIGRE_parameters.nVoxel)

angles = np.linspace(0, 2 * np.pi, 20, dtype=np.float32)
# angles = np.linspace(0, 0, 1, dtype=np.float32)
# What is expected to happen here is the memory allocated for the head image is given to the C functions to operate on
# Whilst it will return newly allocated PYTHON(!) memory for each projection; expected to be allocated from C and parsed
# back into python

# I believe it should be ok to just parse geometry each time until we find a way of passing around a C array in python

projections = Ax(head, TIGRE_parameters, angles, 'interpolated')

plotter.plot_projections(projections)

# m = {'projections': projections}
# scipy.io.savemat('projections_python', m)
コード例 #2
0
ファイル: comptest.py プロジェクト: yiyasz/TIGRE
import os
import sys
import scipy as sp
import numpy as np
import tigre.geometry as geometry
import Test_data.data_loader as data_loader
from matplotlib import pyplot as plt
import scipy.io
from tigre.Utilities.plotproj import ppslice
from tigre.Utilities.plotproj import plotproj
from tigre.Utilities.plotImg import plotImg
from tigre.Utilities.Measure_Quality import Measure_Quality as MQ
from _Ax import Ax
from _Atb import Atb
from tigre.Algorithms.SART import SART
from tigre.Algorithms.SIRT import SIRT
from tigre.Algorithms.OS_SART import OS_SART
from tigre.Algorithms.FDK import FDK
import time
geo = geometry.TIGREParameters(high_quality=False)

source_img = data_loader.load_head_phantom(number_of_voxels=geo.nVoxel)
angles = np.linspace(0, 2 * np.pi, 100, dtype=np.float32)

projsirt = Ax(source_img, geo, angles, 'ray-voxel')
fdk = FDK(projsirt, geo, angles)
# blocksize=input('blocksize:')
niter = 5
# sart=SART(projsirt,geo,angles,niter,init='multigrid',OrderStrategy='angularDistance')
ppslice(projsirt)