Imaging/vtkImageReslice.cxx
int vtkResliceGetNextExtent(vtkImageStencilData *stencil,
                            int &r1, int &r2, int rmin, int rmax,
                            int yIdx, int zIdx, 
                            void *&outPtr, void *background, 
                            int numscalars,
                            void (*setpixels)(void *&out,
                                              const void *in,
                                              int numscalars,
                                              int n),
                            int &iter)
{
  // trivial case if stencil is not set
  if (!stencil)
    {
    if (iter++ == 0)
      {
      r1 = rmin;
      r2 = rmax;
      return 1;
      }
    return 0;
    }

  // for clearing, start at last r2 plus 1
  int clear1 = r2 + 1;
  if (iter == 0)
    { // if no 'last time', start at rmin
    clear1 = rmin;
    }

  int rval = stencil->GetNextExtent(r1, r2, rmin, rmax, yIdx, zIdx, iter);
  int clear2 = r1 - 1;
  if (rval == 0)
    {
    clear2 = rmax;
    }

  setpixels(outPtr, background, numscalars, clear2 - clear1 + 1);

  return rval;
}
//----------------------------------------------------------------------------
// helper function for clipping of the output with a stencil
helper function for clipping of the output with a stencil
helper function for clipping of the output with a stencil
int vtkResliceGetNextExtent(vtkImageStencilData *stencil,
                            int &r1, int &r2, int rmin, int rmax,
                            int yIdx, int zIdx, 
                            void *&outPtr, void *background, 
                            int numscalars,
                            void (*setpixels)(void *&out,
                                              const void *in,
                                              int numscalars,
                                              int n),
                            int &iter)
{
  if (!stencil)
    {
    if (iter++ == 0)
      {
      r1 = rmin;
      r2 = rmax;
      return 1;
      }
    return 0;
    }
  int clear1 = r2 + 1;
  if (iter == 0)
    { 
    clear1 = rmin;
    }
  int rval = stencil->GetNextExtent(r1, r2, rmin, rmax, yIdx, zIdx, iter);
  int clear2 = r1 - 1;
  if (rval == 0)
    {
    clear2 = rmax;
    }
  setpixels(outPtr, background, numscalars, clear2 - clear1 + 1);
  return rval;
}
int vtkResliceGetNextExtent ( vtkImageStencilData * stencil , int & r1 , int & r2 , int rmin , int rmax , int yIdx , int zIdx , void * & outPtr , void * background , int numscalars , void ( * setpixels ) ( void * & out , const void * in , int numscalars , int n ) , int & iter ) { if ( ! stencil ) { if ( iter ++ == 0 ) { r1 = rmin ; r2 = rmax ; return 1 ; } return 0 ; } int clear1 = r2 + 1 ; if ( iter == 0 ) { clear1 = rmin ; } int rval = stencil -> GetNextExtent ( r1 , r2 , rmin , rmax , yIdx , zIdx , iter ) ; int clear2 = r1 - 1 ; if ( rval == 0 ) { clear2 = rmax ; } setpixels ( outPtr , background , numscalars , clear2 - clear1 + 1 ) ; return rval ; }
helper function for clipping of the output with a stencil
helper function for clipping of the output with a stencil
// trivial case if stencil is not set // for clearing, start at last r2 plus 1 // if no 'last time', start at rmin