def test_set_head(): acq = ismrmrd.Acquisition() head = ismrmrd.AcquisitionHeader() nsamples, nchannels, ntrajdims = 128, 8, 3 head.number_of_samples = nsamples head.active_channels = nchannels head.trajectory_dimensions = ntrajdims acq.setHead(head) eq_(acq.data.shape, (nchannels, nsamples)) eq_(acq.traj.shape, (nsamples, ntrajdims))
def test_header(): head = ismrmrd.AcquisitionHeader() eq_(ctypes.sizeof(head), 340)
noiselevel = 0.05 K = np.zeros((nX, nY, ncoils, nreps), dtype=np.complex64) for rep in range(nreps): for coil in range(ncoils): noise = noiselevel * (np.random.randn(nX, nY) + 1j * np.random.randn(nX, nY)) K[:, :, coil, rep] = np.fft.fftshift( np.fft.fft2(np.fft.fftshift(C[:, :, coil] * rho + noise))) rep0 = np.sqrt(np.sum(np.abs(K)**2, 2)) plt.imshow(rep0[:, :, 0]) for rep in range(nreps): for line in range(nY): # Generate header head = ismrmrd.AcquisitionHeader() counter = ismrmrd.EncodingCounters() head.version = 1 head.number_of_samples = nX head.center_sample = nX / 2 head.active_channels = ncoils head.read_dir = [1., 0., 0.] head.phase_dir = [0., 1., 0.] head.slice_dir = [0., 0., 1.] head.scan_counter = rep * nY + line counter.kspace_encode_step_1 = line counter.repetition = rep head.idx = counter # Note: the correct API for setting Acquisition flags looks like this: # acq.setFlag(ismrmrd.FlagBit(ismrmrd.ACQ_FIRST_IN_ENCODE_STEP1)) # but using this API would require using only ugly "acq.setXXX" methods