[Dcmlib] acccessing raw data

Peter Gall peter.gall at klinikum.uni-freiburg.de
Fri Apr 17 14:20:31 CEST 2009


Hi,

I have a problem accessing the values in the raw data. I guess it's  
got to do with the fact that don't clearly understand the dicom  
format. However, I only need the short piece of code below to be  
working. I'd very much appreciate any help. All I want is to get the  
values of the dicom image in the double **dat array.

long N = image.GetBufferLength();

numdim = image.GetNumberOfDimensions();

const unsigned int *sizes = new unsigned int[numdim];

sizes = image.GetDimensions();

char *imageData = new char[N];

image.GetBuffer(imageData);

double vv;
int ind;
for(int row=0; row<sizes[0]; row++)
{
	for(int col=0; col<sizes[1]; col++)
	{
		ind = (row + col*sizes[0]);
		vv = ( (double)((unsigned char)imageData[2*ind])) *256.0 +(double) 
((unsigned char)imageData[2*ind+1] ) ;
		dat[row][col] = vv;
	}
}


thank you very much,
Peter




More information about the Dcmlib mailing list