[MINC-users] dcm2mnc error regarding PatientAge

Daniel Marchand daniel at biospective.com
Tue Jul 26 13:05:35 EDT 2016


Hi,

I'm having trouble converting a dicom file including the line:
(0010,1010) AS [0000]                                   #   4, 1 PatientAge

which throws the error:
Age units (0000) unknown

It seems that the cause of the error is
inside of conversion/dcm2mnc/minc_file.c :

    if (strlen(general_info->patient.age) > 0) {
        string_t temp;
        int i;
        double age;

        strncpy(temp, general_info->patient.age, STRING_T_LEN - 1);
        while (temp[i] != 0 && !isdigit(temp[i]))
          i++;
        if (temp[i] == 0) {
          fprintf(stderr, "ERROR: Age was not numeric!!\n");
          exit(-1);
        }
        age = atof(&temp[i]);
        while (temp[i] != 0 && isdigit(temp[i]))
          i++;
        if (temp[i] == 'M')     /* age is in months */
          age /= 12.0;
        else if (temp[i] == 'W')   /* age is in weeks */
          age /= 52.0;
        else if (temp[i] == 'D')   /* age is in days */
          age /= 365.0;
        else if (temp[i] != 'Y') { /* age is in years */
          fprintf(stderr, "ERROR: Age units (%s) unknown.\n", temp);
          exit(-1);
        }
        miattputdbl(mincid, varid, MIage, age);

I would appear that perhaps a new option could be added where
dcm2mnc doesn't crash if the age is written as [0000]?

Best,

Daniel


More information about the MINC-users mailing list