[Dcmlib] GDCM 1.x does not support 12 bits

Mathieu Malaterre mathieu.malaterre at gmail.com
Wed Apr 23 14:30:59 CEST 2008


There is a bug in the unpacking of 12bits data:

http://gdcm.sourceforge.net/thingies/PHILIPS_MR_12Bits.acr

The unpacking routine should be something like that:

void myunpack(short *q, unsigned char *p, int n)
{
 unsigned char *end = p+n;
 unsigned char b0,b1,b2;

  while (p!=end)
  {
    b0 = *p++;
    b1 = *p++;
    b2 = *p++;
    *q++ =  ((b1 & 0xf) << 8) + b0;
    *q++ =  (b1>>4) + (b2<<4);
  }

}


-- 
Mathieu



More information about the Dcmlib mailing list