Example:
If chunk size 32 then slices 0..4 and 28..31 shows no effect of the Paganin filtering.
For correct filtering one should use the chunks of sizes at least 48 (40 for ichunk=0 and ichunk=end-1), i.e. 0..40, 24..72, and cut them after filtering to get 0..32, 32..64, etc.