PTB-MR / mrpro

MR image reconstruction and processing.
https://ptb-mr.github.io/mrpro/
Apache License 2.0
17 stars 2 forks source link

Missing FlipAngle in ISMRMRD file for siemens_to_ismrmrd Numaris X #41

Open schuenke opened 1 year ago

schuenke commented 1 year ago

I noticed that the flipAngle_deg parameter is not read/set when using the latest version of siemens_to_ismrmrd (Converter version is: 1.2.11 Built against ISMRMRD version: 1.13.7) to convert Siemens Numaris X raw data files to ISMRMRD.

I checked for IDEA XA20 and XA61 and it's missing in both cases.

We should try to fix it and create an Issue/PR at https://github.com/ismrmrd/siemens_to_ismrmrd/, but I decided to post it here first so that we don't forget it.

ckolbPTB commented 1 year ago

Did you try to use different style sheets explicitly, e.g. https://github.com/ismrmrd/siemens_to_ismrmrd/blob/master/parameter_maps/IsmrmrdParameterMap_Siemens_NX.xsl ?

fzimmermann89 commented 1 year ago

The converter correctly detects that the data is NumerisX and uses exactly the stylesheet you linked to.

But that one seems to be incorrect, at least for XA20 and XA61. In both of these, the flipangle is saved by the scanner in a different field only (that one is already used by one of the other stylesheets)

We should look for some more Numaris X samples (I remember somewhere was a bitbucket/google code/... repo with different files used for testing the siemens-to-ismrmrd converter and fix the IsmrmrdParameterMap_Siemens_NX.xsl  (and XML) as best as we can. Maybe there are also different issues that we notice in the next weeks ;)

Maybe @mxlutz wants to have a look? Or anybody who already knows a bit about the XSLT notation and is interested in the converter?

If nobody wants to dive into it, I could spent some time on it starting end-of-next-weekish.

mxlutz commented 1 year ago

I took a look at it and the flipAngle_deg we take from sequenceParameters

parameters['fa'] = list_deg_to_rad(header.sequenceParameters.flipAngle_deg)

I took the siemens_XA61_FLASH.dat example file and first was confused, as now multiple measurements are stored in one file and by default siemens_to_ismrmrd takes the first, which is a coil adjustment.

To convert all measurements the -Z is important: siemens_to_ismrmrd -f siemens_XA61_FLASH.dat -Z.

It uses the _NX style sheet by default and here the flip angle is read from the DICOM information of the Siemens file:

                <xsl:for-each select="siemens/DICOM/adFlipAngleDegree">
                <xsl:if test=". &gt; 0">
                        <flipAngle_deg>
                            <xsl:value-of select="." />
                        </flipAngle_deg>
                    </xsl:if>
                </xsl:for-each>

The issue here is, that the siemens/DICOM/adFlipAngleDegree is not available as it is not defined in the xml file (IsmrmrdParameterMap_Siemens.xml). However, the place is the same as in VB17. If you add the following line in the XML file

        <p><s>DICOM.adFlipAngleDegree</s>                                       <d>siemens.DICOM.adFlipAngleDegree</d></p>

and pass the modified XML with -m to the converter everything works. In the VB17 XML it already exists, I dont know why they dont have it for the general Siemens XML, maybe for some Scanners it does not exist?

The default XML, however, also has the FlipAngle from another Section of the Siemens file:

        <p><s>MEAS.adFlipAngleDegree</s>                                        <d>siemens.MEAS.adFlipAngleDegree</d></p>

So another way would be to use that somewhere in the XSL file, but it is used nowhere right now.

So we can easily circumvent that using custom XML or XSL, do you think we should open an issue to fix it in the siemens_to_ismrmrd repo?

fzimmermann89 commented 1 year ago

Thanks!

I'd suggest to get the XML fix for NX into the converter.

It looks like an honest bug and if I understand you correctly will never work like it is now.

mxlutz commented 1 year ago

Okay, I'll open a PR on their repo

(edit: https://github.com/ismrmrd/siemens_to_ismrmrd/pull/129)