[vtkusers] vtkImageViewer2 show glyph graph , " 0 connections but is not optional" error occur

甘建红 76565122 at qq.com
Wed Dec 11 22:38:16 EST 2013


hi all
     I am using vtkImageViewer2 to show arrows which generated by glyph class, and use vtkImageViewer2's GetRender()->addActor. But my 
 programe always tells error "ERROR: In D:\VTK\VTK5.10.1
 \Filtering\vtkDemandDrivenPipeline.cxx, line 727
vtkStreamingDemandDrivenPipeline (02C6E798): Input port 0 of algorithm 
 vtkImageMapToWindowLevelColors(02C98638) has 0 connections but is not optional." . 
 SO I hope get the helps from all of you, and thans to you for the advises in advance.
 
 the main code is given as following:
  
 vtkSmartPointer<vtkImageViewer2> m_pImageViewer;
m_pImageViewer=vtkSmartPointer<vtkImageViewer2>::New();
 vtkSmartPointer<vtkGlyph3D> glyphFilter = vtkSmartPointer<vtkGlyph3D>::New();
   glyphFilter->SetSourceConnection(arrowSource-
 >GetOutputPort());
   glyphFilter->OrientOn();  
   glyphFilter->SetVectorModeToUseVector();
   glyphFilter->SetScaleModeToScaleByScalar(); 
   glyphFilter->SetColorModeToColorByScalar(); 
   glyphFilter->SetScaleFactor(5); 
 glyphFilter->SetInputConnection(maskP->GetOutputPort());
 vtkSmartPointer<vtkImageSliceMapper> imageMapper = 
 vtkSmartPointer<vtkImageSliceMapper>::New();
imageMapper->SetInputConnection(vtkImporter->GetOutput()->GetProducerPort());
 vtkSmartPointer<vtkLookupTable> Lut=vtkSmartPointer<vtkLookupTable>::New();
   Lut->SetTableRange(-20,20);//(lo,hi);//(0,60);// 
    Lut->SetHueRange(0,1);
   Lut->SetSaturationRange(1,1);
   Lut->SetValueRange(1,1);  //////////
   Lut->SetAlpha(1);   
   Lut->SetValueRange(-20,60);
   Lut->SetNumberOfTableValues(25600);
   Lut->SetRange(-20,60);
   Lut->SetVectorMode(vtkScalarsToColors::MAGNITUDE);
   Lut->Build(); 
 vtkSmartPointer<vtkPolyDataMapper2D> vectorMapper = 
 vtkSmartPointer<vtkPolyDataMapper2D>::New();
   vectorMapper->SetInputConnection(glyphFilter-
 >GetOutputPort());
   vectorMapper->SetScalarRange(-20,20);//(lo,hi);
   vectorMapper->ScalarVisibilityOn();  
   vectorMapper->SetLookupTable(Lut);
   vectorMapper->SetScalarModeToUsePointFieldData();
   vectorMapper->ColorByArrayComponent("ColorValue",3);
   vectorMapper->SetColorModeToMapScalars();
 vectorMapper->UseLookupTableScalarRangeOn();   
   vectorMapper->ScalarVisibilityOn();
    vtkSmartPointer<vtkActor2D> vectorActor = 
 vtkSmartPointer<vtkActor2D>::New();
   vectorActor->SetMapper(vectorMapper);
 m_pImageViewer->GetRenderer()->AddActor(vectorActor);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20131212/3e6d8065/attachment.htm>


More information about the vtkusers mailing list