Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions generate_cartesian_shepp_logan_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,24 +43,24 @@ def create(filename='testdata.h5', matrix_size=256, coils=8, oversampling=2, rep
header.acquisitionSystemInformation = sys

# Encoding
encoding = ismrmrd.xsd.encoding()
encoding.trajectory = ismrmrd.xsd.trajectoryType.cartesian
encoding = ismrmrd.xsd.encodingType()
encoding.trajectory = ismrmrd.xsd.trajectoryType.CARTESIAN

# encoded and recon spaces
efov = ismrmrd.xsd.fieldOfView_mm()
efov = ismrmrd.xsd.fieldOfViewMm()
efov.x = oversampling*256
efov.y = 256
efov.z = 5
rfov = ismrmrd.xsd.fieldOfView_mm()
rfov = ismrmrd.xsd.fieldOfViewMm()
rfov.x = 256
rfov.y = 256
rfov.z = 5

ematrix = ismrmrd.xsd.matrixSize()
ematrix = ismrmrd.xsd.matrixSizeType()
ematrix.x = nkx
ematrix.y = nky
ematrix.z = 1
rmatrix = ismrmrd.xsd.matrixSize()
rmatrix = ismrmrd.xsd.matrixSizeType()
rmatrix.x = nx
rmatrix.y = ny
rmatrix.z = 1
Expand Down Expand Up @@ -107,7 +107,7 @@ def create(filename='testdata.h5', matrix_size=256, coils=8, oversampling=2, rep
encoding.encodingLimits = limits
header.encoding.append(encoding)

dset.write_xml_header(header.toxml('utf-8'))
dset.write_xml_header(header.toXML('utf-8'))

# Synthesize the k-space data
Ktrue = transform.transform_image_to_kspace(coil_images,(1,2))
Expand Down
8 changes: 4 additions & 4 deletions recon_ismrmrd_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from ismrmrdtools import show, transform

# Load file
filename = '/tmp/testdata.h5'
filename = 'testdata.h5'
if not os.path.isfile(filename):
print("%s is not a valid file" % filename)
raise SystemExit
Expand Down Expand Up @@ -77,11 +77,11 @@
# Remove oversampling if needed
if eNx != rNx:
xline = transform.transform_kspace_to_image(acq.data, [1])
x0 = (eNx - rNx) / 2
x1 = (eNx - rNx) / 2 + rNx
x0 = int((eNx - rNx) / 2)
x1 = int((eNx - rNx) / 2 + rNx)
xline = xline[:,x0:x1]
acq.resize(rNx,acq.active_channels,acq.trajectory_dimensions)
acq.center_sample = rNx/2
acq.center_sample = int(rNx/2)
# need to use the [:] notation here to fill the data
acq.data[:] = transform.transform_image_to_kspace(xline, [1])

Expand Down