Skip to content

Commit

Permalink
x and y volume offset for projectors
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigovimieiro committed Feb 15, 2022
1 parent f8cef61 commit 1af5902
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 11 deletions.
2 changes: 1 addition & 1 deletion pydbt/example.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#%%
import matplotlib.pyplot as plt

from parameterSettings import geometry_settings
from parameters.parameterSettings import geometry_settings

from functions.manageDicom import readDicom
from functions.dataPreProcess import dataPreProcess
Expand Down
Empty file added pydbt/parameters/__init__.py
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ def Hologic(self):
self.tubeAngle = 15 # Tube Angle

self.detAngle = 4.2 # Detector Angle

self.x_offset = 0 # Volume X offset (mm)
self.y_offset = 0 # Volume Y offset (mm)

def GE(self):

Expand Down Expand Up @@ -79,6 +82,9 @@ def GE(self):
self.tubeAngle = 25 # Tube Angle

self.detAngle = 0 # Detector Angle

self.x_offset = 0 # Volume X offset (mm)
self.y_offset = 0 # Volume Y offset (mm)

def SheppLogan(self):

Expand Down Expand Up @@ -115,4 +121,8 @@ def SheppLogan(self):
self.tubeAngle = 15 # Tube Angle

self.detAngle = 4.2 # Detector Angle

self.x_offset = 0 # Volume X offset (mm)
self.y_offset = 0 # Volume Y offset (mm)


