Update extent does not lie within whole extent

Lisa Sobierajski Avila lisa.avila at kitware.com
Wed Apr 26 16:10:43 EDT 2000


Hello John,

No - setting the output's update extent to the whole extent is not the 
answer. The problem is on your input update extents that you are asking 
for. You need a ComputeInputUpdateExtent method like the one here from 
vtkImageShrink3D:



void vtkImageShrink3D::ComputeInputUpdateExtent(int inExt[6],
                                                 int outExt[6])
{
   int idx;

   for (idx = 0; idx < 3; ++idx)
     {
     // For Min.
     inExt[idx*2] = outExt[idx*2] * this->ShrinkFactors[idx]
       + this->Shift[idx];
     // For Max.
     inExt[idx*2+1] = outExt[idx*2+1] * this->ShrinkFactors[idx]
       + this->Shift[idx];
     // If we are not sub sampling, we need a little more
     if (this->Mean || this->Minimum || this->Maximum || this->Median)
       {
       inExt[idx*2+1] += this->ShrinkFactors[idx] - 1;
       }
     }
}


This is used during PropagateUpdateExtent to know what update extent to 
propagate to the inputs given the update extent of the output. The default 
behavior is to ask for the same input update extent as the output update 
extent, but in your case that is a bad default.

Lisa


At 01:57 PM 4/26/00, John Biddiscombe wrote:
>Lisa,
>
>Seems to be a problem here...
>
> > Keep
> > in mind that if your filter shrinks data by a factor of 2, then you must
>be
> > expanding your update extent by a factor of 2 during the
> > PropogateUpdateExtent. Is it possible that you are asking for more data
>
>here's my ExecuteInformation call...
>     //
>     vtkImageData *pop = this->GetPopulation();
>     vtkImageData *cov = this->GetCoverage();
>     vtkImageData *output = this->GetOutput();
>     //
>     float spacing[3], spa1[3], spa2[3], origin1[3], origin2[3];
>     int   wholeExtent[6], dims1[3], dims2[3];
>     //
>     pop->GetWholeExtent(wholeExtent);
>     pop->GetSpacing(spa1); pop->GetDimensions(dims1);
>pop->GetOrigin(origin1);
>     cov->GetSpacing(spa2); cov->GetDimensions(dims2);
>cov->GetOrigin(origin2);
>     //
>     bool valid = true;
>     for (int j=0; j<3; j++) {
>         if (spa1[j]    != spa2[j])    valid = false;
>         if (dims1[j]   != dims2[j])   valid = false;
>         if (origin1[j] != origin2[j]) valid = false;
>     }
>     if (!valid) {
>         vtkErrorMacro(<< "DataSets were not consistent");
>         return;
>     }
>     //
>     wholeExtent[1]  = wholeExtent[1]/PixelAveraging[0];
>     wholeExtent[3]  = wholeExtent[3]/PixelAveraging[1];
>     spacing[0]      = spa1[0]*PixelAveraging[0];
>     spacing[1]      = spa1[1]*PixelAveraging[1];
>     spacing[2]      = 1;
>     //
>     output->SetWholeExtent(wholeExtent);
>     output->SetDimensions(wholeExtent[1]-wholeExtent[0]+1,
>wholeExtent[3]-wholeExtent[2]+1, 1);
>     output->SetSpacing(spacing);
>     output->SetScalarType(VTK_FLOAT);
>     output->SetNumberOfScalarComponents(1);
>
>The pixelAveraging just tells the routine to make the output smaller than
>the input datasets. At no point to I ever tell UpdateExtent anything at all.
>This is all handled by the ancestral vtkTwoImageInput and vtkImageFilter -
>no?
>
>I was under the impresion that updateextent was used by the multithreading
>code to divide up the image?
>
>shall I just add
>     output->SetUpdateExtent(wholeExtent);
>to the code and stop worrying?
>
>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>
>To UNSUBSCRIBE, send message body containing "unsubscribe vtkusers" to
><majordomo at public.kitware.com>. For help, send message body containing
>"info vtkusers" to the same address.
>--------------------------------------------------------------------


--------------------------------------------------------------------
This is the private VTK discussion list. Please keep messages on-topic.
Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
To UNSUBSCRIBE, send message body containing "unsubscribe vtkusers" to
<majordomo at public.kitware.com>. For help, send message body containing
"info vtkusers" to the same address.
--------------------------------------------------------------------



More information about the vtkusers mailing list