-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
23accb6
commit 96e211b
Showing
6 changed files
with
1,143 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
#!/usr/bin/env python3 | ||
# -*- coding: utf-8 -*- | ||
""" | ||
Created on Fri Jan 17 18:46:40 2020 | ||
@author: Rodrigo | ||
""" | ||
|
||
import numpy as np | ||
import numpy.ctypeslib as ctl | ||
|
||
from functions.utilities import findAndLoadLibray | ||
from functions.utilities import geoAsNp | ||
|
||
def backprojectionDD(proj, geo, libFiles): | ||
|
||
|
||
# Check if the input is in proper size | ||
if not (proj.shape[0] == geo.nv and proj.shape[1] == geo.nu and proj.shape[2] == geo.nProj): | ||
raise ValueError('First argument needs to have the same number of rows, cols and slices as in the configuration file.') | ||
|
||
|
||
# Find and library | ||
lib = findAndLoadLibray(libFiles, 'backprojectionDD') | ||
|
||
|
||
backprojectionDD_lib = lib.backprojectionDD_lib | ||
|
||
backprojectionDD_lib.argtypes = [ctl.ndpointer(np.float64, flags='aligned, c_contiguous'), | ||
ctl.ndpointer(np.float64, flags='aligned, c_contiguous'), | ||
ctl.ndpointer(np.float32, flags='aligned, c_contiguous')] | ||
|
||
|
||
# Transform geo class in numpy array | ||
geoNp = geoAsNp(geo) | ||
|
||
|
||
vol_transp = np.empty([geo.nz, geo.nx, geo.ny], dtype=np.float64) | ||
|
||
proj_transp = np.transpose(proj, (2, 1, 0)).copy() | ||
|
||
backprojectionDD_lib (proj_transp, vol_transp, geoNp) | ||
|
||
vol = np.transpose(vol_transp, (2, 1, 0)).copy() | ||
|
||
|
||
return vol | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#!/usr/bin/env python3 | ||
# -*- coding: utf-8 -*- | ||
""" | ||
Created on Fri Jan 15 16:06:05 2021 | ||
@author: Rodrigo | ||
""" | ||
|
||
import numpy as np | ||
import numpy.ctypeslib as ctl | ||
|
||
from functions.utilities import findAndLoadLibray | ||
from functions.utilities import geoAsNp | ||
|
||
def projectionDD(vol, geo, libFiles): | ||
|
||
|
||
# Check if the input is in proper size | ||
if not (vol.shape[0] == geo.ny and vol.shape[1] == geo.nx and vol.shape[2] == geo.nz): | ||
raise ValueError('First argument needs to have the same number of rows, cols and slices as in the configuration file.') | ||
|
||
|
||
# Find and library | ||
lib = findAndLoadLibray(libFiles, 'projectionDD') | ||
|
||
|
||
projectionDD_lib = lib.projectionDD_lib | ||
|
||
projectionDD_lib.argtypes = [ctl.ndpointer(np.float64, flags='aligned, c_contiguous'), | ||
ctl.ndpointer(np.float64, flags='aligned, c_contiguous'), | ||
ctl.ndpointer(np.float32, flags='aligned, c_contiguous')] | ||
|
||
|
||
# Transform geo class in numpy array | ||
geoNp = geoAsNp(geo) | ||
|
||
|
||
proj_transp = np.empty([geo.nProj, geo.nu, geo.nv], dtype=np.float64) | ||
|
||
vol_transp = np.transpose(vol, (2, 1, 0)).copy() | ||
|
||
projectionDD_lib(vol_transp, proj_transp, geoNp) | ||
|
||
proj = np.transpose(proj_transp, (2, 1, 0)).copy() | ||
|
||
|
||
return proj | ||
|
||
|
||
|
||
|
||
|
||
|
Oops, something went wrong.