[vtkusers] Extents update problem in vtkOutlineCornerFilter

Nigel Mcfarlane Nigel.Mcfarlane at beds.ac.uk
Mon Sep 7 07:23:00 EDT 2015


Dear VTK Users,
I am having problems updating the extents on vtkOutlineCornerFilter when the input image changes.  The code below reads an image and displays its bounding box with  vtkOutlineCornerFilter.   Then it changes the filename to an image with different dimensions and executes the render loop again.  An error message is displayed: "Update extent ... outside WholeExtent".  If a corresponding slice view is added using vtkImageSliceMapper, the slice updates perfectly but the outline box does not.

    //---------------------------------------------------------------
    // Create the visual pipe
    //---------------------------------------------------------------
    vtkStructuredPointsReader *reader = vtkStructuredPointsReader::New();
    reader->SetFileName(fname2.c_str());

    vtkOutlineCornerFilter* ocf = vtkOutlineCornerFilter::New();
    ocf->SetInputConnection(reader->GetOutputPort());

    vtkPolyDataMapper* mapper = vtkPolyDataMapper::New();
    mapper->SetInputConnection(ocf->GetOutputPort());

    vtkActor *actor = vtkActor::New();
    actor->SetMapper(mapper);

    Renderer->AddActor(actor);


    // -------------------------------
    // Render loop 1
    // Enter 'e' to exit and continue
    // -------------------------------
    RWI->Initialize();
    RWI->Start();


    //---------------------------------------------------------------
    // Render loop 2
    // Change the filename and render again
    //---------------------------------------------------------------
    reader->SetFileName(fname1.c_str());

    RWI->Initialize();
    RWI->Start();


This appears to be the same as a the problem with vtkAppendPolyData which I reported on 6/8/15: http://public.kitware.com/pipermail/vtkusers/2015-August/091772.html and which was fixed by Dan Lipsa as bug #15662.  I copied this bug fix into vtkOutlineCornerFilter and it fixed the problem:

int vtkOutlineCornerFilter::RequestUpdateExtent(vtkInformation *vtkNotUsed(request),
  vtkInformationVector **inputVector,
  vtkInformationVector *outputVector)
{
  vtkInformation* req = vtkInformation::New(); // because we can't pass the "unused" argument
  int retVal = vtkPolyDataAlgorithm::RequestUpdateExtent(req, inputVector, outputVector);
  req->Delete();


  vtkInformation * inputInfo = inputVector[0]->GetInformationObject(0);
  if (inputInfo->Has(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT()))
  {
    int ext[6];
    inputInfo->Get(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT(), ext);
    inputInfo->Set(vtkStreamingDemandDrivenPipeline::UPDATE_EXTENT(), ext, 6);
  }
  return retVal;
}


However, unlike vtkAppendPolyData,  vtkOutlineCornerFilter does not have its own RequestUpateExptent() - it inherits it from vtkPolyDataAlgorithm.  The code above solves my immediate problem but it is a bodge: an override which calls the base class and appends a fix.  Is there an underlying problem in vtkPolyDataAlgorithm?

Regards
Nigel McFarlane
University of Bedfordshire UK



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20150907/7f9998fd/attachment.html>


More information about the vtkusers mailing list