7 changes: 5 additions & 2 deletions pydbt/sources/backprojectionDD/backprojectionDD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ extern "C" void backprojectionDD_lib(double* const pProj,
double* const pTubeAngle = (double*)malloc(nProj * sizeof(double));
double* const pDetAngle = (double*)malloc(nProj * sizeof(double));

const int x_offset = (const int)pGeo[18];
const int y_offset = (const int)pGeo[19];

linspace(-tubeAngle/2, tubeAngle/2, nProj, pTubeAngle);
linspace(-detAngle/2, detAngle/2, nProj, pDetAngle);

Expand Down Expand Up @@ -117,9 +120,9 @@ extern "C" void backprojectionDD_lib(double* const pProj,

mapBoudaries(pDetZ, nDetYMap, 0.0, 0.0, 0.0);

mapBoudaries(pObjX, nPixXMap, (double)nPixX, -dx, 0.0);
mapBoudaries(pObjX, nPixXMap, (double)nPixX, -dx, x_offset);

mapBoudaries(pObjY, nPixYMap, nPixY / 2.0, dy, 0.0);
mapBoudaries(pObjY, nPixYMap, nPixY / 2.0, dy, y_offset);

mapBoudaries(pObjZ, nSlices, 0.0, dz, DAG + (dz / 2.0));

Expand Down
11 changes: 8 additions & 3 deletions pydbt/sources/backprojectionDDb/backprojectionDDb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,15 @@ extern "C" void backprojectionDDb_lib(double* const pProj,
double* const pTubeAngle = (double*)malloc(nProj * sizeof(double));
double* const pDetAngle = (double*)malloc(nProj * sizeof(double));

const int x_offset = (const int)pGeo[18];
const int y_offset = (const int)pGeo[19];

linspace(-tubeAngle/2, tubeAngle/2, nProj, pTubeAngle);
linspace(-detAngle/2, detAngle/2, nProj, pDetAngle);

// printf("Nx:%d Ny:%d Nz:%d \nNu:%d Nv:%d \nDx:%.2f Dy:%.2f Dz:%.2f \nDu:%.2f Dv:%.2f \nDSD:%.2f DDR:%.2f \nTube angle:%.2f \nDet angle:%.2f", nPixX, nPixY, nSlices, nDetX, nDetY, dx, dy, dz, du, dv, DSD, DDR, tubeAngle, detAngle);

backprojectionDDb(pVolume, pProj, pTubeAngle, pDetAngle, nProj, nPixX, nPixY, nSlices, nDetX, nDetY, dx, dy, dz, du, dv, DSD, DDR, DAG);
backprojectionDDb(pVolume, pProj, pTubeAngle, pDetAngle, x_offset, y_offset, nProj, nPixX, nPixY, nSlices, nDetX, nDetY, dx, dy, dz, du, dv, DSD, DDR, DAG);

free(pTubeAngle);
free(pDetAngle);
Expand All @@ -103,6 +106,8 @@ void backprojectionDDb(double* const pVolume,
double* const pProj,
double* const pTubeAngle,
double* const pDetAngle,
const int x_offset,
const int y_offset,
const int nProj,
const int nPixX,
const int nPixY,
Expand Down Expand Up @@ -168,9 +173,9 @@ void backprojectionDDb(double* const pVolume,

mapBoudaries(pDetZ, nDetYMap, 0.0, 0.0, 0.0);

mapBoudaries(pObjX, nPixXMap, (double)nPixX, -dx, 0.0);
mapBoudaries(pObjX, nPixXMap, (double)nPixX, -dx, x_offset);

mapBoudaries(pObjY, nPixYMap, nPixY / 2.0, dy, 0.0);
mapBoudaries(pObjY, nPixYMap, nPixY / 2.0, dy, y_offset);

mapBoudaries(pObjZ, nSlices, 0.0, dz, DAG + (dz / 2.0));

Expand Down
7 changes: 5 additions & 2 deletions pydbt/sources/projectionDD/projectionDD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ extern "C" void projectionDD_lib(double* const pVolume,
const double tubeAngle = (const double)pGeo[16];
const double detAngle = (const double)pGeo[17];

const int x_offset = (const int)pGeo[18];
const int y_offset = (const int)pGeo[19];

double* const pTubeAngle = (double*)malloc(nProj * sizeof(double));
double* const pDetAngle = (double*)malloc(nProj * sizeof(double));

Expand Down Expand Up @@ -123,9 +126,9 @@ extern "C" void projectionDD_lib(double* const pVolume,

mapBoudaries(pDetZ, nDetYMap, 0.0, 0.0, 0.0);

mapBoudaries(pObjX, nPixXMap, (double)nPixX, -dx, 0.0);
mapBoudaries(pObjX, nPixXMap, (double)nPixX, -dx, x_offset);

mapBoudaries(pObjY, nPixYMap, nPixY / 2.0, dy, 0.0);
mapBoudaries(pObjY, nPixYMap, nPixY / 2.0, dy, y_offset);

mapBoudaries(pObjZ, nSlices, 0.0, dz, DAG + (dz / 2.0));

Expand Down
11 changes: 8 additions & 3 deletions pydbt/sources/projectionDDb/projectionDDb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,15 @@ extern "C" void projectionDDb_lib(double* const pVolume,
double* const pTubeAngle = (double*)malloc(nProj * sizeof(double));
double* const pDetAngle = (double*)malloc(nProj * sizeof(double));

const int x_offset = (const int)pGeo[18];
const int y_offset = (const int)pGeo[19];

linspace(-tubeAngle/2, tubeAngle/2, nProj, pTubeAngle);
linspace(-detAngle/2, detAngle/2, nProj, pDetAngle);

// printf("Nx:%d Ny:%d Nz:%d \nNu:%d Nv:%d \nDx:%.2f Dy:%.2f Dz:%.2f \nDu:%.2f Dv:%.2f \nDSD:%.2f DDR:%.2f \nTube angle:%.2f \nDet angle:%.2f", nPixX, nPixY, nSlices, nDetX, nDetY, dx, dy, dz, du, dv, DSD, DDR, tubeAngle, detAngle);

projectionDDb(pProj, pVolume, pTubeAngle, pDetAngle, nProj, nPixX, nPixY, nSlices, nDetX, nDetY, dx, dy, dz, du, dv, DSD, DDR, DAG);
projectionDDb(pProj, pVolume, pTubeAngle, pDetAngle, x_offset, y_offset, nProj, nPixX, nPixY, nSlices, nDetX, nDetY, dx, dy, dz, du, dv, DSD, DDR, DAG);

free(pTubeAngle);
free(pDetAngle);
Expand All @@ -102,6 +105,8 @@ void projectionDDb(double* const pProj,
double* const pVolume,
double* const pTubeAngle,
double* const pDetAngle,
const int x_offset,
const int y_offset,
const int nProj,
const int nPixX,
const int nPixY,
Expand Down Expand Up @@ -167,9 +172,9 @@ void projectionDDb(double* const pProj,

mapBoudaries(pDetZ, nDetYMap, 0.0, 0.0, 0.0);

mapBoudaries(pObjX, nPixXMap, (double)nPixX, -dx, 0.0);
mapBoudaries(pObjX, nPixXMap, (double)nPixX, -dx, x_offset);

mapBoudaries(pObjY, nPixYMap, nPixY / 2.0, dy, 0.0);
mapBoudaries(pObjY, nPixYMap, nPixY / 2.0, dy, y_offset);

mapBoudaries(pObjZ, nSlices, 0.0, dz, DAG + (dz / 2.0));

Expand Down

0 comments on commit 1af5902

Please sign in to comment.