[MINC-users] dcm2mnc error regarding PatientAge
Robert D. Vincent
robert.d.vincent at mcgill.ca
Tue Jul 26 23:36:34 EDT 2016
Hi,
I'll relax the test and make it a warning. But the AS VR does not permit a
field value of 0000.
-bert
On Tue, Jul 26, 2016 at 1:05 PM, Daniel Marchand <daniel at biospective.com>
wrote:
> 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
> _______________________________________________
> MINC-users at bic.mni.mcgill.ca
> http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-users
>
More information about the MINC-users
mailing list