diff options
author | Willem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl> | 2017-09-18 15:49:38 +0200 |
---|---|---|
committer | Willem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl> | 2017-09-18 15:49:38 +0200 |
commit | a40b6c9948cfc461f25f8f4878fb4ca671ca5107 (patch) | |
tree | 2200ea56d6f1cf51944e38fcf3df18299278b677 /include/astra | |
parent | d5b31702671ec2f22e43beb9dac3613fe145cf4a (diff) | |
download | astra-a40b6c9948cfc461f25f8f4878fb4ca671ca5107.tar.gz astra-a40b6c9948cfc461f25f8f4878fb4ca671ca5107.tar.bz2 astra-a40b6c9948cfc461f25f8f4878fb4ca671ca5107.tar.xz astra-a40b6c9948cfc461f25f8f4878fb4ca671ca5107.zip |
Fix boundary issues in par_linear
Diffstat (limited to 'include/astra')
-rw-r--r-- | include/astra/ParallelBeamLinearKernelProjector2D.inl | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/include/astra/ParallelBeamLinearKernelProjector2D.inl b/include/astra/ParallelBeamLinearKernelProjector2D.inl index 2619a12..fc5935a 100644 --- a/include/astra/ParallelBeamLinearKernelProjector2D.inl +++ b/include/astra/ParallelBeamLinearKernelProjector2D.inl @@ -25,7 +25,7 @@ along with the ASTRA Toolbox. If not, see <http://www.gnu.org/licenses/>. ----------------------------------------------------------------------- */ -#define policy_weight(p,rayindex,volindex,weight) if (p.pixelPrior(volindex)) { p.addWeight(rayindex, volindex, weight); p.pixelPosterior(volindex); } +#define policy_weight(p,rayindex,volindex,weight) do { if (p.pixelPrior(volindex)) { p.addWeight(rayindex, volindex, weight); p.pixelPosterior(volindex); } } while (false) template <typename Policy> void CParallelBeamLinearKernelProjector2D::project(Policy& p) @@ -192,15 +192,15 @@ void CParallelBeamLinearKernelProjector2D::projectBlock_internal(int _iProjFrom, // loop rows for (row = 0; row < rowCount; ++row, c += deltac) { - col = int(c); - if (col <= 0 || col >= colCount-1) { if (!isin) continue; else break; } + col = int(floor(c)); + if (col < -1 || col >= colCount) { if (!isin) continue; else break; } offset = c - float32(col); iVolumeIndex = row * colCount + col; - policy_weight(p, iRayIndex, iVolumeIndex, (1.0f - offset) * lengthPerRow) + if (col >= 0) { policy_weight(p, iRayIndex, iVolumeIndex, (1.0f - offset) * lengthPerRow); } iVolumeIndex++; - policy_weight(p, iRayIndex, iVolumeIndex, offset * lengthPerRow) + if (col + 1 < colCount) { policy_weight(p, iRayIndex, iVolumeIndex, offset * lengthPerRow); } isin = true; } @@ -215,15 +215,15 @@ void CParallelBeamLinearKernelProjector2D::projectBlock_internal(int _iProjFrom, // loop columns for (col = 0; col < colCount; ++col, r += deltar) { - row = int(r); - if (row <= 0 || row >= rowCount-1) { if (!isin) continue; else break; } + row = int(floor(r)); + if (row < -1 || row >= rowCount) { if (!isin) continue; else break; } offset = r - float32(row); iVolumeIndex = row * colCount + col; - policy_weight(p, iRayIndex, iVolumeIndex, (1.0f - offset) * lengthPerCol) + if (row >= 0) { policy_weight(p, iRayIndex, iVolumeIndex, (1.0f - offset) * lengthPerCol); } iVolumeIndex += colCount; - policy_weight(p, iRayIndex, iVolumeIndex, offset * lengthPerCol) + if (row + 1 < rowCount) { policy_weight(p, iRayIndex, iVolumeIndex, offset * lengthPerCol); } isin = true; } |