[vtkusers] Extent, not WholeExtent, Not UpdateExtent, Just Extent

John Biddiscombe jbiddiscombe at skippingmouse.co.uk
Thu Jan 4 17:26:24 EST 2001


I've recently been using a bunch of image filter I wrote a while ago and 
haven't touched for ages. Many of them have symptoms like....

Don't execute ever ever at all.
Execute every time the pipeline updates, even when not modified.

It seems to be caused by the Extent being set to
   Extent 0,-1,0,-1,0,-1,
Which causes GetDimensions to return duff values too.
Who is doing this? and what should I be doing to stop it. a typical filter 
has this...

void vtkPopulationCountFilter::ExecuteInformation(void) {
     //
     vtkImageData *pop = this->GetPopulation();
     vtkImageData *cov = this->GetCoverage();
     vtkImageData *output = this->GetOutput();
     //
     float spacing[3], spa1[3], spa2[3], origin1[3], origin2[3];
     int   pwholeExtent[6], cwholeExtent[6];
     //
     if (!pop || !cov || !output) return;
     pop->GetWholeExtent(pwholeExtent);
     cov->GetWholeExtent(cwholeExtent);
     pop->GetSpacing(spa1); pop->GetOrigin(origin1);
     cov->GetSpacing(spa2); cov->GetOrigin(origin2);
     //
     this->valid = true;
     for (int j=0; j<3; j++) {
         if (spa1[j]    != spa2[j])    valid = false;
         if (origin1[j] != origin2[j]) valid = false;
         if (pwholeExtent[j*2]   != cwholeExtent[j*2]) valid = false;
         if (pwholeExtent[j*2+1] != cwholeExtent[j*2+1]) valid = false;
     }
     if (!this->valid) {
         vtkErrorMacro(<< "DataSets were not consistent");
         output->SetUpdateExtent(0,-1, 0,-1, 0,-1);
         return;
     }
     //
     int   newwholeExtent[6];
     newwholeExtent[0]  = 0;
     newwholeExtent[1]  = 
(1+pwholeExtent[1]-pwholeExtent[0])/PixelAveraging[0] - 1;
     newwholeExtent[2]  = 0;
     newwholeExtent[3]  = 
(1+pwholeExtent[3]-pwholeExtent[2])/PixelAveraging[1] - 1;
     newwholeExtent[4]  = 0;
     newwholeExtent[5]  = 0;
     spacing[0]      = spa1[0]*PixelAveraging[0];
     spacing[1]      = spa1[1]*PixelAveraging[1];
     spacing[2]      = 1;
     //
     output->SetWholeExtent(newwholeExtent);
     output->SetExtent(newwholeExtent);
     output->SetOrigin(origin1);
     output->SetSpacing(spacing);
     output->SetScalarType(VTK_FLOAT);
     output->SetNumberOfScalarComponents(1);
     output->AllocateScalars();
}

which must cover most bases.

and this

void vtkPopulationCountFilter::ComputeInputUpdateExtent(int inExt[6], int 
outExt[6], int whichInput) {
     // whichInput is irrelevant to us as both are supposed to be the same
     for (int i = 0; i<2; ++i) {
         // For Min.
         inExt[i*2]   = outExt[i*2]   * PixelAveraging[i];
         inExt[i*2+1] = (outExt[i*2+1]+1) * PixelAveraging[i]-1;
     }
     inExt[4] = outExt[4];
     inExt[5] = outExt[5];
}
//-----------------------------------------------------------------------

So who is setting my Extent to some bogus stuff ?

Anyone know what I've missed. I suspect something has changed in the 
implementations somewhere.....

thanks

John B





More information about the vtkusers mailing list