Public Member Functions

RGBACompute Class Reference

List of all members.

Public Member Functions

 RGBACompute (unsigned char *_dataPtr, unsigned char *_tmpPtr, unsigned char *_tmpPtr2, int _sizeX, int _sizeY, int _sizeZ, int _fullX, int _fullY, int _fullZ)
int sample (int x, int y, int z)
void fill (int x, int y, int z)
int clamp (int x)
void write (int x, int y, int z, int iGrayValue, int gx, int gy, int gz)
void compute (int x, int y, int z)
void computeClamp (int x, int y, int z)
void compute1D (int y, int z)
void fill1D (int y, int z)
void computeClamp1D (int y, int z)
void computeClamp2D (int z)
void compute2D (int z)
void fill2D (int z)
void fillSlices (int currentChunkStart, int currentChunkEnd)

Detailed Description

Definition at line 1120 of file vtkMitkOpenGLVolumeTextureMapper3D.cpp.


Constructor & Destructor Documentation

RGBACompute::RGBACompute ( unsigned char *  _dataPtr,
unsigned char *  _tmpPtr,
unsigned char *  _tmpPtr2,
int  _sizeX,
int  _sizeY,
int  _sizeZ,
int  _fullX,
int  _fullY,
int  _fullZ 
) [inline]

Definition at line 1143 of file vtkMitkOpenGLVolumeTextureMapper3D.cpp.

  {
    dataPtr=_dataPtr;
    tmpPtr=_tmpPtr;
    tmpPtr2=_tmpPtr2;
    sizeX=_sizeX;
    sizeY=_sizeY;
    sizeZ=_sizeZ;
    fullX=_fullX;
    fullY=_fullY;
    fullZ=_fullZ;

    sizeXY=sizeX*sizeY;
    sizeXm1=sizeX-1;
    sizeYm1=sizeY-1;
    sizeZm1=sizeZ-1;
    
    fullXY=fullX*fullY;
  }

Member Function Documentation

int RGBACompute::clamp ( int  x ) [inline]

Definition at line 1182 of file vtkMitkOpenGLVolumeTextureMapper3D.cpp.

Referenced by write().

  {
    if(x<0) x=0; else if(x>255) x=255;
    return x;
  }
void RGBACompute::compute ( int  x,
int  y,
int  z 
) [inline]

Definition at line 1223 of file vtkMitkOpenGLVolumeTextureMapper3D.cpp.

References sample(), and write().

Referenced by compute1D().

  {
    int grayValue = sample(x,y,z);
    int gx,gy,gz;

    gx = sample(x+1,y,z) - sample(x-1,y,z);
    gy = sample(x,y+1,z) - sample(x,y-1,z);
    gz = sample(x,y,z+1) - sample(x,y,z-1);
    
    write( x, y, z, grayValue, gx, gy, gz );
 
  }
void RGBACompute::compute1D ( int  y,
int  z 
) [inline]

Definition at line 1256 of file vtkMitkOpenGLVolumeTextureMapper3D.cpp.

References compute(), computeClamp(), and fill().

Referenced by compute2D().

  {
    int x=0;
    
    computeClamp(x,y,z);
    x++;
    
    while(x<sizeX-1) {
      compute(x,y,z);     
      x++;
    }
    
    if(x<sizeX) {
      computeClamp(x,y,z);
      x++;
    }

    while(x<fullX) {
      fill(x,y,z);
      x++;
    }
  }      
void RGBACompute::compute2D ( int  z ) [inline]

Definition at line 1320 of file vtkMitkOpenGLVolumeTextureMapper3D.cpp.

References compute1D(), computeClamp1D(), and fill1D().

Referenced by fillSlices().

  {
    int y=0;
    
    computeClamp1D(y,z);     
    y++;
    
    while(y<sizeY-1) {
      compute1D(y,z);     
      y++;
    }
    
    if(y<sizeY) {
      computeClamp1D(y,z);
      y++;
    }

    while(y<fullY) {
      fill1D(y,z);
      y++;
    }      
  }
void RGBACompute::computeClamp ( int  x,
int  y,
int  z 
) [inline]

Definition at line 1236 of file vtkMitkOpenGLVolumeTextureMapper3D.cpp.

References sample(), and write().

Referenced by compute1D(), and computeClamp1D().

  {
    int grayValue = sample(x,y,z);
    int gx,gy,gz;

    if(x==0)            gx = 2 * ( sample(x+1,y,z) - grayValue       );
    else if(x==sizeXm1) gx = 2 * ( grayValue       - sample(x-1,y,z) );
    else                gx =       sample(x+1,y,z) - sample(x-1,y,z);
    
    if(y==0)            gy = 2 * ( sample(x,y+1,z) - grayValue       );
    else if(y==sizeYm1) gy = 2 * ( grayValue       - sample(x,y-1,z) );
    else                gy =       sample(x,y+1,z) - sample(x,y-1,z);
    
    if(z==0)            gz = 2 * ( sample(x,y,z+1) - grayValue       );
    else if(z==sizeZm1) gz = 2 * ( grayValue       - sample(x,y,z-1) );
    else                gz =       sample(x,y,z+1) - sample(x,y,z-1);
    
    write( x, y, z, grayValue, gx, gy, gz );
  }
