Imaging/vtkImageReslice.cxx
//----------------------------------------------------------------------------
// This function simply clears the entire output to the background color,
// for cases where the transformation places the output extent completely
// outside of the input extent.
This function simply clears the entire output to the background color,
for cases where the transformation places the output extent completely
outside of the input extent.
This function simply clears the entire output to the background color for cases where the transformation places the output extent completely outside of the input extent .
void vtkImageResliceClearExecute(vtkImageReslice *self,
                                 vtkImageData *, void *,
                                 vtkImageData *outData, void *outPtr,
                                 int outExt[6], int id)
{
  int numscalars;
  int idY, idZ;
  vtkIdType outIncX, outIncY, outIncZ;
  int scalarSize;
  unsigned long count = 0;
  unsigned long target;
  void *background;
  void (*setpixels)(void *&out, const void *in, int numscalars, int n);
  target = static_cast<unsigned long>
    ((outExt[5]-outExt[4]+1)*(outExt[3]-outExt[2]+1)/50.0);
  target++;
  outData->GetContinuousIncrements(outExt, outIncX, outIncY, outIncZ);
  scalarSize = outData->GetScalarSize();
  numscalars = outData->GetNumberOfScalarComponents();
  vtkAllocBackgroundPixel(self, &background, numscalars);
  vtkGetSetPixelsFunc(self, &setpixels);
  for (idZ = outExt[4]; idZ <= outExt[5]; idZ++)
    {
    for (idY = outExt[2]; idY <= outExt[3]; idY++)
      {
      if (id == 0) 
        { 
        if (!(count%target)) 
          {
          self->UpdateProgress(count/(50.0*target));
          }
        count++;
        }
      setpixels(outPtr, background, numscalars, outExt[1]-outExt[0]+1);
      outPtr = static_cast<void *>(
        static_cast<char *>(outPtr) + outIncY*scalarSize);
      }
    outPtr = static_cast<void *>(
      static_cast<char *>(outPtr) + outIncZ*scalarSize);
    }
  vtkFreeBackgroundPixel(self, &background);
}
void vtkImageResliceClearExecute ( vtkImageReslice * self , vtkImageData * , void * , vtkImageData * outData , void * outPtr , int outExt [ 6 ] , int id ) { int numscalars ; int idY , idZ ; vtkIdType outIncX , outIncY , outIncZ ; int scalarSize ; unsigned long count = 0 ; unsigned long target ; void * background ; void ( * setpixels ) ( void * & out , const void * in , int numscalars , int n ) ; target = static_cast < unsigned long > ( ( outExt [ 5 ] - outExt [ 4 ] + 1 ) * ( outExt [ 3 ] - outExt [ 2 ] + 1 ) / 50.0 ) ; target ++ ; outData -> GetContinuousIncrements ( outExt , outIncX , outIncY , outIncZ ) ; scalarSize = outData -> GetScalarSize ( ) ; numscalars = outData -> GetNumberOfScalarComponents ( ) ; vtkAllocBackgroundPixel ( self , & background , numscalars ) ; vtkGetSetPixelsFunc ( self , & setpixels ) ; for ( idZ = outExt [ 4 ] ; idZ <= outExt [ 5 ] ; idZ ++ ) { for ( idY = outExt [ 2 ] ; idY <= outExt [ 3 ] ; idY ++ ) { if ( id == 0 ) { if ( ! ( count % target ) ) { self -> UpdateProgress ( count / ( 50.0 * target ) ) ; } count ++ ; } setpixels ( outPtr , background , numscalars , outExt [ 1 ] - outExt [ 0 ] + 1 ) ; outPtr = static_cast < void * > ( static_cast < char * > ( outPtr ) + outIncY * scalarSize ) ; } outPtr = static_cast < void * > ( static_cast < char * > ( outPtr ) + outIncZ * scalarSize ) ; } vtkFreeBackgroundPixel ( self , & background ) ; }
This function simply clears the entire output to the background color,
for cases where the transformation places the output extent completely
outside of the input extent.
This function simply clears the entire output to the background color for cases where the transformation places the output extent completely outside of the input extent .
// for the progress meter // Get Increments to march through data  // allocate a voxel to copy into the background (out-of-bounds) regions // get the appropriate function for pixel copying // Loop through output voxels // update the progress if this is the main thread // clear the pixels to background color and go to next row