[Dcmlib] acccessing raw data

Jean-Pierre.Roux at creatis.insa-lyon.fr Jean-Pierre.Roux at creatis.insa-lyon.fr
Fri Apr 17 14:26:57 CEST 2009


> Hi,
>

Hi, Peter,

Which version of gdcm are you using?
gdcm1.x, or gdcm2.x?

Jean-Pierre


> 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
>
> _______________________________________________
> Dcmlib mailing list
> Dcmlib at creatis.insa-lyon.fr
> http://www.creatis.insa-lyon.fr/mailman/listinfo/dcmlib
>




More information about the Dcmlib mailing list