Hello, 

I'm trying to create a nifti file from some older (2006-2009) dicom files using mri_convert, and I'm having some difficulty. Part of this is uncertainty about the dicom files in question. The files were collected on Siemens scanner between 2006 and 2009, and I *believe* they should be in Siemens dicom format. They came off the magnet without a .dcm extension, if I recall correctly, but I used Brain Voyager to rename the dicom files (I believe all it does is re-title them to reflect the acquisition order, but I'm not 100% sure about that - that could be part of the problem). Running mri_convert to create a nifti file from the first file in each of the sequences I have yields the error I have copied below. 

<redacted> bits are there for anonymity, I don't think those fields relate to the problem. The main problem with this call seems to be that some fields regarding the image position are not read correctly, so the affine transform has nans in it. 

I also tried calling mri_convert -it dicom, which succeeded, but created an image that was of shape (384, 384, 1, 202).  I don't know why that call to mri_convert doesn't correctly recognize that the images in the dicoms are, in fact, mosaic images (in the first call, there was an "IsMosaic" field that was set to 0, but I'm pretty sure it should be 1 or True or whatever); the resulting 4D array should be (64, 64, 32, 202). 

However, the image that the second call created may have had a correct affine transform (at least there were no nans) - to check on it in python, I called: 

nii = nibabel.load(file_name)
nii.affine

... and got:

array([[  -3.5       ,   -0.        ,   -0.        ,  672.67797852],
       [  -0.        ,   -3.5       ,   -0.        ,  690.59564209],
       [   0.        ,    0.        ,    3.        ,  -52.07869339],
       [   0.        ,    0.        ,    0.        ,    1.        ]])


... So, now I'm a little stuck. -it seimens did not help, gave me the same error as below (same for -it siemens_dicom). I don't fully understand how to possibly override the bad info, or how to tell mri_convert where to find the correct info, or how to tell if I'm just out of luck with this whole endeavor. 

mri_convert --version spits out "stable5", which might be a slightly older version. 

Any help will be much appreciated.

Cheers,
Mark


Error message:
----

Getting Series No
Scanning Directory
INFO: Found 993 files in old_data/ML_Localizers/Raw_Retinotopy_05_29_09
INFO: Scanning for Series Number 21
INFO: found 202 files in series
INFO: loading series header info.

# <there were lots of these error lines, one for each file in the series; i think these are due to the space between the subject ID, which I've redacted, and  -0021-0001-00001.dcm > #
error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/strings: invalid decimal number in flag: -0021-0001-00001.dcm
Usage: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/strings [-] [-a] [-o] [-t format] [-number] [-n number] [[-arch <arch_flag>] ...] [--] [file ...]


WARNING: file <redacted> -0021-0001-00001.dcm does not contain a Siemens ASCII header
has this file been anonymized?
Proceeding as best as I can ...

INFO: (384 384   1), nframes = 202, ismosaic=0
PE Dir COL COL
FileName  <redacted>/<redacted> -0021-0001-00001.dcm
Identification
NumarisVer        syngo MR B15
ScannerModel      TrioTim
PatientName       <redacted>
Date and time
StudyDate         <redacted>
StudyTime         105825.156000
SeriesTime        122023.890000
AcqTime           122021.700000
Acquisition parameters
PulseSeq          *epfid2d1_64
Protocol          <redacted>
PhEncDir          COL
EchoNo            1
FlipAngle         90
EchoTime          30
InversionTime     -1
RepetitionTime    2000
PhEncFOV          0
ReadoutFOV        0
Image information
RunNo             20
SeriesNo          21
ImageNo           1
NImageRows        384
NImageCols        384
NFrames           202
SliceArraylSize   0
IsMosaic          0
ImgPos            672.6780 690.5956 -52.0787
VolRes              3.5000   3.5000   3.0000
VolDim            384      384        1
Vc                 -1.0000  -0.0000   0.0000
Vr                 -0.0000  -1.0000   0.0000
Vs                     nan      nan      nan
VolCenter              nan      nan      nan
TransferSyntaxUID 1.2.840.10008.1.2.1
UseSliceScaleFactor 0 (slice 0: 1)
INFO: no Siemens slice order reversal detected (good!).
TR=2000.00, TE=30.00, TI=-1.00, flip angle=90.00
i_ras = (-1, -0, 0)
j_ras = (-0, -1, 0)
k_ras = (nan, nan, nan)
Reslicing using trilinear interpolation
MRIresample(): error inverting matrix; determinant is nan, matrix is:
-3.500  -0.000  nan  nan;
-0.000  -3.500  nan  nan;
 0.000   0.000  nan  nan;
 0.000   0.000   0.000   1.000;