function p = picpermute(imagedata)

%p = reshape(permute(imagedata, [1 3 2]),[size(imagedata,1)*size(imagedata,2) 3 1]);
p(:,:,1) = reshape(imagedata(:,:,1),[size(imagedata,1)*size(imagedata,2) 1 1]);
p(:,:,2) = reshape(imagedata(:,:,2),[size(imagedata,1)*size(imagedata,2) 1 1]);
p(:,:,3) = reshape(imagedata(:,:,3),[size(imagedata,1)*size(imagedata,2) 1 1]);

p = permute(p,[1 3 2]);