[vtkusers] Extent, not WholeExtent, Not UpdateExtent, Just Extent
Charles Law
charles.law at kitware.com
Fri Jan 5 08:11:06 EST 2001
John,
My first guess would be that the whole extent is not being set
properly. By default, "WholeExtent" (set in execute information) is copied
to UpdateExtent which is copied to Extent. However, your
ExecuteInformation call below seems to be setting the WholeExtent
properly. Maybe the inputs whole extent is not correct.
Here are a few notes about what has changed recently:
In the past, an UpdateExtent of 0 -1 0 -1 0 -1 was an indication that the
data objects UpdateExtent was not initialized and caused the UpdateExtent
to be set to the WholeExtent.
Now, there is a flag "UpdateExtentInitialized" that marks this state. If
the update extent is set to 0 -1 0 -1 0 -1, then no data is being requested
and the filter will not execute.
I can not tell exactly what is going on by the included code, but I notice
you are setting the extent in the ExecuteInformation method. As a part of
the data objects "UpdateData" call, the UpdateExtent is copied to the
Extent. Setting the Extent in ExecuteInformation does nothing. There is a
way to specify that the output extent will be larger than the requested
"UpdateExtent", but I will not go into that. There are a couple of notes
below.
Charles.
At 10:26 PM 1/4/01 +0000, John Biddiscombe wrote:
>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);
^^^^^^^^ Does nothing ^^^^^^^^^^
> output->SetOrigin(origin1);
> output->SetSpacing(spacing);
> output->SetScalarType(VTK_FLOAT);
> output->SetNumberOfScalarComponents(1);
> output->AllocateScalars();
^^^^^^^^ You do not need to allocate here. The superclass allocates before
execute is called.
This may be why your filters are re executing.
>}
>
>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
>
>
>_______________________________________________
>This is the private VTK discussion list. Please keep messages on-topic.
>Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
>Follow this link to subscribe/unsubscribe:
>http://public.kitware.com/mailman/listinfo/vtkusers
More information about the vtkusers
mailing list