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

itk_convert MINC to NRRD metadata issues #11

Closed
gdevenyi opened this issue Mar 12, 2019 · 8 comments
Closed

itk_convert MINC to NRRD metadata issues #11

gdevenyi opened this issue Mar 12, 2019 · 8 comments

Comments

@gdevenyi
Copy link

Tracking BIC-MNI/minc-toolkit-v2#70

@gdevenyi
Copy link
Author

The issue appears to be at https://github.com/BIC-MNI/EZminc/blob/ITK4/tools/itk_convert.cpp#L131-L134 where the casting is failing and the resulting converion is to "0". Determinined by:

        std::cerr << itk::ExposeMetaData<double_vecto>( dict, "acquisition:bvalues",bvalues) <<std::endl;
        std::cerr << itk::ExposeMetaData<double_vector>( dict, "acquisition:direction_x",direction_x) <<std::endl;
        std::cerr << itk::ExposeMetaData<double_vector>( dict, "acquisition:direction_y",direction_y) <<std::endl;
        std::cerr << itk::ExposeMetaData<double_vector>( dict, "acquisition:direction_z",direction_z) <<std::endl;

Results in

0
0
0
0

Taking a look at the metadata with --show-meta

acquisition:b_value type: N3itk14MetaDataObjectIdEE
acquisition:bvalues type: N3itk14MetaDataObjectINS_5ArrayIdEEEE
acquisition:direction_x type: N3itk14MetaDataObjectINS_5ArrayIdEEEE
acquisition:direction_y type: N3itk14MetaDataObjectINS_5ArrayIdEEEE
acquisition:direction_z type: N3itk14MetaDataObjectINS_5ArrayIdEEEE

Not sure yet where that comes from. I think this indicates that the MINCIO isn't converting properly?

@vfonov
Copy link
Member

vfonov commented Mar 12, 2019

two more examples (on BIC)
/scratch/scratch1/itk_convert/phantom_963271_MNI_SCAN1_20101125_dwi25_001.mnc
/scratch/scratch1/itk_convert/phantom_963271_MNI_SCAN1_20101125_dwi65_001.mnc

@vfonov
Copy link
Member

vfonov commented Mar 12, 2019

The issue appears to be at https://github.com/BIC-MNI/EZminc/blob/ITK4/tools/itk_convert.cpp#L131-L134 where the casting is failing and the resulting converion is to "0". Determinined by:
...
Taking a look at the metadata with --show-meta

acquisition:b_value type: N3itk14MetaDataObjectIdEE
acquisition:bvalues type: N3itk14MetaDataObjectINS_5ArrayIdEEEE
acquisition:direction_x type: N3itk14MetaDataObjectINS_5ArrayIdEEEE
acquisition:direction_y type: N3itk14MetaDataObjectINS_5ArrayIdEEEE
acquisition:direction_z type: N3itk14MetaDataObjectINS_5ArrayIdEEEE

Not sure yet where that comes from. I think this indicates that the MINCIO isn't converting properly?
So, running
itk_convert --dti --minc-to-nrrd phantom_963271_MNI_SCAN1_20101125_dwi25_001.mnc phantom_963271_MNI_SCAN1_20101125_dwi25_001.nrrd

in .nrrd file , the acquisition:bvalues is empty, but in minc:
> mincheader phantom_963271_MNI_SCAN1_20101125_dwi25_001.mnc |grep acquisition:bvalues acquisition:bvalues = 0., 1000., 1000., 1000., 1000., 1000., 1000., 1000., 1000., 1000., 1000., 1000., 1000., 1000., 1000., 1000., 1000., 1000., 1000., 1000., 1000., 1000., 1000., 1000., 1000., 1000., 1000. ;

@gdevenyi
Copy link
Author

Yup, sorry, I got that, the issue is that the code isn't properly converting/casting the minc-based metadata to a double_vector

@vfonov
Copy link
Member

vfonov commented Mar 12, 2019

Probably in https://github.com/BIC-MNI/EZminc/blob/ITK4/tools/itk_convert.cpp#L32
std::vector<double> should be replaced with Array<double>

@gdevenyi
Copy link
Author

Fixed:

  Voxel->RAS x-form  : 
  Image Metadata: 
    DWMRI_b-value = 2000.000000
    DWMRI_gradient_0000 =  0.000000     0.000000     0.000000
    DWMRI_gradient_0001 =  1.000000    -0.000000     0.000000
    DWMRI_gradient_0002 =  0.705821    -0.515754     0.485607
    DWMRI_gradient_0003 =  0.288269    -0.615789     0.733284
    DWMRI_gradient_0004 = -0.079129    -0.581589     0.809625
    DWMRI_gradient_0005 =  0.194881    -0.308158     0.931161
    DWMRI_gradient_0006 = -0.160818    -0.247253     0.955512
    DWMRI_gradient_0007 =  0.204628    -0.958034     0.200743
    DWMRI_gradient_0008 = -0.601419    -0.109747    -0.791360
    DWMRI_gradient_0009 =  0.383061     0.822114     0.421180
    DWMRI_gradient_0010 = -0.702661     0.468698    -0.535341
    DWMRI_gradient_0011 = -0.189813    -0.696936    -0.691557
    DWMRI_gradient_0012 =  0.096749    -0.874742    -0.474833
    DWMRI_gradient_0013 = -0.955569    -0.294716    -0.005599
    DWMRI_gradient_0014 = -0.020564     0.879582     0.475303
    DWMRI_gradient_0015 =  0.069069    -0.834354     0.546885
    DWMRI_gradient_0016 = -0.318025    -0.947625    -0.029463
    DWMRI_gradient_0017 = -0.223853     0.674444     0.703573
    DWMRI_gradient_0018 = -0.316472    -0.750523     0.580138
    DWMRI_gradient_0019 = -0.418361     0.369888     0.829552
    DWMRI_gradient_0020 =  0.440707    -0.018973    -0.897450
    DWMRI_gradient_0021 = -0.997649     0.055741     0.039859
    DWMRI_gradient_0022 = -0.514338    -0.817170     0.260175
    DWMRI_gradient_0023 =  0.925726     0.290788    -0.241812
    DWMRI_gradient_0024 = -0.779804    -0.614015     0.122033
    DWMRI_gradient_0025 = -0.697030     0.683266     0.217479
    DWMRI_gradient_0026 =  0.176882     0.676630     0.714761
    DWMRI_gradient_0027 =  0.385588     0.607799    -0.694192
    DWMRI_gradient_0028 =  0.527175     0.565491     0.634276
    DWMRI_gradient_0029 = -0.732291    -0.211328     0.647372
    DWMRI_gradient_0030 =  0.794780     0.414608     0.443199
    DWMRI_gradient_0031 =  0.920259     0.377398     0.103415

@gdevenyi
Copy link
Author

Fixed by #12

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

2 participants