You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: unxform_nii.m
    path of file: ./repos/malini/NIFTI
    
    the code of the file until where you have to start completion: %  Undo the flipping and rotations performed by xform_nii; spit back only
%  the raw img data block. Initial cut will
    
function outblock = unxform_nii(nii, inblock)
  
   if isempty(nii.hdr.hist.rot_orient)     
      outblock=inblock;
   else
      [dummy unrotate_orient] = sort(nii.hdr.hist.rot_orient);
      outblock = permute(inblock, unrotate_orient);
   end