nipy / heudiconv

Flexible DICOM conversion into structured directory layouts
https://heudiconv.readthedocs.io
Other
234 stars 125 forks source link

GE scanner pepolar maps - both AP and PA are in the same series/.nii.gz #479

Open yarikoptic opened 3 years ago

yarikoptic commented 3 years ago

I am helping to convert some data from GE DISCOVERY MR750 using heudiconv and EPI pepolar maps come as

BIDS ATM requires two separate volumes -- one for dir-AP and another dir-PA. I wonder if there a way to automagically

NB asking for phantom data but may be someone has access to such a beast?

Any ideas @tsalo @pvelasco @neurolabusc ?

neurolabusc commented 3 years ago

Upgrade to the current stable release v1.0.20201102. The release notes describe improved meta-data for GE, with a link to this validation dataset. The validation dataset provides a recipe for determining phase encoding polarity. Thanks to @mr-jaemin and other GE engineers.

yarikoptic commented 3 years ago

THANK YOU @neurolabusc AKA Chris! I will give it a shot and report back

yarikoptic commented 3 years ago

On a quick look, using v1.0.20201102 provided no notable differences besides some to .json content with higher precision of floats, and change to how dicom values are stored, e.g.

-       "SoftwareVersions": "27_LX_MR_Software_release:DV26.0_R02_1810.b",
+       "SoftwareVersions": "27\\LX\\MR Software release:DV26.0_R02_1810.b",

data itself is identical

$> nib-diff old/func_t29477.nii.gz func.nii.gz 
These files are identical.
neurolabusc commented 3 years ago

Maybe I do not understand your question or your data.

  1. The image data should be identical. The difference phase encoding polarities must be acquired as separate series, so they will be separate images. Does the JSON tag "PhaseEncodingDirection" distinguish between the AP and PA acquisitions, e.g. "j" and "j-"? Are the RL and LR series listed as "i" and "i-"?
  2. If the answer is no, can you check that the private sequence data tag (0043,102A) exists in your DICOM image (you can use dcmdump, gdcmdump or dcm2niix -v 2 /path/to/folder/with/single/DICOM/from/series)
yarikoptic commented 3 years ago

pinged you via mailbox.sc.edu email @neurolabusc

neurolabusc commented 3 years ago

@yarikoptic the typical usage of TOPUP is to acquire two sequential series that are identical except with an exception in the phase encoding polarity.

Your dataset does not follow this convention. For your custom sequence, the phase encoding direction is reversed after each volume, so that the odd and even volumes in the time series differ in their phase encoding. This reversal is not encoded in the Image Orientation (Patient) (0020,0037) nor in the private sequence data tag (0043,102A). dcm2niix assumes the DICOMs are truthful and correctly converts the images as described. I also note that TOPUP is designed for spin-echo not gradient echo sequences, which might impact performance.

To analyze these, you will need a script to separate the odd from even volumes, flip the column order of the reversed images, estimate TOPUP, apply TOPUP, and then merge the the two images (interleaving volumes to restore the temporal order).

In brief, this is not a limitation of dcm2niix, nor of GE product sequences. Rather, it reflects a custom sequence that does not report the manipulations in the DICOM data.

@mr-jaemin provides the details:

I believe that this sequence is a part of ABCD WIP package (PSD name: epi_pepolar) where both 
AP/PA volumes can be collected within one series depending on CV12 (User data 12, DS, (0019,10B3)). 
For example, (0019,10B3) = 2, reverse (negative polarity phase encoding) first then forward. 
Sorry I forgot which one is AP/PA in our convention.

Here is the description I found from ABCD WIP package manual:

EPI Field Map
A short EPI acquisition that acquires both positive and negative polarity phase encoding in separate temporal phases is provided. 
This data can be used for offline distortion correction (not provided).

CV12: pepolar (0=fwd; 1=rev; 2=r-f; 3=f-r)
Used to select the phase encoding polarity scheme (default=2)

In ABCD study, UCSD provides offline distortion correction using this data based on their algorithm:
Holland, D., Kuperman, J. M., & Dale, A. M. (2010). Efficient correction of inhomogeneous static magnetic field-induced distortion in Echo Planar Imaging. Neuroimage, 50(1), 175-183.
yarikoptic commented 3 years ago

Just to make sure:

In brief, this is not a limitation of dcm2niix, nor of GE product sequences. Rather, it reflects a custom sequence that does not report the manipulations in the DICOM data.

