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

DCM2NIIX DWI DCM TO NIFTI, b-val 0 instead of 1400, GE manufacturer #690

Closed
ccosmin97 opened this issue Mar 13, 2023 · 7 comments
Closed

Comments

@ccosmin97
Copy link

Hi,

I am converting 26 slices of a DWI volume of b-value equal to 1400 to NIFTI, but the reported b-value given by dcm2niix is 0, in the .bval output file.

Here are the logs :

image

The DWI scan comes from QIN-Prostate-Repeatability collection:

  • patientID : PCAMPMRI-00006
  • StudyInstanceUID : 1.3.6.1.4.1.14519.5.2.1.3671.4754.287814201869490350714498330797
  • SeriesInstanceUID : 1.3.6.1.4.1.14519.5.2.1.3671.4754.162806304101010591267897338142

The b-value is stored here in tag (0043,1039), and should be 1400.

As mentioned in this issue,
if b-vec values should be incorporated in tags (0019,10bb, 0019,10bc, 0019,10bd), then there might be an issue here, since these tags are present:

image

Reproducibility steps :

  • Download of the mentioned slices and conversion to nifti is reproducible this google colab notebook.
  • Used dcm2niix version is v1.0.20220505 GCC9.4.0 x86-64 (64-bit Linux).

The SOPUIds of the corresponding b-val 1400 are included in mentioned google colab notebook.

Thank you!

PS : This is in the context of evaluation of SOTA prostate cancer AI models on publicly available data in Imaging Data Commons @fedorov.

@neurolabusc
Copy link
Collaborator

  1. Note that your series has 52 images and you are only downloading 26 (one volume).
  2. Visual inspection shows that one volume is a B=0 image and the other is a non-directional DWI scalar image (e.g. TRACE, ADC, FA, MD, etc).
  3. As noted in issue 245 Note that the B-value for this slice is reported as 1400, but the bvector is reported as 0,0,0. In GE speak, an image with a positive bvalue and a bvector of 0,0,0 is a derived image, such as an isotropic image.
  4. Therefore, This is a Diffusion-Weighted Image (DWI), but it does not store the directional data required for Diffusion Tensor Imaging (DTI) analyses. dcm2niix. The FSL/BIDS format bval/bvec files are only generated when a series has directional diffusion data that can be processed to estimate tensors.

@fedorov
Copy link

fedorov commented Mar 14, 2023

Hi Chris, to explain a bit more what we are doing, the analysis pipeline requires just the high-b volume, so there is no need to retrieve the entire series. That indeed is a trace image, which is how DWI is often used in prostate MRI analysis. It is not the intent to do the DWI analysis - we just need the reconstructed high-b scalar volume - but we were expecting that the b-value of 1400 would be parsed from the private field.

If the observed behavior of dcm2niix is expected, and b-value is not supposed to be saved, please close the issue - we just wanted to report and share the sample in case there is interest to debug or alter the current behavior.

@neurolabusc
Copy link
Collaborator

This topic is related to issue 657, so the development branch and upcoming stable release will be more willing to create bval files for isotropic diffusion images.

However, this particular series contradicts our experience with GE isotropic diffusion data. The bizarre thing about this GE dataset is that it is missing the GE private DICOM tag NumberOfDiffusionDirectionGE (0019,10E0). For an isotropic dataset, I would expect this to be 0, while for directional datasets it will be a positive number. My notes suggest this tag exists since GE release 10, where these images are from 15. I wonder if this tag got deleted by some tool that touched the data. The private tag 0903,0010 notes GEIIS PACS. GEIIS PACS created icon images that broke DICOM conformance, so perhaps either GEIIS or a tool used to rectify GEIIS data removed this tag.

