def rads2radsec(in_file, delta_te, out_file=None):
 import numpy as np
 import nibabel as nb
 import os.path as op
 import math
 if (out_file is None):
  (fname, fext) = op.splitext(op.basename(in_file))
  if (fext == u'.gz'):
   (fname, _) = op.splitext(fname)
  out_file = op.abspath((u'./%s_radsec.nii.gz' % fname))
 im = nb.load(in_file)
 data = (im.get_data().astype(np.float32) * (1.0 / delta_te))
 nb.Nifti1Image(data, im.affine, im.header).to_filename(out_file)
 return out_file

def rads2radsec ( in_file , delta_te , out_file = None ) : import numpy as np import nibabel as nb import os . path as op import math if ( out_file is None ) : ( fname , fext ) = op . splitext ( op . basename ( in_file ) ) if ( fext == u'.gz' ) : ( fname , _ ) = op . splitext ( fname ) out_file = op . abspath ( ( u'./%s_radsec.nii.gz' % fname ) ) im = nb . load ( in_file ) data = ( im . get_data ( ) . astype ( np . float32 ) * ( 1.0 / delta_te ) ) nb . Nifti1Image ( data , im . affine , im . header ) . to_filename ( out_file ) return out_file
converts input phase difference map to rads .