Public Member Functions

mitk::ScalarBinaryToRGBAConverter< T, B > Class Template Reference

List of all members.

Public Member Functions

 ScalarBinaryToRGBAConverter (const T *_dataPtr, const B *_data2Ptr, unsigned char *_tmpPtr, int _sizeX, int _sizeY, int _sizeZ, mitk::TransferFunction::Pointer _tf)
float sample (int x, int y, int z)
bool sampleBinary (int x, int y, int z)
int clamp (int x)
void write (int x, int y, int z, float grayValue, float gx, float gy, float gz)
void compute (int x, int y, int z)
void computeClamp (int x, int y, int z)
void compute1D (int y, int z)
void computeClamp1D (int y, int z)
void computeClamp2D (int z)
void compute2D (int z)
void fillSlices ()

Detailed Description

template<class T, class B>
class mitk::ScalarBinaryToRGBAConverter< T, B >

Definition at line 301 of file mitkColourImageProcessor.cpp.


Constructor & Destructor Documentation

template<class T , class B >
mitk::ScalarBinaryToRGBAConverter< T, B >::ScalarBinaryToRGBAConverter ( const T *  _dataPtr,
const B *  _data2Ptr,
unsigned char *  _tmpPtr,
int  _sizeX,
int  _sizeY,
int  _sizeZ,
mitk::TransferFunction::Pointer  _tf 
) [inline]

Definition at line 317 of file mitkColourImageProcessor.cpp.

        :

  ScalarBinaryToRGBAConverter( const T *_dataPtr,const B *_data2Ptr,unsigned char *_tmpPtr,int _sizeX,int _sizeY,int _sizeZ,mitk::TransferFunction::Pointer _tf )
  {
    dataPtr=_dataPtr;
    data2Ptr=_data2Ptr;
    tmpPtr=_tmpPtr;
    sizeX=_sizeX;
    sizeY=_sizeY;
    sizeZ=_sizeZ;


Member Function Documentation

template<class T , class B >
int mitk::ScalarBinaryToRGBAConverter< T, B >::clamp ( int  x ) [inline]

Definition at line 344 of file mitkColourImageProcessor.cpp.

  {
    return data2Ptr[ x + y * sizeX + z * sizeXY ];
template<class T , class B >
void mitk::ScalarBinaryToRGBAConverter< T, B >::compute ( int  x,
int  y,
int  z 
) [inline]

Definition at line 393 of file mitkColourImageProcessor.cpp.

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

template<class T , class B >
void mitk::ScalarBinaryToRGBAConverter< T, B >::compute1D ( int  y,
int  z 
) [inline]

Definition at line 426 of file mitkColourImageProcessor.cpp.

  {
    int x;
    
    x=0;
    computeClamp(x,y,z);
    x++;
    
    while(x<sizeX-1)
    {
      compute(x,y,z);     
      x++;
    }
template<class T , class B >
void mitk::ScalarBinaryToRGBAConverter< T, B >::compute2D ( int  z ) [inline]

Definition at line 473 of file mitkColourImageProcessor.cpp.

References mitk::ScalarBinaryToRGBAConverter< T, B >::computeClamp1D().

    {
      computeClamp1D(y,z);     
      y++;
    }
  }
  
  inline void compute2D(int z)
  {
    int y;

    y=0;
    computeClamp1D(y,z);     
    y++;
    
    while(y<sizeY-1)
    {
      compute1D(y,z);     
      y++;
    }
template<class T , class B >
void mitk::ScalarBinaryToRGBAConverter< T, B >::computeClamp ( int  x,
int  y,
int  z 
) [inline]

Definition at line 406 of file mitkColourImageProcessor.cpp.

Referenced by mitk::ScalarBinaryToRGBAConverter< T, B >::computeClamp1D(), and mitk::ScalarBinaryToRGBAConverter< T, B >::computeClamp2D().

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

    if(x==0)            gx = 2.0f * ( sample(x+1,y,z) - grayValue       );
    else if(x==sizeXm1) gx = 2.0f * ( grayValue       - sample(x-1,y,z) );
    else                gx =          sample(x+1,y,z) - sample(x-1,y,z);
    
    if(y==0)            gy = 2.0f * ( sample(x,y+1,z) - grayValue       );
    else if(y==sizeYm1) gy = 2.0f * ( grayValue       - sample(x,y-1,z) );
    else                gy =          sample(x,y+1,z) - sample(x,y-1,z);
template<class T , class B >
void mitk::ScalarBinaryToRGBAConverter< T, B >::computeClamp1D ( int  y,
int  z 
) [inline]
template<class T , class B >
void mitk::ScalarBinaryToRGBAConverter< T, B >::computeClamp2D ( int  z ) [inline]

Definition at line 460 of file mitkColourImageProcessor.cpp.

References mitk::ScalarBinaryToRGBAConverter< T, B >::computeClamp().

    {
      computeClamp(x,y,z);     
      x++;
    }
  }      
        
  inline void computeClamp2D(int z)
  {
    int y;

    y=0;
template<class T , class B >
void mitk::ScalarBinaryToRGBAConverter< T, B >::fillSlices (  ) [inline]

Definition at line 494 of file mitkColourImageProcessor.cpp.

References mitk::ScalarBinaryToRGBAConverter< T, B >::computeClamp1D().

    {
      computeClamp1D(y,z);
      y++;
    }
  }
  
  inline void fillSlices()
  {
    int z;

    for(z=0;z<sizeZ;z++)
template<class T , class B >
float mitk::ScalarBinaryToRGBAConverter< T, B >::sample ( int  x,
int  y,
int  z 
) [inline]

Definition at line 334 of file mitkColourImageProcessor.cpp.

  {
template<class T , class B >
bool mitk::ScalarBinaryToRGBAConverter< T, B >::sampleBinary ( int  x,
int  y,
int  z 
) [inline]

Definition at line 339 of file mitkColourImageProcessor.cpp.

  {
template<class T , class B >
void mitk::ScalarBinaryToRGBAConverter< T, B >::write ( int  x,
int  y,
int  z,
float  grayValue,
float  gx,
float  gy,
float  gz 
) [inline]

Definition at line 350 of file mitkColourImageProcessor.cpp.

  {
    if(x<0) x=0; else if(x>255) x=255;
    return x;
  }
  
  inline void write(int x,int y,int z,float grayValue,float gx,float gy,float gz)
  {
    if(sampleBinary(x,y,z))
    {
      
   /*       
      gx /= aspect[0];
      gy /= aspect[1];
      gz /= aspect[2];
   */
      // Compute the gradient magnitude

      float t = sqrtf( gx*gx + gy*gy + gz*gz );

      int doff = x + y * sizeX + z * sizeXY;
      
      vtkPiecewiseFunction* opacityTransferFunction = tf->GetScalarOpacityFunction();
      vtkPiecewiseFunction* gradientTransferFunction = tf->GetGradientOpacityFunction();
      vtkColorTransferFunction* colorTransferFunction = tf->GetColorTransferFunction();

      double rgb[3];
      colorTransferFunction->GetColor( double(grayValue), rgb);
      
      double opacity= opacityTransferFunction->GetValue( double(grayValue) );
      
      opacity *= gradientTransferFunction->GetValue( double(0.5f*t) );
      
      tmpPtr[doff*4+0] = int( rgb[0]*255 + 0.5 );
      tmpPtr[doff*4+1] = int( rgb[1]*255 + 0.5 );
      tmpPtr[doff*4+2] = int( rgb[2]*255 + 0.5 );
      tmpPtr[doff*4+3] = int( opacity*255 + 0.5 );
    }
    else
    {

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