brkraw icon indicating copy to clipboard operation
brkraw copied to clipboard

CSI(MRSI) Data Conversion to nifti

Open amirshamaei opened this issue 5 years ago • 2 comments

  • I am trying to convert Bruker CSI data to Nifti. Everything looks OK, except for the excited CSI grid. How I can store it in Nifti? Do you think it is possible? should I use a sidecar file like json?
  • I don't have access PV360, I am really curious how they store CSI in nifti format! in case you know, I appreciate your answer.
  • I tried BrkRaw for CSI data reading; It is really nice tool, but I couldn't load my CSI data. It doesn't support CSI now. does it?
  • It is an example of CSI data. I couldn't share the binary file (2dseq) for this specific data, but here you can find the Parameters files of the anatomical(MRI) and spectroscopic experiments. Download : CSI to nifti example.zip Well, I summarized the key differences between files:
VisuPars CSI MRI
Dim 3 2
Size 2048, 16, 16 256, 256
DimDesc 3 2
Spec, Spa, Spa Spa, Spa
Extent 9.99, 30, 35 30,35
unit <ppm, mm, mm> <mm, mm>
seq name CSI RARE

Everything is clear for conversation to nifti except affine matrix and region of interest. In the following you can find my solution, but it is just my understanding of Bruker "magic" black box; so, I would really happy to hear your idea and oponion.

  1. To calculate the affine matrix, my solution is based on this library approach. To calculate resolution matrix, I get rid of first element of size and extent matrix and add slice thickness(isn't it meaningless to have slice in MRSI data!?). Then the rest of calculation is exactly like the anatomical image, but with different resolution and voxel(pixel) size. So, for calculating qform matrix for CSI; we set qform_code to SCANNER_ANAT(1) which is aligned to scanner (or AlINED_ANT(2)? i am not sure, Correct me if i am wrong). here I depicted the idea: Presentation1
  2. Excited voxels: this part is more challenging than previous. the excited voxel (voxels of interest) is smaller matrix; but with same resolution. but there was not any parameter in VisuPars file about it. I found information about it in PVM_VOXArrSize and ~_~Position in method file. however; i notice the number is not fit to VisuPars parameters. So, I used VoxelGradOrientation to convert them and then sum them up with half of VisuExtent elements. Right now, I have Position of VOI and resolution as well.
CSI affine matrix
-1.8750 0 0 13.1653
0 0 2.0000 16.5062
0 -2.1875 0 0
0 0 0 1.0000
Anatomical affine matrix
-0.1172 0 0 13.1653
0 0 2.0000 16.5062
0 -0.1367 0, 0
0 0 0 1.0000

Position of VOI: [16.45, 19.33, 0] Resolution of VOI : [25, 30, 2]

##$PVM_VoxArrSize=( 1, 3 ) 30 25 2 ##$PVM_VoxArrPosition=( 1, 3 ) -1.83466 1.45244 0

if I calculate everything in a right way, so How i can store them in nifti format? any suggestion? ** this post will be updated

amirshamaei avatar Nov 13 '20 12:11 amirshamaei

@amirshamaei Hi, sorry about the delayed response, Since I'm not familiar with CSI image, I need to take a look at a dataset, could you share it with me? It probably hard to integrate into a converter at this point if it requires many new functions to reestimate it. But at least I can show you how to use the python API to achieve your conversion.

dvm-shlee avatar Nov 17 '20 21:11 dvm-shlee

@dvm-shlee Sorry for my delayed response, too :) absolutely, my colleague put a dataset in Zenodo (https://zenodo.org/record/3894651). The 30th set is CSI data (20200612_094625_lego_phantom_3_1_2/30/fid).

  • in case you can not use it, let me know to send you another.

amirshamaei avatar Nov 20 '20 09:11 amirshamaei