Skip to content
Snippets Groups Projects
Commit cc2ecf80 authored by Nicola Vigano's avatar Nicola Vigano
Browse files

6D-OSpaceSS-Reconstruction: experimental use of new downstream projector

parent a1ea7732
No related branches found
No related tags found
No related merge requests found
......@@ -16,6 +16,7 @@ classdef Gt6DVolumeProjector < handle
astra_projectors = {};
astra_ss_projectors = {};
use_astra_projectors = false;
use_astra_oss_projectors = false;
volume_id = [];
sinogram_ids = {};
......@@ -50,6 +51,14 @@ classdef Gt6DVolumeProjector < handle
if (~self.use_astra_projectors)
self.volume_id = astra_mex_data3d('create', '-vol', self.astra_volume_geometry, 0);
else
if (~isempty(self.ss_geometries))
try
self.use_astra_oss_projectors = astra_mex_direct_c('supports', 'FP3D_OSS') ...
&& astra_mex_direct_c('supports', 'BP3D_OSS');
catch
end
end
end
try
......@@ -150,7 +159,6 @@ classdef Gt6DVolumeProjector < handle
function ss_sinogram = fwd_project_single_volume_ss(self, volume, ii)
ss_geoms = self.astra_ss_projection_geometries{ii};
num_ss_geoms = numel(ss_geoms);
volume = volume ./ num_ss_geoms;
if (self.use_astra_projectors)
if (numel(volume) == 1)
volume = volume * ones(self.volume_geometry, 'single');
......@@ -160,23 +168,28 @@ classdef Gt6DVolumeProjector < handle
astra_mex_data3d('store', self.volume_id, volume);
end
ss_sinogram = cell(num_ss_geoms, 1);
for ii_ss = 1:num_ss_geoms
if (self.use_astra_projectors)
ss_sinogram{ii_ss} = astra_mex_direct_c('FP3D', ss_projectors{ii_ss}, volume);
else
sino_id = astra_mex_data3d('create', '-proj3d', ss_geoms{ii_ss}, 0);
if (self.use_astra_oss_projectors)
ss_sinogram = astra_mex_direct_c('FP3D_OSS', [ss_projectors{:}], volume);
else
volume = volume ./ num_ss_geoms;
ss_sinogram = cell(num_ss_geoms, 1);
for ii_ss = 1:num_ss_geoms
if (self.use_astra_projectors)
ss_sinogram{ii_ss} = astra_mex_direct_c('FP3D', ss_projectors{ii_ss}, volume);
else
sino_id = astra_mex_data3d('create', '-proj3d', ss_geoms{ii_ss}, 0);
cfg = astra_struct('FP3D_CUDA');
cfg.ProjectionDataId = sino_id;
cfg.VolumeDataId = self.volume_id;
cfg = astra_struct('FP3D_CUDA');
cfg.ProjectionDataId = sino_id;
cfg.VolumeDataId = self.volume_id;
algo_id = astra_mex_algorithm('create', cfg);
astra_mex_algorithm('iterate', algo_id);
astra_mex_algorithm('delete', algo_id);
algo_id = astra_mex_algorithm('create', cfg);
astra_mex_algorithm('iterate', algo_id);
astra_mex_algorithm('delete', algo_id);
ss_sinogram{ii_ss} = astra_mex_data3d('get_single', sino_id);
astra_mex_data3d('delete', sino_id);
ss_sinogram{ii_ss} = astra_mex_data3d('get_single', sino_id);
astra_mex_data3d('delete', sino_id);
end
end
end
end
......@@ -188,26 +201,30 @@ classdef Gt6DVolumeProjector < handle
ss_projectors = self.astra_ss_projectors{ii};
end
volume = cell(num_ss_geoms, 1);
for ii_ss = 1:num_ss_geoms
if (self.use_astra_projectors)
volume{ii_ss} = astra_mex_direct_c('BP3D', ss_projectors{ii_ss}, ss_sinogram{ii_ss});
else
sino_id = astra_mex_data3d('create', '-proj3d', ss_geoms{ii_ss}, ss_sinogram{ii_ss});
if (self.use_astra_oss_projectors)
volume = astra_mex_direct_c('BP3D_OSS', [ss_projectors{:}], ss_sinogram);
else
volume = cell(num_ss_geoms, 1);
for ii_ss = 1:num_ss_geoms
if (self.use_astra_projectors)
volume{ii_ss} = astra_mex_direct_c('BP3D', ss_projectors{ii_ss}, ss_sinogram{ii_ss});
else
sino_id = astra_mex_data3d('create', '-proj3d', ss_geoms{ii_ss}, ss_sinogram{ii_ss});
cfg = astra_struct('BP3D_CUDA');
cfg.ProjectionDataId = sino_id;
cfg.ReconstructionDataId = self.volume_id;
cfg = astra_struct('BP3D_CUDA');
cfg.ProjectionDataId = sino_id;
cfg.ReconstructionDataId = self.volume_id;
algo_id = astra_mex_algorithm('create', cfg);
astra_mex_algorithm('iterate', algo_id);
astra_mex_algorithm('delete', algo_id);
algo_id = astra_mex_algorithm('create', cfg);
astra_mex_algorithm('iterate', algo_id);
astra_mex_algorithm('delete', algo_id);
volume{ii_ss} = astra_mex_data3d('get_single', self.volume_id);
astra_mex_data3d('delete', sino_id);
volume{ii_ss} = astra_mex_data3d('get_single', self.volume_id);
astra_mex_data3d('delete', sino_id);
end
end
volume = gtMathsSumCellVolumes(volume) ./ num_ss_geoms;
end
volume = gtMathsSumCellVolumes(volume) ./ num_ss_geoms;
end
function sinogram = fwd_project_single_volume(self, volume, geom_idx)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment