diff options
| author | Willem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl> | 2017-09-15 17:37:37 +0200 | 
|---|---|---|
| committer | Willem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl> | 2017-09-15 18:29:21 +0200 | 
| commit | 514f3610e61fd14f237fdd1981b45c6cf3037b21 (patch) | |
| tree | 1c8d92b5c1570b5098a5d1bf81922c2abc069094 | |
| parent | aa31a06235496c0d808e57c8ce914cb4b640bc6e (diff) | |
| download | astra-514f3610e61fd14f237fdd1981b45c6cf3037b21.tar.gz astra-514f3610e61fd14f237fdd1981b45c6cf3037b21.tar.bz2 astra-514f3610e61fd14f237fdd1981b45c6cf3037b21.tar.xz astra-514f3610e61fd14f237fdd1981b45c6cf3037b21.zip | |
Fix boundary issues in par_line
| -rw-r--r-- | include/astra/ParallelBeamLineKernelProjector2D.inl | 28 | 
1 files changed, 14 insertions, 14 deletions
| diff --git a/include/astra/ParallelBeamLineKernelProjector2D.inl b/include/astra/ParallelBeamLineKernelProjector2D.inl index 83c16d7..6976cfd 100644 --- a/include/astra/ParallelBeamLineKernelProjector2D.inl +++ b/include/astra/ParallelBeamLineKernelProjector2D.inl @@ -210,8 +210,8 @@ void CParallelBeamLineKernelProjector2D::projectBlock_internal(int _iProjFrom, i  				// loop rows  				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 @@ -220,14 +220,14 @@ void CParallelBeamLineKernelProjector2D::projectBlock_internal(int _iProjFrom, i  						iVolumeIndex = row * colCount + col - 1;  						// POLICY: PIXEL PRIOR + ADD + POSTERIOR -						if (p.pixelPrior(iVolumeIndex)) { +						if (col > 0 && p.pixelPrior(iVolumeIndex)) {  							p.addWeight(iRayIndex, iVolumeIndex, lengthPerRow-weight);  							p.pixelPosterior(iVolumeIndex);  						}  						iVolumeIndex++;  						// POLICY: PIXEL PRIOR + ADD + POSTERIOR -						if (p.pixelPrior(iVolumeIndex)) { +						if (col >= 0 && col < colCount && p.pixelPrior(iVolumeIndex)) {  							p.addWeight(iRayIndex, iVolumeIndex, weight);  							p.pixelPosterior(iVolumeIndex);  						} @@ -239,21 +239,21 @@ void CParallelBeamLineKernelProjector2D::projectBlock_internal(int _iProjFrom, i  						iVolumeIndex = row * colCount + col;  						// POLICY: PIXEL PRIOR + ADD + POSTERIOR -						if (p.pixelPrior(iVolumeIndex)) { +						if (col >= 0 && col < colCount && p.pixelPrior(iVolumeIndex)) {  							p.addWeight(iRayIndex, iVolumeIndex, lengthPerRow-weight);  							p.pixelPosterior(iVolumeIndex);  						}  						iVolumeIndex++;  						// POLICY: PIXEL PRIOR + ADD + POSTERIOR -						if (p.pixelPrior(iVolumeIndex)) { +						if (col + 1 < colCount && p.pixelPrior(iVolumeIndex)) {  							p.addWeight(iRayIndex, iVolumeIndex, weight);  							p.pixelPosterior(iVolumeIndex);  						}  					}  					// centre -					else { +					else if (col >= 0 && col < colCount) {  						iVolumeIndex = row * colCount + col;  						// POLICY: PIXEL PRIOR + ADD + POSTERIOR  						if (p.pixelPrior(iVolumeIndex)) { @@ -274,8 +274,8 @@ void CParallelBeamLineKernelProjector2D::projectBlock_internal(int _iProjFrom, i  				// loop columns  				for (col = 0; col < colCount; ++col, r += deltar) { -					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 @@ -283,10 +283,10 @@ void CParallelBeamLineKernelProjector2D::projectBlock_internal(int _iProjFrom, i  						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 @@ -294,14 +294,14 @@ void CParallelBeamLineKernelProjector2D::projectBlock_internal(int _iProjFrom, i  						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)  					} | 
