[Gate-users] Voxelized phantom and interfile format conversion
Alex
piratemp at gmail.com
Fri Sep 30 12:54:16 CEST 2011
Hello:
1> I think this question might have been raised before. Nevertheless, I
still struggle with it. Basically I want to convert the Zubal torso phantom
(8bit unsigned raw) into the interfile format used by GATE (uint16). Some
has suggested using MATHLAB, others have suggested xmedcon. The problem
with xmedcon is that there is o uint16 output option (as far as I know). So
far, I have converted to signed 16 using xmedcon. I am not familiar with
MATHLAB but to convert from signed to unsigned 16, is it as simple as type
casting into unsigned 16 such as below.
intArray = uint16(array);
2> One can accomplish the same thing with C/C++ by simple static cast?
(assuming that int is 16 bit for my compiler)
y = (unsigned int) x;
3> Also, naively, since pixel value ranges for signed 16 goes from -32768 to
32767 and unsigned from 0 to 65535, can one simply convert by this simple C
snippet:
unsigned int y; // -32768 to 32767
int x = a; // 0 to 65535
y = (unsigned int) (x + 32768);
4> If simple conversion by type casting is possible, I guess I can bypass
xmedcon and simply convert directly from 8bit raw data to uint16?
Thanks in advance,
Alex
ECU Medical Physics Student.
More information about the Gate-users
mailing list