Created Function for reading and sampling 2D/3D image data

closes-#3544
I prefer to use `std::string::npos` to `full_file.npos`.  The latter makes it looks like npos depends on an object, when really it is a static constant value.