so you think dcm2niix should not "centralize" this knowledge (upon detecting such a sequence) and separate out those into two images e.g. in -b y mode, since BIDS mandates separate files?

I also note that TOPUP is designed for spin-echo not gradient echo sequences, which might impact performance.

eh, there is also that Series Description SE_EPI_B0, PulseSequenceName muxepi2 I had mentioned, but it doesn't look like the one flipping AP/PA. I guess we should read more on the ABCD sequences to see how to digest/use that one.

neurolabusc commented 3 years ago
  1. The DICOM header information from this custom sequence is incorrect. Neither (0020,0037) or (0043,102A) reflect reality. Indeed, since 0020,0037 is a Type 1 tag, these images are not legal DICOM images. Feel free to submit a pull request if you want to support this format and are convinced there is a robust way to detect them. However, I do think this is beyond the remit of dcm2niix. Ignoring the explicit values in the DICOM header is a recipe for unintended consequences. This seems like the domain of a simple script. dcm2niix is already challenging enough to maintain.

  2. With Spin-echo sequences the signal is moved (bunched-up in some regions pulled apart in others) whereas inhomogenous areas of gradient echo scans exhibit both spatial distortion and signal dropout. Its difficult to detect the spatial distortion if the signal is invisible. As an analogy, consider two airplanes that leave an airport at the same moment, traveling the same speed in precisely opposite directions. We can infer the location of the airport from our radar screen: it is precisely half way between the two planes. However, this will not work for stealth aircraft, as we can not detect where they are located.

yarikoptic commented 3 years ago

Thank you for the exhaustive explanations! I guess we could indeed handle 1. within heudiconv -- after all it is the "heuristic" converter ;)

psadil commented 3 years ago

Hi @yarikoptic . I think that I'm now working on the same dataset that you were helping to convert. What do you think about having heudiconv using the private tag (0019,10B3) to automatically attempt creating bids-compliant AP/PA images? From above:

I believe that this sequence is a part of ABCD WIP package (PSD name: epi_pepolar) where both 
AP/PA volumes can be collected within one series depending on CV12 (User data 12, DS, (0019,10B3)). 
For example, (0019,10B3) = 2, reverse (negative polarity phase encoding) first then forward. 
Sorry I forgot which one is AP/PA in our convention.
[...]
CV12: pepolar (0=fwd; 1=rev; 2=r-f; 3=f-r)
Used to select the phase encoding polarity scheme (default=2)

I only have access to the one dataset, in which (0019,10B3) = 2 and the ordering appears to be PA - AP - PA - AP. In these images, the first and third volumes have a flipped orientation, but the orientation information in the dicom headers appears to match the second and fourth volumes

neurolabusc commented 3 years ago

@psadil can you send me a sample dataset directly to me (e.g. send DropBox link to the university email listed in my avatar). Can you tell me if these scans were provided to you by the ABCD, or whether they were acquired at your site using the ABCD sequences?

mr-jaemin commented 3 years ago

@psadil @neurolabusc

I looked at one of ABCD datasets (rsfMRI_Field_Map) with the same CV12 (0019,10B3) = 2 (reverse-forward)

@neurolabusc I shared one dataset via Box.

First 04_rsfMRI_Field_Map_01 Second 04_rsfMRI_Field_Map_02 Third 04_rsfMRI_Field_Map_03 Forth 04_rsfMRI_Field_Map_04

neurolabusc commented 3 years ago

@mr-jaemin thanks for the sample dataset! I have implemented a kludge with dcm2niix developmental branch (v1.0.202100811)described here. A minimal build on a Linux/macOS computer would look like this:

git clone --branch development https://github.com/rordenlab/dcm2niix.git
cd dcm2niix/console
make

The examples you provided demonstrate the cases of CV12 (0019,10B3) = 2 and 3. I would be interested in seeing an example where CV12 = 1. Specifically, what happens when all the images in a series are consistently flipped? Is the flipping flag and row order flipped such that the images look incorrect with a stock DICOM viewer, or is the row order flipping only implemented when two opposite phase encoding polarities are included in the same series.

psadil commented 3 years ago
* The order appears to be AP(reverse)-PA(forward)-AP(reverse)-PA(forward) (see below). @psadil Could you please confirm your data?

@mr-jaemin thanks for this information. Yes, I can confirm that this order matches our data