Forward transform

Updated image write method to construct the correct header. Added forward and inverse transform to the main file.