You can coerce dcm2niix to create bval this series if you add two lines to the development branch of dcm2niix so it reads:

	bool isGEADC = (dcmList[indx0].numberOfDiffusionDirectionGE == 0);
	if ((!isGEADC) && (dcmList[indx0].numberOfDiffusionDirectionGE < 0) && (dcmList[indx0].manufacturer == kMANUFACTURER_GE))
		isGEADC = true;
	for (int i = 0; i < numDti; i++) {
		...

Given that this change explicitly contradicts my notes on GE diffusion scans, I am reluctant to add this change to the core dcm2niix code as it may disrupt processing of legitimate GE DTI data. The GE diffusion handling is not intuitive and as I recall can be different for product and research sequences.

As an aside, when using dcm2niix, I would always suggest processing the entire series, rather than one volume for a series. This provides the tool with a better context for the data. Here you only process one volume (26 images) from the 2 volume (52 image) series. For anyone wishing to replicate this issue, the manifest for all images is:

gs://public-datasets-idc/df0bdc5a-c033-46df-8d42-51b417727c02.dcm
gs://public-datasets-idc/7a3cfa1e-96a6-42d7-843d-da550084e5ca.dcm
gs://public-datasets-idc/16f8701f-a4b5-45b3-82a0-562bd87fa43a.dcm
gs://public-datasets-idc/8a9cd051-af8f-4c9a-896a-fd5052a9137b.dcm
gs://public-datasets-idc/aa7b139c-db6c-41c4-a2e3-ffc256c35015.dcm
gs://public-datasets-idc/4beb617b-456f-47e0-bbf6-eb16edef00fc.dcm
gs://public-datasets-idc/9c5cc89c-b0cb-4e80-bc6d-ca08ab1e2095.dcm
gs://public-datasets-idc/16561323-2f3e-4c8d-b3b4-f3b4a2b49ae5.dcm
gs://public-datasets-idc/61747439-62a4-43c7-b6a4-bc6a3829711f.dcm
gs://public-datasets-idc/b7a0a820-0d4f-4611-b6c9-f8023b773a76.dcm
gs://public-datasets-idc/8acb4821-f07c-4906-97f2-0647f3ebe3fd.dcm
gs://public-datasets-idc/85dafb0c-6965-4947-ba2b-c7e093008029.dcm
gs://public-datasets-idc/c2f9baae-8749-457a-85dc-f854ab9ac41b.dcm
gs://public-datasets-idc/fb62f493-18f6-4ab0-b5cd-3752f433ad05.dcm
gs://public-datasets-idc/c0a6a2ba-e73e-465d-9593-77de87b707b8.dcm
gs://public-datasets-idc/53a305b2-afe6-431f-a11b-384693424dee.dcm
gs://public-datasets-idc/244a0b28-386c-4c08-bd15-6de5f43cb89a.dcm
gs://public-datasets-idc/9d8f1fd8-09a2-4e7b-ad4e-8e63986ea4c4.dcm
gs://public-datasets-idc/afefd082-d8aa-4cc2-8a90-21cc9680e08b.dcm
gs://public-datasets-idc/fbcce12f-f35d-4333-ab01-a5bc80d94ddc.dcm
gs://public-datasets-idc/eb5b63d7-287b-40a5-9bbb-da1078c95f06.dcm
gs://public-datasets-idc/a8fb248a-42d7-4495-b8f8-37cb764cec4f.dcm
gs://public-datasets-idc/f3a58090-a499-46f0-b284-69574d5f93d8.dcm
gs://public-datasets-idc/2aca1a1f-a4b5-4e46-9d65-de852f64d763.dcm
gs://public-datasets-idc/5e8cb78c-8e75-45be-a027-a769d19a89f7.dcm
gs://public-datasets-idc/8c1843df-b30c-4670-b75f-67b55d1f9477.dcm
gs://public-datasets-idc/b79561e2-d82c-47d8-9c1e-c22d84aace60.dcm
gs://public-datasets-idc/89a1abda-7e3f-4b0a-b44c-746a4b8efec4.dcm
gs://public-datasets-idc/9ba9ffc9-27ae-4542-8ad5-2ba7741cc3f1.dcm
gs://public-datasets-idc/14ef5b47-4c14-4bdb-8503-721dce3980c0.dcm
gs://public-datasets-idc/62f29c7f-045b-454d-a7d5-7c1ac9869309.dcm
gs://public-datasets-idc/9226d6c2-eb7d-4da7-b3ae-da9fba6d7c46.dcm
gs://public-datasets-idc/38eff10b-bb8e-4ba6-b8b0-52b1002e5b83.dcm
gs://public-datasets-idc/ea33d8cd-0ffc-47da-81e0-1b0df5e183ec.dcm
gs://public-datasets-idc/12d7f0d6-54e9-4b77-bf8e-698d55b43ba5.dcm
gs://public-datasets-idc/84f06845-92dd-4c34-9d47-38286df0d346.dcm
gs://public-datasets-idc/f543c355-fdb5-4ac5-92c7-0ad470db5ca7.dcm
gs://public-datasets-idc/87ea5a47-9a79-47e8-84aa-af08d4cc2528.dcm
gs://public-datasets-idc/00a6dc71-1906-45a0-bbf1-bf575e093ac6.dcm
gs://public-datasets-idc/c5c4ddcf-27c7-4d25-b6e8-b751e710212c.dcm
gs://public-datasets-idc/afcf7629-a0ed-4c4b-8353-a8fd63bd9890.dcm
gs://public-datasets-idc/d041330c-f2d5-4667-9bca-31344d651efa.dcm
gs://public-datasets-idc/0a2fa725-f570-48a6-96d9-db971ec9a9f2.dcm
gs://public-datasets-idc/85a85af8-bf4b-465c-a1e7-794a084f2ad7.dcm
gs://public-datasets-idc/ef96d682-0dbc-48a3-ba53-7f6e35eafb3d.dcm
gs://public-datasets-idc/023a1d1c-0604-4ac4-83d1-49b4a94d1ec7.dcm
gs://public-datasets-idc/b545be9e-af75-4ea2-86f2-011ffa1953aa.dcm
gs://public-datasets-idc/ee73c2b4-b191-4210-bb6c-b0e23a2d7265.dcm
gs://public-datasets-idc/9a31471f-bb92-4b3a-8146-739471cb657e.dcm
gs://public-datasets-idc/0b136c52-3833-40e3-92f1-b5bff53fd323.dcm
gs://public-datasets-idc/61f6c4fd-5a4b-42b0-a2d1-c6c2e152f37e.dcm
gs://public-datasets-idc/51ddb627-fdaa-45b4-a66c-9d5d4e3f3411.dcm

which can be downloaded with the command:

cat manifest.txt | gsutil -m cp -I .

@mr-jaemin
Copy link
Collaborator

These two DICOM tags can be used to detect/distinguish DWI/DTI:

Attribute Name Tag VR VM
Diffusion direction (0021,105a) SL 1
Vas collapse flag (0043,1030) SS 1

Diffusion direction (0021,105a) would provide a type of “Diffusion Direction” (series-level)
Vas collapse flag (0043,1030) would provide a type of image (image-level):

For example, for DTI, i.e. Diffusion direction= TENSOR

Diffusion direction (0021,105a) = 16
Vas collapse flag (0043,1030) = 14 (T2 images prescribed by # of T2 images) or 16 (diffusion images including b0 images defined by diffusion gradient table with all 0)

image002

For clinical DWI, Diffusion direction selections other than TENSOR:
image001

Diffusion direction (0021,105a) would provide a type of “Diffusion Direction” (series-level) defined by:
DFAXALL 7
DFAXAP 2
DFAXRL 4
DFAXSI 1
DFAXSLC 8
DFAX_NONE 0
DFAXDTI 16
DFAX3IN1 64
DFAXTETRA 128

Vas collapse flag (0043,1030) would provide a type of image (not series) including, but not limited to the followings:

DiffusionRightLeftDicomValue = 3;
DiffusionAnteriorPosteriorDicomValue = 4;
DiffusionSuperiorInferiorDicomValue = 5;
DiffusionObliqueRightLeftDicomValue = 9;
DiffusionObliqueAnteriorPosteriorDicomValue = 10;
DiffusionObliqueSuperiorInferiorDicomValue = 11;
DiffusionT2DicomValue = 14;
DiffusionCombinedDicomValue = 15;
DiffusionDtiDicomValue = 16;
DiffusionDirection1DicomValue = 43;
DiffusionDirection2DicomValue = 44;
DiffusionDirection3DicomValue = 45;
DiffusionDirection4DicomValue = 46;

For example, for clinical DWI combined (i.e. trace) image like the above example, Vas collapse flag (0043,1030) would be 15

@neurolabusc
Copy link
Collaborator

@mr-jaemin thanks! These images do not report 0043,1030, so perhaps that is a more recent tag. However, they do have 0021,105a so I have used that to refine the detection of isotropic diffusion images.

@ccosmin97 do you want to test the latest commit to the development branch (v1.0.20230315) and close this issue if it resolves your problem.

@mr-jaemin
Copy link
Collaborator

@mr-jaemin thanks! These images do not report 0043,1030, so perhaps that is a more recent tag. However, they do have 0021,105a so I have used that to refine the detection of isotropic diffusion images.

I believe that the tag 0043,1030 would be one of classic private tags, not a recent tag. I found this tag from version 11 (2003) DICOM Conformance Statement. I also suspect that this tag was removed, as you mentioned for the (0019,10E0).

@ccosmin97
Copy link
Author

ccosmin97 commented Mar 15, 2023

I converted the same 26 slices from dcm2niix using the latest dev commit build from AppVeyor commit#c2a4b28 mentioned above.

This time the correct b-value was properly saved in .bval log file.
Please see :
image

image

Here is the notebook for reproducibility : (dcm2niix v1.0.20230315)

@neurolabusc @mr-jaemin Thank you!!

I think we can close the issue.

Cosmin

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

4 participants