BrkRaw / brkraw

BrkRaw: A comprehensive tool to access raw Bruker Biospin MRI data
https://brkraw.github.io
GNU General Public License v3.0
42 stars 27 forks source link

CSI(MRSI) Data Conversion to nifti #30

Open amirshamaei opened 3 years ago

amirshamaei commented 3 years ago
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 PVMVOXArrSize 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

dvm-shlee commented 3 years ago

@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.

amirshamaei commented 3 years ago

@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).