First add the image_sort directory to the matlab path.
Run the script demo_sort.m to see how the image pixel sorting works.