summaryrefslogtreecommitdiffstats
path: root/include/astra
diff options
context:
space:
mode:
authorWillem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl>2017-09-18 11:12:38 +0200
committerWillem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl>2017-09-18 11:19:55 +0200
commitd5b31702671ec2f22e43beb9dac3613fe145cf4a (patch)
tree964425d92d4d535e4a7feeb7bd123bfbc121e755 /include/astra
parent55b2cd9192ecd36d33155161023c6d55b8811408 (diff)
downloadastra-d5b31702671ec2f22e43beb9dac3613fe145cf4a.tar.gz
astra-d5b31702671ec2f22e43beb9dac3613fe145cf4a.tar.bz2
astra-d5b31702671ec2f22e43beb9dac3613fe145cf4a.tar.xz
astra-d5b31702671ec2f22e43beb9dac3613fe145cf4a.zip
Fix boundary issues in fan_line
Diffstat (limited to 'include/astra')
-rw-r--r--include/astra/FanFlatBeamLineKernelProjector2D.inl34
1 files changed, 17 insertions, 17 deletions
diff --git a/include/astra/FanFlatBeamLineKernelProjector2D.inl b/include/astra/FanFlatBeamLineKernelProjector2D.inl
index 51dc878..5c8eddf 100644
--- a/include/astra/FanFlatBeamLineKernelProjector2D.inl
+++ b/include/astra/FanFlatBeamLineKernelProjector2D.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 CFanFlatBeamLineKernelProjector2D::project(Policy& p)
@@ -125,8 +125,8 @@ void CFanFlatBeamLineKernelProjector2D::projectBlock_internal(int _iProjFrom, in
// for each row
for (row = 0; row < rowCount; ++row, c += deltac) {
- col = int(c+0.5f);
- if (col <= 0 || col >= colCount-1) { if (!isin) continue; else break; }
+ col = int(floor(c+0.5f));
+ if (col < -1 || col > colCount) { if (!isin) continue; else break; }
offset = c - float32(col);
// left
@@ -134,10 +134,10 @@ void CFanFlatBeamLineKernelProjector2D::projectBlock_internal(int _iProjFrom, in
weight = (offset + T) * invTminSTimesLengthPerRow;
iVolumeIndex = row * colCount + col - 1;
- policy_weight(p, iRayIndex, iVolumeIndex, lengthPerRow-weight)
+ if (col > 0) { policy_weight(p, iRayIndex, iVolumeIndex, lengthPerRow-weight); }
iVolumeIndex++;
- policy_weight(p, iRayIndex, iVolumeIndex, weight)
+ if (col >= 0 && col < colCount) { policy_weight(p, iRayIndex, iVolumeIndex, weight); }
}
// right
@@ -145,16 +145,16 @@ void CFanFlatBeamLineKernelProjector2D::projectBlock_internal(int _iProjFrom, in
weight = (offset - S) * invTminSTimesLengthPerRow;
iVolumeIndex = row * colCount + col;
- policy_weight(p, iRayIndex, iVolumeIndex, lengthPerRow-weight)
+ if (col >= 0 && col < colCount) { policy_weight(p, iRayIndex, iVolumeIndex, lengthPerRow-weight); }
iVolumeIndex++;
- policy_weight(p, iRayIndex, iVolumeIndex, weight)
+ if (col + 1 < colCount) { policy_weight(p, iRayIndex, iVolumeIndex, weight); }
}
// centre
- else {
+ else if (col >= 0 && col < colCount) {
iVolumeIndex = row * colCount + col;
- policy_weight(p, iRayIndex, iVolumeIndex, lengthPerRow)
+ policy_weight(p, iRayIndex, iVolumeIndex, lengthPerRow);
}
isin = true;
}
@@ -169,8 +169,8 @@ void CFanFlatBeamLineKernelProjector2D::projectBlock_internal(int _iProjFrom, in
// for each col
for (col = 0; col < colCount; ++col, r += deltar) {
- int row = int(r+0.5f);
- if (row <= 0 || row >= rowCount-1) { if (!isin) continue; else break; }
+ row = int(floor(r+0.5f));
+ if (row < -1 || row > rowCount) { if (!isin) continue; else break; }
offset = r - float32(row);
// up
@@ -178,10 +178,10 @@ void CFanFlatBeamLineKernelProjector2D::projectBlock_internal(int _iProjFrom, in
weight = (offset + T) * invTminSTimesLengthPerCol;
iVolumeIndex = (row-1) * colCount + col;
- policy_weight(p, iRayIndex, iVolumeIndex, lengthPerCol-weight)
+ if (row > 0) { policy_weight(p, iRayIndex, iVolumeIndex, lengthPerCol-weight); }
iVolumeIndex += colCount;
- policy_weight(p, iRayIndex, iVolumeIndex, weight)
+ if (row >= 0 && row < rowCount) { policy_weight(p, iRayIndex, iVolumeIndex, weight); }
}
// down
@@ -189,16 +189,16 @@ void CFanFlatBeamLineKernelProjector2D::projectBlock_internal(int _iProjFrom, in
weight = (offset - S) * invTminSTimesLengthPerCol;
iVolumeIndex = row * colCount + col;
- policy_weight(p, iRayIndex, iVolumeIndex, lengthPerCol-weight)
+ if (row >= 0 && row < rowCount) { policy_weight(p, iRayIndex, iVolumeIndex, lengthPerCol-weight); }
iVolumeIndex += colCount;
- policy_weight(p, iRayIndex, iVolumeIndex, weight)
+ if (row + 1 < rowCount) { policy_weight(p, iRayIndex, iVolumeIndex, weight); }
}
// centre
- else {
+ else if (row >= 0 && row < rowCount) {
iVolumeIndex = row * colCount + col;
- policy_weight(p, iRayIndex, iVolumeIndex, lengthPerCol)
+ policy_weight(p, iRayIndex, iVolumeIndex, lengthPerCol);
}
isin = true;
}