示例#1
0
 def forward( self, im ):
     im   = np.fft.fftshift(im,self.axes)         
     ksp  = np.fft.fft2(im,s=None,axes=self.axes)
     ksp  = np.fft.ifftshift(ksp,self.axes)
     #try to match the dims of ksp and mask
     if len(ksp.shape) is not len(self.mask.shape):
         #try to match the dimensions of ksp and mask
         ksp_out_shape, mask_out_shape = dim_match(ksp.shape, self.mask.shape)
         mksp = np.multiply(ksp.reshape(ksp_out_shape),\
                      self.mask.reshape(mask_out_shape))#apply mask
     else:
         mksp = np.multiply(ksp,self.mask)#apply mask
     return mksp
示例#2
0
def allcoil_nufft(ktraj, dcf, kdata, ncoils, im_shape):
    im = np.zeros((im_shape[0], im_shape[1], im_shape[2], ncoils),
                  dtype=kdata.dtype)
    kdatashape, dcfshape = ut.dim_match(kdata.shape, dcf.shape)
    kdata = np.multiply(kdata.reshape(kdatashape),
                        dcf.reshape(dcfshape)).squeeze()
    c = kdata.reshape((np.prod(kdata.shape[0:2]), ncoils)).squeeze()
    ktraj = np.pi * ktraj / ktraj.flatten().max()  #2.0 *
    x = ktraj[0, :].flatten()
    y = ktraj[1, :].flatten()
    z = ktraj[2, :].flatten()  #*(1.0*im_shape[0]/im_shape[2])
    #im    = nft.nufft3d1_gaussker(x, y, z, c, im_shape[0], im_shape[1], im_shape[2], df=1.0, eps=1E-5)
    im = nft_cuda.nufft3d1_gaussker_cuda(x,
                                         y,
                                         z,
                                         c,
                                         im_shape[0],
                                         im_shape[1],
                                         im_shape[2],
                                         df=1.0,
                                         eps=1E-5,
                                         gridfast=0)
    return im
示例#3
0
 def density_weighting( self, kdata, dcf ):
     kdatashape, dcfshape = dim_match(kdata.shape, dcf.shape)
     kdata                = np.multiply(kdata.reshape(kdatashape), dcf.reshape(dcfshape)).squeeze()
     return kdata
示例#4
0
 def forward( self, im_sos ):
     sens_out_shape, im_out_shape = dim_match(self.sens.shape,im_sos.shape)
     #appying sensitivity profile is sens*im
     return np.multiply(im_sos.reshape(im_out_shape),\
                     self.sens.reshape(sens_out_shape))
示例#5
0
 def backward( self, im_coils ):  
     sens_out_shape, im_out_shape = dim_match(self.sens.shape,im_coils.shape)
     # coil combination is sum(conj(sens)*im)
     return np.sum(np.multiply(im_coils.reshape(im_out_shape),\
                  np.conj(self.sens).reshape(sens_out_shape))\
                 , axis=self.coil_axis, keepdims = True)