[vtkusers] how to handle an empty pipeline?
John Platt
jcplatt at dsl.pipex.com
Wed Oct 18 17:30:05 EDT 2017
Hi Steve,
In VTK 5.10, I use vtkDataSetSurfaceFilter2 which is identical to
vtkDataSetSurfaceFilter except for the following lines in RequestData()
which deal with the case of no cells to ensure the output is correctly
formed ...
if (numCells == 0)
{
output->CopyStructure( input );
output->GetPointData()->PassData( input->GetPointData() );
output->GetCellData()->PassData( input->GetCellData() );
return 1;
}
I have found some filters handle the case of no cells gracefully, others
bail out too soon leaving malformed output.
You could use vtkDataSetSurfaceFilter2 before the input to
vtkDataSetMapper in your pipeline which would send polydata into the mapper.
HTH,
John.
On 10/18/2017 6:59 PM, Langer, Stephen A. (Fed) wrote:
> Ok, thanks. I'll see how difficult that'll be in my case.
> The simple solution would be to just delete one line from vtkDataSetSurfaceFilter, but that'll make it harder to distribute my code.
>
> -- Steve
>
> On 10/18/17, 11:58 AM, "Andras Lasso" <lasso at queensu.ca> wrote:
>
> When the input is modified I call Update() on the filter and check the output to see if the result is empty.
>
> Andras
>
> -----Original Message-----
> From: Langer, Stephen A. (Fed) [mailto:stephen.langer at nist.gov]
> Sent: Wednesday, October 18, 2017 11:47 AM
> To: Andras Lasso <lasso at queensu.ca>; Bill Lorensen <bill.lorensen at gmail.com>
> Cc: vtkusers at vtk.org
> Subject: Re: [vtkusers] how to handle an empty pipeline?
>
> What do you do if you don't know that the pipeline will be empty? There might be a filter that doesn't pass any of the data, but the data source and the controlling code can't know that until the pipeline executes.
>
> -- Steve
>
> On 10/18/17, 11:26 AM, "Andras Lasso" <lasso at queensu.ca> wrote:
>
> I don't know if it's good practice, but when there is no input data I usually do either of the followings:
> - hide the actor so that no pipeline updates are requested by the renderer
> - detach the data processing pipeline from the visualization pipeline (SetInputData(NULL))
> - add a dummy data set (such as polydata with a single point) as input
>
> I would be interested if there is a particular method recommended by VTK core developers.
>
> Andras
>
> -----Original Message-----
> From: vtkusers [mailto:vtkusers-bounces at vtk.org] On Behalf Of Langer, Stephen A. (Fed)
> Sent: Wednesday, October 18, 2017 11:04 AM
> To: Bill Lorensen <bill.lorensen at gmail.com>
> Cc: vtkusers at vtk.org
> Subject: Re: [vtkusers] how to handle an empty pipeline?
>
> Thanks for the suggestion, but it won't work in this case. The warning messages come from a vtkDataSetSurfaceFilter that's created as a protected member of the vtkDataSetMapper class, so I can't call vtkDataSetSurfaceFilter::AddObserver. Subclassing vtkDatatSetMapper and overriding Render to get access to the filter would work, but feels wrong…
>
> Is this a bug? A warning is raised when the input to the vtkDataSetMapper is empty, except when the input type is VTK_POLY_DATA.
>
> -- Steve
>
> On 10/17/17, 6:36 PM, "Bill Lorensen" <bill.lorensen at gmail.com> wrote:
>
> You can catch the warnings/errors like this:
> https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Florensen.github.io%2FVTKExamples%2Fsite%2FCxx%2FUtilities%2FObserveError%2F&data=02%7C01%7Cstephen.langer%40nist.gov%7C42ff580323ed40df553608d515af87f8%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C0%7C636438765996499743&sdata=Jse9qOUuZCUa9o7yU3%2FLH2HH5I0%2FlkyeL2DtyHoPjCU%3D&reserved=0
>
>
> On Tue, Oct 17, 2017 at 2:34 PM, Langer, Stephen A. (Fed)
> <stephen.langer at nist.gov> wrote:
> > Hi --
> >
> > What's the right way to handle a pipeline that might at times have no data in it? I'm connecting to a vtkDataSetMapper, and if the input stream is empty vtk prints a warning "vtkDataSetSurfaceFilter: Number of cells is zero, no data to process". I don't create the vtkDataSetSurfaceFilter myself -- it's been inserted into the pipeline by the mapper. It doesn't do that if the input data is poly data, and if I change the input to poly data, the mapper seems quite happy with the empty pipeline, so it's odd that it complains in one case but not the other.
> >
> > Is there something that I should do at the pipeline source to tell the pipeline not to run? Is there a way to suppress just this one warning message?
> >
> > I'm using vtk 7.1.1 in C++.
> >
> > Thanks.
> > -- Steve
> >
> > _______________________________________________
> > Powered by https://na01.safelinks.protection.outlook.com/?url=www.kitware.com&data=02%7C01%7Cstephen.langer%40nist.gov%7C42ff580323ed40df553608d515af87f8%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C0%7C636438765996499743&sdata=RYg%2BPlwic7Tna%2F7XBHOzzdvhkoMlxxumVNKWqExIbgs%3D&reserved=0
> >
> > Visit other Kitware open-source projects at https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.kitware.com%2Fopensource%2Fopensource.html&data=02%7C01%7Cstephen.langer%40nist.gov%7C42ff580323ed40df553608d515af87f8%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C0%7C636438765996499743&sdata=alDmSCFYyHNTCJSBl%2FfPxBQUcuQ3wtlxy%2BJkCEKzZJo%3D&reserved=0
> >
> > Please keep messages on-topic and check the VTK FAQ at: https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.vtk.org%2FWiki%2FVTK_FAQ&data=02%7C01%7Cstephen.langer%40nist.gov%7C42ff580323ed40df553608d515af87f8%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C0%7C636438765996499743&sdata=YS8KxC6fI9R%2B5fACCQbDC7N3eBbFj8qy1k2SIFz%2B%2FBM%3D&reserved=0
> >
> > Search the list archives at: https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmarkmail.org%2Fsearch%2F%3Fq%3Dvtkusers&data=02%7C01%7Cstephen.langer%40nist.gov%7C42ff580323ed40df553608d515af87f8%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C0%7C636438765996499743&sdata=SYRMsiT14ntcdMMbSsGahJCJavp8%2BJFOrqx%2B2x4QJ1A%3D&reserved=0
> >
> > Follow this link to subscribe/unsubscribe:
> > https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fpublic.kitware.com%2Fmailman%2Flistinfo%2Fvtkusers&data=02%7C01%7Cstephen.langer%40nist.gov%7C42ff580323ed40df553608d515af87f8%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C0%7C636438765996499743&sdata=uPalP%2BrHte%2FjsQeaMUBuxCuAOY7vv2Eye5aZHbxhIY0%3D&reserved=0
>
>
>
> --
> Unpaid intern in BillsBasement at noware dot com
>
>
> _______________________________________________
> Powered by https://na01.safelinks.protection.outlook.com/?url=www.kitware.com&data=02%7C01%7Classo%40queensu.ca%7Caab96158e64644f5a0a308d516399b7a%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636439359028042607&sdata=G5HjQYP%2BVtTeYvFpw2uVv8NLpIQe6H4wc1C1cxhVuy0%3D&reserved=0
>
> Visit other Kitware open-source projects at https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.kitware.com%2Fopensource%2Fopensource.html&data=02%7C01%7Classo%40queensu.ca%7Caab96158e64644f5a0a308d516399b7a%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636439359028042607&sdata=%2Bxy3iWcIaSmwEYbuQ34qfqfv1Z6sYw6uy9TdggyCkiI%3D&reserved=0
>
> Please keep messages on-topic and check the VTK FAQ at: https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.vtk.org%2FWiki%2FVTK_FAQ&data=02%7C01%7Classo%40queensu.ca%7Caab96158e64644f5a0a308d516399b7a%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636439359028042607&sdata=wt2SqH2w2KmIFagMwyf%2BWX4VIBEJVy9Q8y3Soz8Bg0E%3D&reserved=0
>
> Search the list archives at: https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmarkmail.org%2Fsearch%2F%3Fq%3Dvtkusers&data=02%7C01%7Classo%40queensu.ca%7Caab96158e64644f5a0a308d516399b7a%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636439359028042607&sdata=lqTS030GCguYDE%2B5gRTx%2BUS4GDeDfxL%2B1gk63C7OK%2BY%3D&reserved=0
>
> Follow this link to subscribe/unsubscribe:
> https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fpublic.kitware.com%2Fmailman%2Flistinfo%2Fvtkusers&data=02%7C01%7Classo%40queensu.ca%7Caab96158e64644f5a0a308d516399b7a%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636439359028042607&sdata=XSlLpR9Hd1eQ8WY2xvZiHWeSnDQgQilkekPWN0RbkLY%3D&reserved=0
>
>
>
>
> _______________________________________________
> Powered by 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
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
More information about the vtkusers
mailing list