Skip to content

Commit 6b3e831

Browse files
authored
Merge pull request #736 from CERN/revert-666-offSource
Revert "added "offSource" to adjust the position of X-ray source"
2 parents eac6873 + fc6ce95 commit 6b3e831

12 files changed

Lines changed: 21 additions & 106 deletions

Common/CUDA/Siddon_projection.cu

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -668,11 +668,9 @@ void computeDeltas_Siddon(Geometry geo,int i, Point3D* uvorigin, Point3D* deltaU
668668

669669
Point3D S;
670670
S.x=geo.DSO[i];
671-
//S.y=0;
672-
//S.z=0;
673-
S.y=geo.offSourceY[i];
674-
S.z=geo.offSourceZ[i];
675-
671+
S.y=0;
672+
S.z=0;
673+
676674
//End point
677675
Point3D P,Pu0,Pv0;
678676

Common/CUDA/ray_interpolated_projection.cu

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -632,11 +632,9 @@ void splitImageInterp(unsigned int splits,Geometry geo,Geometry* geoArray, unsig
632632
void computeDeltas(Geometry geo,unsigned int i, Point3D* uvorigin, Point3D* deltaU, Point3D* deltaV, Point3D* source){
633633
Point3D S;
634634
S.x=geo.DSO[i];
635-
//S.y=0;
636-
//S.z=0;
637-
S.y=geo.offSourceY[i];
638-
S.z=geo.offSourceZ[i];
639-
635+
S.y=0;
636+
S.z=0;
637+
640638
//End point
641639
Point3D P,Pu0,Pv0;
642640

Common/CUDA/types_TIGRE.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ struct Geometry {
6363
float sDetecU, sDetecV;
6464
float dDetecU, dDetecV;
6565
float *offDetecU, *offDetecV;
66-
float *offSourceY,*offSourceZ;
6766
float* DSD;
6867
float* dRoll;
6968
float* dPitch;
@@ -107,4 +106,4 @@ struct Point3Ddouble{
107106
}
108107
};
109108

110-
#endif
109+
#endif

Common/CUDA/voxel_backprojection.cu

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -871,8 +871,8 @@ void computeDeltasCube(Geometry geo,int i, Point3D* xyzorigin, Point3D* deltaX,
871871
//Done for P, now source
872872
Point3Ddouble source;
873873
source.x=geo.DSD[i]; //already offseted for rotation
874-
source.y=geo.offSourceY[i]-geo.offDetecU[i];
875-
source.z=geo.offSourceZ[i]-geo.offDetecV[i];
874+
source.y=-geo.offDetecU[i];
875+
source.z=-geo.offDetecV[i];
876876
rollPitchYawT(geo,i,&source);
877877

878878
source.x=source.x-(geo.DSD[i]-geo.DSO[i]);// source.y=source.y-auxOff.y; source.z=source.z-auxOff.z;

Common/CUDA/voxel_backprojection2.cu

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -793,8 +793,8 @@ void computeDeltasCube(Geometry geo,int i, Point3D* xyzorigin, Point3D* deltaX,
793793
//Done for P, now source
794794
Point3Ddouble source;
795795
source.x=geo.DSD[i]; //already offseted for rotation
796-
source.y=geo.offSourceY[i]-geo.offDetecU[i];
797-
source.z=geo.offSourceZ[i]-geo.offDetecV[i];
796+
source.y=-geo.offDetecU[i];
797+
source.z=-geo.offDetecV[i];
798798
rollPitchYawT(geo,i,&source);
799799

800800

MATLAB/Demos/d01_CreateGeometry.m

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@
7777
geo.sVoxel=[256;256;256]; % total size of the image (mm)
7878
geo.dVoxel=geo.sVoxel./geo.nVoxel; % size of each voxel (mm)
7979
% Offsets
80-
geo.offSource = [0;0];
8180
geo.offOrigin =[0;0;0]; % Offset of image from origin (mm)
8281
geo.offDetector=[0; 0]; % Offset of Detector (mm)
8382
% These two can be also defined

MATLAB/Demos/d025_OffsetSource.m

Lines changed: 0 additions & 45 deletions
This file was deleted.

MATLAB/Utilities/checkGeo.m

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
'DSO','DSD'};
77

88
geofields_optional={'offOrigin','offDetector','rotDetector','COR',...
9-
'mode','accuracy','offSource'};
9+
'mode','accuracy'};
1010
allfields=horzcat(geofields_mandatory,geofields_optional);
1111
fnames=fieldnames(geo);
1212
% Find if geo has fields we do not recongize
@@ -128,14 +128,5 @@
128128
end
129129

130130

131-
if isfield(geo,'offSource')
132-
assert(isequal(size(geo.offSource),[2 1]) | isequal(size(geo.offSource),[2 size(angles,2)]),'TIGRE:checkGeo:BadGeometry','geo.offSource Should be 2x1 or 2xsize(angles,2)')
133-
assert(isa(geo.offSource,'double'),'TIGRE:checkGeo:BadGeometry','Field geo.offSource is not double type.' )
134-
if isequal(size(geo.offSource),[2 1])
135-
geo.offSource=repmat(geo.offSource,[1, size(angles,2)]);
136-
end
137-
else
138-
geo.offSource=zeros(2,size(angles,2));
139-
end
140131
end
141132

MATLAB/Utilities/computeV.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
auxgeo.DSD = geo.DSD(auxindex);
2525
auxgeo.DSO = geo.DSO(auxindex);
2626
auxgeo.offOrigin = geo.offOrigin(:,auxindex);
27-
auxgeo.offSource = geo.offSource(:,auxindex);
2827
auxgeo.offDetector = geo.offDetector(:,auxindex);
2928
auxgeo.rotDetector = geo.rotDetector(:,auxindex);
3029
auxgeo.COR = geo.COR(auxindex);
@@ -54,3 +53,4 @@
5453
gpuids=p.Results.gpuids;
5554
end
5655
end
56+

MATLAB/Utilities/cuda_interface/Atb_mex.cpp

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ void mexFunction(int nlhs , mxArray *plhs[],
165165
mxArray * geometryMex=(mxArray*)prhs[1];
166166

167167
// IMPORTANT-> Make sure Matlab creates the struct in this order.
168-
const char *fieldnames[15];
168+
const char *fieldnames[14];
169169
fieldnames[0] = "nVoxel";
170170
fieldnames[1] = "sVoxel";
171171
fieldnames[2] = "dVoxel";
@@ -180,7 +180,6 @@ void mexFunction(int nlhs , mxArray *plhs[],
180180
fieldnames[11]= "mode";
181181
fieldnames[12]= "COR";
182182
fieldnames[13]= "rotDetector";
183-
fieldnames[14]= "offSource";
184183
// Make sure input is structure
185184

186185
mxArray *tmp;
@@ -190,13 +189,13 @@ void mexFunction(int nlhs , mxArray *plhs[],
190189

191190
double * nVoxel, *nDetec; //we need to cast these to int
192191
double * sVoxel, *dVoxel,*sDetec,*dDetec, *DSO, *DSD,*offOrig,*offDetec;
193-
double *acc, *COR,*rotDetector,*offSource;
192+
double *acc, *COR,*rotDetector;
194193
const char* mode;
195194
bool coneBeam=true;
196195
Geometry geo;
197196
int c;
198197
geo.unitX=1;geo.unitY=1;geo.unitZ=1;
199-
for(int ifield=0; ifield<15; ifield++) {
198+
for(int ifield=0; ifield<14; ifield++) {
200199
tmp=mxGetField(geometryMex,0,fieldnames[ifield]);
201200
if(tmp==NULL){
202201
//tofix
@@ -315,17 +314,6 @@ void mexFunction(int nlhs , mxArray *plhs[],
315314

316315
}
317316
break;
318-
case 14:
319-
geo.offSourceY=(float*)malloc(nangles * sizeof(float));
320-
geo.offSourceZ=(float*)malloc(nangles * sizeof(float));
321-
322-
offSource=(double *)mxGetData(tmp);
323-
for (int i=0;i<nangles;i++){
324-
c=i;
325-
geo.offSourceY[i]=(float)offSource[0+2*c];
326-
geo.offSourceZ[i]=(float)offSource[1+2*c];
327-
}
328-
break;
329317
default:
330318
mexErrMsgIdAndTxt( "CBCT:MEX:Atb:unknown","This should not happen. Weird");
331319
break;

0 commit comments

Comments
 (0)