wtclarke / spec2nii

Multi-format in vivo MR spectroscopy conversion to NIFTI
Other
27 stars 23 forks source link

Siemens XA20 dat files not working with spec2nii #22

Closed karl-koschutnig closed 2 years ago

karl-koschutnig commented 2 years ago

We have acquired some spectro-data (Press) with our Siemens VIDA using the "new" XA20 Software. I just wanted to point out the the conversion with spec2nii is not possible at the moment. I had the same problem with a Matlab-bases software (Osprey). So I guess it is a kind of basic data problem. Here is my code + output:

spec2nii twix -v meas_MID00027_FID07653_svs_se_30_WS_on.dat pymapVBVD version 0.4.3 Software version: VD Contents of file: meas_MID00027_FID07653_svs_se_30_WS_on.dat
Multiraid file, 2 files found. Selecting file 2. Use -m option to change. The file contains these evalinfo flags with dimensions and sizes as follows: image : Col, Cha, Ave, Phs [2080 42 80 2]

spec2nii twix -e image meas_MID00027_FID07653_svs_se_30_WS_on.dat pymapVBVD version 0.4.3 Software version: VD Converting twix file meas_MID00027_FID07653_svs_se_30_WS_on.dat.
Looking for evalinfo flag image. Found data of size (2080, 42, 80, 2).
Traceback (most recent call last): File "/usr/local/bin/spec2nii", line 8, in sys.exit(main()) File "/usr/local/lib/python3.9/site-packages/spec2nii/spec2nii.py", line 485, in main spec2nii(*args) File "/usr/local/lib/python3.9/site-packages/spec2nii/spec2nii.py", line 247, in init args.func(args) File "/usr/local/lib/python3.9/site-packages/spec2nii/spec2nii.py", line 320, in twix self.imageOut, self.fileoutNames = process_twix(twixObj, File "/usr/local/lib/python3.9/site-packages/spec2nii/twixfunctions.py", line 56, in process_twix return process_svs(twixObj, base_name_out, name_in, dataKey, dim_overides, quiet=quiet, verbose=verbose) File "/usr/local/lib/python3.9/site-packages/spec2nii/twixfunctions.py", line 112, in process_svs meta_obj = extractTwixMetadata(twixObj['hdr'], basename(twixObj[dataKey].filename)) File "/usr/local/lib/python3.9/site-packages/spec2nii/twixfunctions.py", line 329, in extractTwixMetadata obj = nifti_mrs.hdr_ext(mapVBVDHdr['Meas'][('Frequency')] / 1E6, KeyError: 'Frequency'

Best, Karl

wtclarke commented 2 years ago

Hi Karl,

I've been waiting for this to crop up as I had heard that the XA20 data is substantially different. @NeutralKaon mentioned it I think.

Would you be able to supply any test data or code to help with a solution? I don't have easy access to such data. Something from a phantom would be sufficient to begin with.

BW

Will

karl-koschutnig commented 2 years ago

Hi Will, and thanks for your prompt answer. You can find a (in-vivo) dataset on openneuro (derivatives/sub-01/ses-01/mrs). If you need further data and/or information please let me know. https://openneuro.org/datasets/ds003897

Best, Karl

wtclarke commented 2 years ago

Hi Karl,

I'm afraid I'm getting an error TypeError: Cannot read properties of undefined (reading 'substr') Please support us by documenting the issue with FreshDesk. when I click on that link. Do I need to register?

BW

Will

karl-koschutnig commented 2 years ago

Hi Will, sorry for that - OpenNeuro is driving me crazy!! Could you suggest another way to upload the data? I could send you the data with wetransfer or with filesender but I need your mail address? Best, Karl

wtclarke commented 2 years ago

Try https://oxfile.ox.ac.uk/oxfile/work/extBox?id=10956887305CC5C363E

karl-koschutnig commented 2 years ago

That's great. I am uploading 3 spectro-files with different TE in dat-format as well as in rda-format. Thank you so much for your help. Karl

wtclarke commented 2 years ago

Thanks! Any chance you have the dicom files as well?

karl-koschutnig commented 2 years ago

... first upload didn't work (An unexpected error has occurred). So I uploaded only one TE (.dat) as well as some DCM-files from a phantom-measurement.

NeutralKaon commented 2 years ago

If you run into problems, send me an ssh public key privately and I can get you to rsync it securely to a university server…

All the best,

-- Jack

On 17 Nov 2021, at 16:19, karl-koschutnig @.***> wrote:

... first upload didn't work (An unexpected error has occurred). So I uploaded only one TE (.dat) as well as some DCM-files from a phantom-measurement.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/wtclarke/spec2nii/issues/22#issuecomment-971737483, or unsubscribe https://github.com/notifications/unsubscribe-auth/AELWWQ2FPTI4M5BKFRSDXCDUMPIZDANCNFSM5IB65NTA. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

schorschinho commented 2 years ago

Hi all, I'd be keen to hear more about this problem too, especially since @karl-koschutnig mentioned he's experienced problems with Osprey before. Let me know how/if I can help.

Thanks, Georg

wtclarke commented 2 years ago

Hi @karl-koschutnig I got the files. I'll try to find some time this week to take a look, I'm afraid I cant promise speed at the moment though.

karl-koschutnig commented 2 years ago

@wtclarke - no problem - take your time. I'm happy that you try to help!

wtclarke commented 2 years ago

@karl-koschutnig Sorry for the delay. I found a moment today to look at the data. I've got a solution working for the dicom files you supplied.

I've also got spec2nii generating data from the twix files. However, it seems like there is some odd behaviour. When I convert meas_MID00027_FID07653_svs_se_30_WS_on.dat. I get an output with

The file contains these evalinfo flags with dimensions and sizes as follows: image : Col, Cha, Ave, Phs [2080 42 80 2]

However that Phs dimension only has data fro a single Ave, and it is water unsuppressed. This therefore seems to be a water reference scan bundled with the actual water suppressed data. This is nice, but it seems madness storing a whole block of zeros for the sake of one reference. (And the file size seems to indicate that this is what happens!) Rather I would expect an additional evalinfo flag with Col, Cha, Ave [2080 42 1].

Can I ask:

  1. Is this a product sequence?
  2. Do you have a working XA20 idea environment or access to the scanner? If so could you confirm to me the data structure of that file using the mdb tool?

Once I solve this I should be able to get a WIP release of for XA sequences.

wtclarke commented 2 years ago

Hi @karl-koschutnig I've got a basic implementation working now in V0.4.0. This is up on PyPi now and will be on conda-forge shortly.

karl-koschutnig commented 2 years ago

Hi @wtclarke and sorry for the late response! Regarding your question: 1) Yes, we use a Siemens product sequence 2) Yes we have a working XA20 environment and just opened the mdb tool and could successfully open the .dat file. However, the output is a little bit overwhelming and to be honest, I have never used this tool before. So could you please give me a screenshot (or link to a document) so that I can figure out the information you are looking for.