void RGBACompute::computeClamp1D ( int  y,
int  z 
) [inline]

Definition at line 1290 of file vtkMitkOpenGLVolumeTextureMapper3D.cpp.

References computeClamp(), and fill().

Referenced by compute2D(), and computeClamp2D().

  {
    int x=0;
    
    while(x<sizeX) {
      computeClamp(x,y,z);     
      x++;
    }

    while(x<fullX) {
      fill(x,y,z);
      x++;
    }
  }      
void RGBACompute::computeClamp2D ( int  z ) [inline]

Definition at line 1305 of file vtkMitkOpenGLVolumeTextureMapper3D.cpp.

References computeClamp1D(), and fill1D().

Referenced by fillSlices().

  {
    int y=0;

    while(y<sizeY) {
      computeClamp1D(y,z);     
      y++;
    }
    
    while(y<fullY) {
      fill1D(y,z);
      y++;
    }      
  }
void RGBACompute::fill ( int  x,
int  y,
int  z 
) [inline]

Definition at line 1168 of file vtkMitkOpenGLVolumeTextureMapper3D.cpp.

Referenced by compute1D(), computeClamp1D(), and fill1D().

  {
    int doff = x + y * fullX + (z-offZ) * fullXY;
    
    tmpPtr[doff*4+0]= 0;
    tmpPtr[doff*4+1]= 0;
    tmpPtr[doff*4+2]= 0;
    tmpPtr[doff*4+3]= 0;

    tmpPtr2[doff*3+0]= 0;
    tmpPtr2[doff*3+1]= 0;
    tmpPtr2[doff*3+2]= 0;       
  }
void RGBACompute::fill1D ( int  y,
int  z 
) [inline]

Definition at line 1279 of file vtkMitkOpenGLVolumeTextureMapper3D.cpp.

References fill().

Referenced by compute2D(), computeClamp2D(), and fill2D().

  {
    int x=0;
    
    while(x<fullX) {
      fill(x,y,z);
      x++;
    }
  }      
void RGBACompute::fill2D ( int  z ) [inline]

Definition at line 1343 of file vtkMitkOpenGLVolumeTextureMapper3D.cpp.

References fill1D().

Referenced by fillSlices().

  {
    int y=0;
    
    while(y<fullY) {
      fill1D(y,z);
      y++;
    }      
  }
void RGBACompute::fillSlices ( int  currentChunkStart,
int  currentChunkEnd 
) [inline]

Definition at line 1353 of file vtkMitkOpenGLVolumeTextureMapper3D.cpp.

References compute2D(), computeClamp2D(), and fill2D().

Referenced by vtkVolumeTextureMapper3DComputeRGBA().

  {
    offZ=currentChunkStart;

    #pragma omp parallel for
    for(int z=currentChunkStart;z<=currentChunkEnd;z++)
    {
      if(z==0 || z==sizeZ-1) computeClamp2D(z);
      else if(z>=sizeZ)      fill2D(z);
      else                   compute2D(z);
    }
  }    
int RGBACompute::sample ( int  x,
int  y,
int  z 
) [inline]

Definition at line 1163 of file vtkMitkOpenGLVolumeTextureMapper3D.cpp.

Referenced by compute(), and computeClamp().

  {
    return dataPtr[ ( x + y * sizeX + z * sizeXY ) * 4 +3 ];
  }
void RGBACompute::write ( int  x,
int  y,
int  z,
int  iGrayValue,
int  gx,
int  gy,
int  gz 
) [inline]

Definition at line 1188 of file vtkMitkOpenGLVolumeTextureMapper3D.cpp.

References clamp().

Referenced by compute(), and computeClamp().

  {
  
 /*       
    gx /= aspect[0];
    gy /= aspect[1];
    gz /= aspect[2];
 */
    int nx = static_cast<int>(0.5f*gx+127.5f);
    int ny = static_cast<int>(0.5f*gy+127.5f);
    int nz = static_cast<int>(0.5f*gz+127.5f);
    
    int doff = x + y * fullX + (z-offZ) * fullXY;
    
    //tmpPtr[doff*2+0]= 0;
       
    tmpPtr[doff*4+0]= clamp(nx);
    tmpPtr[doff*4+1]= clamp(ny);
    tmpPtr[doff*4+2]= clamp(nz);       
    tmpPtr[doff*4+3]= clamp(iGrayValue);

    int soff = x + y * sizeX + z * sizeXY;

    tmpPtr2[doff*3+0]= dataPtr[soff*4+0];
    tmpPtr2[doff*3+1]= dataPtr[soff*4+1];
    tmpPtr2[doff*3+2]= dataPtr[soff*4+2];       

/*
    if( z == fullZ/2 )
    if( y == fullY/2 )
      MITK_INFO << x << " " << y << " " << z << " : " << iGrayValue << " : " << iGradient;
  */  
  }

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines