Hi, I am currently writing a program which uses the (x)medcon library version 0.9.1 for reading and processing DICOM images. Now I observed unexpected behavior when it comes to localization. Here is some bare bone sample code to demonstrate the problem. It takes the DICOM filename as argument and prints out the x, y and z coordinates of the (first) image. --%<-------------- testit.c code ---------------->%-- /* filename: testit.c */ #include <stdio.h> #include <locale.h> #include "medcon.h" int main(int argc, char *argv[]) { int error; double x, y, z; FILEINFO fi; setlocale (LC_ALL, ""); MDC_INFO=MDC_NO; if (argc == 2 ) { /* open the file, initialize FILEINFO structure */ if ((error = MdcOpenFile(&fi, argv[1])) != MDC_OK) return (error); /* read the file */ if ((error = MdcReadFile(&fi,1)) != MDC_OK) return (error); x = fi.image[0].image_pos_pat[0]; y = fi.image[0].image_pos_pat[1]; z = fi.image[0].image_pos_pat[2]; printf ("x: %f\n", x); printf ("y: %f\n", y); printf ("z: %f\n", z); } return 0; } --%<------------ Makefile to build testit -------->%-- CC = gcc CCOPTS = -Wall -g CFLAGS = -DMDC_DEPEND_H $(CCOPTS) ### Give rootdir where MedCon was installed XMEDCONDIR = `xmedcon-config --prefix` XMEDCONLIB = -lmdc INCS = `xmedcon-config --cflags` LIBS = `xmedcon-config --libs` testit: testit.c $(CC) $(CFLAGS) $(INCS) -o testit testit.c $(LIBS) --%<---------------------------------------------->%-- Here is what happens on my system (Woody). Notice the differences in y and z for different locale settings. jsa@oest181:/home/jsa/temp> locale LANG=POSIX LC_CTYPE=de_DE LC_NUMERIC="POSIX" LC_TIME="POSIX" LC_COLLATE="POSIX" LC_MONETARY="POSIX" LC_MESSAGES="POSIX" LC_PAPER="POSIX" LC_NAME="POSIX" LC_ADDRESS="POSIX" LC_TELEPHONE="POSIX" LC_MEASUREMENT="POSIX" LC_IDENTIFICATION="POSIX" LC_ALL= jsa@oest181:/home/jsa/temp> ./testit image1.dcm x: -250.000000 y: -250.000000 z: -12.500000 jsa@oest181:/home/jsa/temp> export LC_ALL=de_DE jsa@oest181:/home/jsa/temp> locale LANG=POSIX LC_CTYPE="de_DE" LC_NUMERIC="de_DE" LC_TIME="de_DE" LC_COLLATE="de_DE" LC_MONETARY="de_DE" LC_MESSAGES="de_DE" LC_PAPER="de_DE" LC_NAME="de_DE" LC_ADDRESS="de_DE" LC_TELEPHONE="de_DE" LC_MEASUREMENT="de_DE" LC_IDENTIFICATION="de_DE" LC_ALL=de_DE jsa@oest181:/home/jsa/temp> ./testit image1.dcm x: -250,000000 y: 0,000000 z: 0,000000 Is this a bug in (x)medcon or am I missing something? Thanks in advance. Regards - Juergen -- GPG A997BA7A | 87FC DA31 5F00 C885 0DC3 E28F BD0D 4B33 A997 BA7A
Attachment:
pgpqkilT_bRgj.pgp
Description: PGP signature