Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spectroscopy: Converted file contains 2080 data points instead of 2048 #138

Open
darrencl opened this issue Nov 8, 2024 · 0 comments
Open

Comments

@darrencl
Copy link

darrencl commented Nov 8, 2024

Hi all,

Thanks for creating this tool.

We are trying to use this tool to convert our spectroscopy TWIX data to ISMRMRD. Upon further inspection, the number of channels seems to be correct, but the number of data points is not.

We would expect to have 2048 array in each channel and acquisition, but it has 2080 for some reason when loading via ismrmrd-python.
When comparing against the data loaded using suspect, we also found that the actual complex numbers are rounded – this might not be an issue, but it's worth noting for future reader.

In [207]: twix[0,0,0] # suspect's
Out[207]: np.complex128(-5.602138116955757e-06-1.1758645996451378e-05j)

In [208]: f.read_acquisition(4).data[0, 0]
Out[208]: np.complex64(-5.602138e-06+1.1758646e-05j)

In [209]: twix[0,0,-1]
Out[209]: np.complex128(2.2049061954021454e-07+5.906913429498672e-07j)

In [210]: f.read_acquisition(4).data[0, 2047]
Out[210]: np.complex64(2.2049062e-07-5.9069134e-07j)

Now from that taking the first-2048 seems to be okay, but we have tested this in another dataset and the 2048 data are in the index 12:2060 (example below).

I have a couple of questions in regards to this:

  1. Is there any explanation as to why it contains 2080 data points instead of 2048?
  2. Is there any way we can get that 'offset'? e.g., in our second dataset the 2048 data started from index 12, so that seems random to me.
In [21]: f.read_acquisition(1).data[0, 12:2060]
Out[21]:
array([-7.6105352e-06+1.2077391e-05j, -1.1375640e-05+1.3110228e-05j,
       -1.4022691e-05+1.6696751e-05j, ...,  1.2526289e-07+5.0617382e-07j,
       -3.6135316e-07-8.4377825e-07j, -7.7532604e-08-5.6857243e-07j],
      dtype=complex64)

In [22]: twix[0,0] # suspect's
Out[22]:
MRSData([-7.61053525e-06-1.20773911e-05j, -1.13756396e-05-1.31102279e-05j,
         -1.40226912e-05-1.66967511e-05j, ...,
          1.25262886e-07-5.06173819e-07j, -3.61353159e-07+8.43778253e-07j,
         -7.75326043e-08+5.68572432e-07j])

In [23]: f.read_acquisition(2).data[0, 12:2060]
Out[23]:
array([-7.2314870e-06+1.2506265e-05j, -1.2170756e-05+1.3003359e-05j,
       -1.2640376e-05+1.5741447e-05j, ...,  2.6891939e-07-1.1231750e-06j,
        8.9406967e-08-7.8557059e-07j,  1.9115396e-07+1.5669502e-07j],
      dtype=complex64)

In [24]: twix[1,0] # suspect's
Out[24]:
MRSData([-7.23148696e-06-1.25062652e-05j, -1.21707562e-05-1.30033586e-05j,
         -1.26403756e-05-1.57414470e-05j, ...,
          3.68919393e-07+1.12317502e-06j,  8.94069672e-08+7.85570592e-07j,
          1.91153958e-07-1.56695023e-07j])

Cc @budij

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant