First version of spinImages port from Matlab to C++