Skip to content

Commit

Permalink
Refactoring Matlab FDK and FBP
Browse files Browse the repository at this point in the history
* Moved transposing projections into filtering
  • Loading branch information
tsadakane committed May 29, 2023
1 parent 46157e4 commit aed4379
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
1 change: 0 additions & 1 deletion MATLAB/Algorithms/FBP.m
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@

%% Weight
%proj=data
proj=permute(proj,[2 1 3]);

%% filter
proj_filt = filtering(proj,geo,angles,parker); % Not sure if offsets are good in here
Expand Down
6 changes: 2 additions & 4 deletions MATLAB/Algorithms/FDK.m
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,7 @@
end

%% Weight
proj=permute(proj,[2 1 3]);
for ii=1:size(angles,2)

us = ((-geo.nDetector(1)/2+0.5):1:(geo.nDetector(1)/2-0.5))*geo.dDetector(1) + offset(1,ii);
vs = ((-geo.nDetector(2)/2+0.5):1:(geo.nDetector(2)/2-0.5))*geo.dDetector(2) + offset(2,ii);
[uu,vv] = meshgrid(us,vs); % detector
Expand All @@ -70,10 +68,10 @@
w = (geo.DSD(ii))./sqrt((geo.DSD(ii))^2+uu.^2 + vv.^2);

% Multiply the weights with projection data
proj(:,:,ii) = proj(:,:,ii).*w';
proj(:,:,ii) = w.*proj(:,:,ii);
end
%% Fourier transform based filtering
proj = filtering(proj,geo,angles,parker, 'usegpufft', usegpufft, 'gpuids', gpuids); % Not sure if offsets are good in here
proj = filtering(proj,geo,angles,parker); % Not sure if offsets are good in here

% RMFIELD Remove fields from a structure array.
geo=rmfield(geo,'filter');
Expand Down
4 changes: 3 additions & 1 deletion MATLAB/Utilities/filtering.m
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
[usegpufft,gpuids]=parse_inputs(varargin);

if parker
proj = permute(ParkerWeight(permute(proj,[2 1 3]),geo,angles,parker),[2 1 3]);
proj = ParkerWeight(proj,geo,angles,parker);
diff_angles = diff(angles(1,:)); angle_step = mean(abs(diff_angles)); % to be used later
end

Expand All @@ -37,6 +37,8 @@
filt = repmat(filt',[1 geo.nDetector(2)]);
end

proj=permute(proj,[2 1 3]);

if usegpufft==2
bundle_size = 32; %len(gpuids)
n_bundles = floor((size(angles,2)+bundle_size-1)/bundle_size);
Expand Down

0 comments on commit aed4379

Please sign in to comment.