Gannet on Siemens .dcm files


I cannot figure out, is it possible to use Gannet if I only have Siemens .dcm files? That is one file for Water reference and e.g. 256 .dcm files for metabolites?

Hi @dace,

Yes, Gannet can process Siemens .dcm files. Let me know where you may be having issues running your data.


Thanks, Mark!
At GannetLoad, do I specify DICOM files as a folder or a list of all .dcm files? Nothing seems to work.

If I specify as a list of files, for each file I get this error message and also a popup window with an error (>200 popups)

256 water-suppressed DCM files detected in [my folder name]
Warning: ********** An error occured while loading dataset:
‘[my folder name]\’.
Check data. Skipping to next dataset in batch **********

In GannetLoad (line 712)
Warning: Escaped character ‘\d’ is not valid. See ‘doc sprintf’ for supported special characters.
In GannetLoad (line 713)

What version of Gannet are you using?

It is from the GitHub the latest (as of few days ago). 3.2.1
And Matlab 2020b (but the same was on 2018a)

Are you able to share your data with me for debugging? My email is

1 Like

@dace, I’ve fixed the bug related to your issue. Please try using the development version of the upcoming Gannet release (v3.3.0-rc). Downloadable: GitHub - markmikkelsen/Gannet at dev

The syntax for loading your data is:

MRS = GannetLoad({metabfile_folder/one_dcm_file.dcm}, {waterfile_folder/one_dcm_file.dcm});

Thanks, Mark! I will try.

Regarding the syntax, I have 256 dcm files for metabolites, will it automatically then load all even if I only specify one of the files?

Yep, it will find all the files in the folder ending in *.dcm.

1 Like

It now worked without any problem. Thanks so much, Mark! :slight_smile:

1 Like

Hi, my metabolic and water respectively have 4. dcm files. I use this ’ GitHub - markmikkelsen/Gannet at dev ’ , matlab version 2022, it report bug

MRS = GannetLoad({metab/00002.dcm}, {water/00002.dcm});

Invalid use of operator.

if I change the .dcm filename, it report other bug
MRS = GannetLoad({metab/one.dcm}, {water/one.dcm});
Unrecognized function or variable ‘metab’.

You need to put ' around the filenames, i.e.

MRS = GannetLoad({'metab/00002.dcm'}, {'water/00002.dcm'});

thanks, while there show other bug,

Hi @Lejia,

This seems to tell me that one or more of your .dcm files is empty and/or corrupted. Could you please check the file sizes of all your files?


Also, I highly recommend exporting your data in TWIX format (*.dat) instead of .dcm files.

Hi @mmikkel ,
Thanks your reply, I checked my data, these file isn’t empety, meanwhile, I run other two subjects data, it also show this bug. For exporting my data in TWIX format (.dat) instead of .dcm files, my data have been completed to collect, my raw data file haven’t any extension and have only one supress or unsupress water file. After sort, there have 4 .dcm files for supress or unsupress water. For this condition, Can my data be converted to TWIX format (.dat)?


Can you share your data with me so I can test it? My email is

You can remove participant information from the DICOM files in Matlab using the Gannet function DICOMDeIdentify. Please run help DICOMDeIdentify for usage instructions.

If you’ve already completed your data collection and exported the data files, then you can’t convert them to the TWIX format (unless your data are still on your scanner, which I suspect they are not).

I actually ran into a problem with this last week – on case-sensitive filesystems, this was breaking if the filenames were *.DCM instead of *.dcm. Not sure it’s the same problem (and I’m afraid I didn’t take the time to make a clean, general workaround, I just capitalised DCM in the reader function…)

[in response to the older part of this thread]

Crossposting from another thread:

My guess is that you’re either trying to feed a corrupted DICOM (like @mmikkel said) or one that isn’t an MRS DICOM, but rather an image one. Can you confirm that you’ve run some sort of DICOM series sorting (like the one in BIDScoin) and that your water and metab folders ONLY include MRS DICOMs?