Thanks for you're effort!! By the way we (hopefully) will upgrade to XA30 (XA31) very soon - maybe that's good / maybe not ;-) Best, Karl

wtclarke commented 2 years ago

Hi Karl,

Thanks for the info. Someone else also got in touch about the same problem on the FSL JISC list and he was able to provide the MDB confirmation, and then I also tried using the same program on the VE scanners and that also worked. So no need to do any more.

Do you want to try the new version (0.4.0) on your data? If you installed through conda it should be conda update -c conda-forge spec2nii. You should get two files returned from each twix file. The main data plus a single shot water unsuppressed reference.

If it works then I can close this issue.

@schorschinho Take a look for references to xa in https://github.com/wtclarke/spec2nii/blob/master/spec2nii/twixfunctions.py for a guide on what I've done. Effectively they have removed the Siemens CSA header and everything is now in private DICOM tags. I think this is an improvement. However xa product sequences now come with a reference scan (also good) but they've encoded it in a not ideal way. So if you use mapvbvd to read the data in it gives you a data block with an entire extra dimension for just one transient.

karl-koschutnig commented 2 years ago

Hi Will,

thank you so much - it works! Great job!! I got two files and no error ;-)

Best, Karl

wtclarke commented 2 years ago

Great, I'll close this for now, but please keep an eye out for odd behaviour as this is a fairly new file type, there might be some oddities that I haven't accounted for. Feel free to open another issue if you do find anything.