Skip to content

Commit

Permalink
back and projectionDD added
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigovimieiro committed Jan 19, 2021
1 parent 23accb6 commit 96e211b
Show file tree
Hide file tree
Showing 6 changed files with 1,143 additions and 0 deletions.
68 changes: 68 additions & 0 deletions pydbt/functions/backprojectionDD.py
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





















53 changes: 53 additions & 0 deletions pydbt/functions/projectionDD.py
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






Loading

0 comments on commit 96e211b

Please sign in to comment.