Integrated sampling functions
Added sampling of 3-channel images
Ensured ignored return values are not calculated
Implemented array_splice()