Values read from texture incorrect?

New Message Reply Date view Thread view Subject view Author view

Stefan van der Heijden (Stefan.vdHeijden@best.ms.philips.com)
Tue, 20 Jul 1999 12:32:36 +0200


Hello you all
I made a function to determine the histogram of a volume
I created a volume with 8 blocks of 16*16*16 with greyvalues varying
for 15 to 255
When i call the determine_histogram function(see below) the result
showns no values lower then 127,although i see in the volumeview the
values
the values in the volume which are lower then 127 are summed with the
values higher then 127 (e.g. greyvalue 15 is summed in 127+15)
When in do the same thing to the raw data before i write it to the
texture the histogram is correct.
Does anybody have an id how to get the job done???
regards
stefan

void Determine_Histogram()
{
  int sum=0;
    for (int i =0 ;i<256;i++)Hist[i]=0;;
    MaxHistval=0;
    voBrickSetIterator brickSetIter(aVolume->getCurrentBrickSet());
    for (voBrick * brick; brick = brickSetIter();) {

 int xBrickOrigin, yBrickOrigin, zBrickOrigin;
 int xBrickSize, yBrickSize, zBrickSize;

 void *vdata = brick->getDataPtr();
 unsigned char *start;
 // get brick sizes -- they may different than those requested
 brick->getBrickSizes(xBrickOrigin, yBrickOrigin, zBrickOrigin,
        xBrickSize, yBrickSize, zBrickSize);
 start =(unsigned char *)vdata;

 for ( i =0 ;i<xBrickSize*yBrickSize*zBrickSize;i++)
 Hist[(int)*(start+i)]++;
 for ( i =0 ;i<256;i++)
     {
     sum+=Hist[i];
     if (Hist[i]>MaxHistval){MaxHistval=Hist[i];}
 }

    }
printf( "Number of Voxels %d\n",sum);
}

--
J.W.M  v/d Heijden      -oOo-@-@-oOo-
XRD Predevelopment                      Philips Medical Systems
Building QJ2327, Veenpluis 2, Best, The Netherlands
Phone: +31-40-2762275   Fax  : +31-40-2765657
mailto:Stefan.vdHeijden@best.ms.philips.com
http://members.xoom.com/AxeCrazy
Just a memory remains....

New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Mon Nov 01 1999 - 14:11:13 PST