[vtkusers] Extent / Pipeline Problem with vtk 6.1

Frese Daniel Dr. frese at heidenhain.de
Wed Jul 2 08:01:20 EDT 2014


Hi Goodwin,

thank you for your feedback. I’ll try again with a more recent snapshot, and if the problem persists, I’ll file a bug.

Daniel

Von: Goodwin Lawlor [mailto:goodwin.lawlor.lists at gmail.com]
Gesendet: Mittwoch, 2. Juli 2014 12:39
An: Frese Daniel Dr.
Cc: vtkusers at vtk.org
Betreff: Re: [vtkusers] Extent / Pipeline Problem with vtk 6.1

Hi Daniel,

On quick inspection this looks like a bug in vtkImageMapToColors not handling the output info. You could file a bug here: http://vtk.org/Bug

hth

Goodwin

On Mon, Jun 30, 2014 at 2:23 PM, Frese Daniel Dr. <frese at heidenhain.de<mailto:frese at heidenhain.de>> wrote:
Hi everybody,

After porting a working application from vtk 5.x to vtk 6.1, I ran into some problems that I can’t solve by myself. Based on the error messages, I think though, it originates in the modified pipeline behavior of vtk 6.1 (admittedly I use an already aged snapshot from November 2013).

I tried to assemble a more or less minimal example to illustrate the problem. Basically I use the pipeline
vtkImageCanvasSource2D -> vtkImageMapToColors -> vtkImageViewer2.
If I visualize the canvas, without passing through the vtkImageMapToColors filter, everything works fine. If I pass through the vtkImageMapToColors filter, I get a blank render window and the error message :
“vtkTrivialProducer (00F15A08) : This data object does not contain the requested extent.”

I printed out the vtkInformation objects of the canvas’ output port and the the vtkImageMapToColors’ input port, and both outputs showed the correct extents for WHOLE_EXTENT and UPDATE_EXTENT, but wrong values for COMBINED_UPDATE_EXTENT. Moreover, canvas->GetOutput()->Print() gives also the right extents, whereas the output of the the vtkImageMapToColors shows that basically no meta information has been transmitted.

The complete code is below. Does anybody have a clue, what I am missing here ?

Thank you,
Daniel


#include <vtkAutoInit.h>
VTK_MODULE_INIT(vtkInteractionStyle);
VTK_MODULE_INIT(vtkRenderingOpenGL);

#include <vtkSmartPointer.h>
#include <vtkLookupTable.h>
#include <vtkImageCanvasSource2D.h>
#include <vtkImageMapToColors.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkImageViewer2.h>
#include <vtkRenderer.h>
#include <vtkInformation.h>
#include <vtkImageData.h>

void main() {
      // Creation of canvas drawing
      vtkSmartPointer<vtkImageCanvasSource2D> canvas = vtkSmartPointer<vtkImageCanvasSource2D>::New();
      canvas->SetScalarTypeToUnsignedChar();
      canvas->SetExtent(0, 99, 0, 99, 0, 0);
      canvas->SetDrawColor(255);
      canvas->DrawSegment(10, 10, 90, 90);
      canvas->Update();
      // canvas->GetOutputInformation(0)->Print(cout); // debug output shows : correct WHOLE_EXTENT / UPDATE_EXTENT

      // Map colors
      vtkSmartPointer<vtkLookupTable> lut = vtkSmartPointer<vtkLookupTable>::New();
      lut->SetNumberOfColors(256);
      lut->SetTableRange(0, 255);
      lut->SetValueRange(0, 255);
      lut->Build();
      for (int i=0; i<256; i++) lut->SetTableValue(i, i/255.0, 0, 0, 1);

      vtkSmartPointer<vtkImageMapToColors> color = vtkSmartPointer<vtkImageMapToColors>::New();
      color->SetLookupTable(lut);
      color->SetInputConnection(canvas->GetOutputPort());
      // color->GetInputInformation()->Print(cout); // debug output shows : correct WHOLE_EXTENT / UPDATE_EXTENT
      // color->GetOutput()->Print(cout); // debug output shows : Extent wrong !

      // Display the result
      vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor = vtkSmartPointer<vtkRenderWindowInteractor>::New();
      vtkSmartPointer<vtkImageViewer2> imageViewer = vtkSmartPointer<vtkImageViewer2>::New();

      imageViewer->SetInputData(canvas->GetOutput());  // using this line, I get sensible output
      //imageViewer->SetInputData(color->GetOutput());  // using this line, I get an empty viewer and an error message

      imageViewer->SetupInteractor(renderWindowInteractor);
      imageViewer->GetRenderer()->ResetCamera();

      renderWindowInteractor->Initialize();
      renderWindowInteractor->Start();
}



------------------------------------------------------------------------------------------------------
Registergericht: Traunstein / Registry Court: HRB 275 - Sitz / Head Office: Traunreut
Aufsichtsratsvorsitzender / Chairman of Supervisory Board: Rainer Burkhard
Geschäftsführung / Management Board: Thomas Sesselmann (Vorsitzender / Chairman),
Michael Grimm, Matthias Fauser, Sebastian Tondorf

E-Mail Haftungsausschluss / E-Mail Disclaimer: http://www.heidenhain.de/disclaimer

_______________________________________________
Powered by www.kitware.com<http://www.kitware.com>

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers

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


More information about the vtkusers mailing list