diff options
author | Edoardo Pasca <edo.paskino@gmail.com> | 2017-10-25 10:56:57 +0100 |
---|---|---|
committer | Edoardo Pasca <edo.paskino@gmail.com> | 2017-10-25 10:56:57 +0100 |
commit | c21df8581e052541a2dd39a46a4c1f50e335fd9e (patch) | |
tree | 5c8f755f910a9b5006791e715328242f68fbe504 /supp | |
parent | 31097954f87d0f30f667b29a12f7098710c284ab (diff) | |
parent | 455ca86825c157512f61441d3d27b8148ca795a7 (diff) | |
download | regularization-c21df8581e052541a2dd39a46a4c1f50e335fd9e.tar.gz regularization-c21df8581e052541a2dd39a46a4c1f50e335fd9e.tar.bz2 regularization-c21df8581e052541a2dd39a46a4c1f50e335fd9e.tar.xz regularization-c21df8581e052541a2dd39a46a4c1f50e335fd9e.zip |
Merge branch origin/pythonize into pythonize
Diffstat (limited to 'supp')
-rw-r--r-- | supp/sino_add_artifacts.m | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/supp/sino_add_artifacts.m b/supp/sino_add_artifacts.m new file mode 100644 index 0000000..f601914 --- /dev/null +++ b/supp/sino_add_artifacts.m @@ -0,0 +1,33 @@ +function sino_artifacts = sino_add_artifacts(sino,artifact_type) +% function to add various distortions to the sinogram space, current +% version includes: random rings and zingers (streaks) +% Input: +% 1. sinogram +% 2. artifact type: 'rings' or 'zingers' (streaks) + + +[Detectors, anglesNumb, SlicesZ] = size(sino); +fprintf('%s %i %s %i %s %i %s \n', 'Sinogram has a dimension of', Detectors, 'detectors;', anglesNumb, 'projections;', SlicesZ, 'vertical slices.'); + +sino_artifacts = sino; + +if (strcmp(artifact_type,'rings')) + fprintf('%s \n', 'Adding rings...'); + NumRings = round(Detectors/20); % Number of rings relatively to the size of Detectors + IntenOff = linspace(0.05,0.5,NumRings); % the intensity of rings in the selected range + + for k = 1:SlicesZ + % generate random indices to propagate rings + RandInd = randperm(Detectors,Detectors); + for jj = 1:NumRings + ind_c = RandInd(jj); + sino_artifacts(ind_c,1:end,k) = sino_artifacts(ind_c,1:end,k) + IntenOff(jj).*sino_artifacts(ind_c,1:end,k); % generate a constant offset + end + + end +elseif (strcmp(artifact_type,'zingers')) + fprintf('%s \n', 'Adding zingers...'); +else + fprintf('%s \n', 'Nothing selected, the same sinogram returned...'); +end +end
\ No newline at end of file |