[vtkusers] Changing the range of a vtkPlotSurface does not cause a change to propagate to the vtkContextView

Luke Darlow LDarlow at csir.co.za
Tue Oct 27 08:59:16 EDT 2015


Good day,
 
I am plotting a surface from a series of points. I am also plotting a 'slice' as another surface. This slice is limited by its X and Y range to cut the initial surface at a specific place. I have attached a screenshot of this circumstance.
 
I am populating the following variables:
 

vtkSmartPointer<vtkContextView> zoneView;// The view to hold the surfaces
vtkSmartPointer<vtkChartXYZ> zoneChart;// The chart that holds the two surface plots
vtkSmartPointer<vtkPlotSurface> pointerPlot;// The "slice" plot
vtkSmartPointer<vtkTable> pointerSurface;// The table representing the "slice" plot
I am using qT and linking the contextView with a QVTWidget in the following way:
ui.surfacePlotQVTKWidget = new QVTKWidget(ui.zoneDetectionTab);
ui.surfacePlotQVTKWidget->setObjectName(QStringLiteral("surfacePlotQVTKWidget"));
ui.surfacePlotQVTKWidget->setGeometry(QRect(90, 50, 512, 512));
zoneView->SetRenderWindow(ui.surfacePlotQVTKWidget->GetRenderWindow());
Where ui is the parent widget from qT. 
I would like to move the "slice" plot when I move a slider. I have achieved this with the following code:
 
int depth = octVolume.at(0).height() / octVolume.at(0).width() * resolution;
// Set up the surface plot for showing where we are in the scan
for (float i = 0; i < resolution; ++i)
{
for (float j = 0; j < resolution; ++j)
{
if ((int)i == bscanIndex / displayedVolumeSparsityFactor & (int)j % 2) // Set the "slice" plot up so that it occupies the whole space. Limit its range later to make it appear as though it is a slice.
{
pointerSurface->SetValue(i, j, depth);
}
else
{
pointerSurface->SetValue(i, j, 0);
}
}
}
//Set the range to only show necessary stuffs 
pointerPlot->SetXRange(0, resolution);

pointerPlot->SetYRange(bscanIndex / displayedVolumeSparsityFactor - 1, bscanIndex / displayedVolumeSparsityFactor + 1);

pointerPlot->SetInputData(pointerSurface);

zoneView->Render();
This works fine. HOWEVER, the line: pointerPlot->SetInputData(pointerSurface); is very slow as it has to add the data to the plot. I would prefer to simply change the YRange of this plot at this stage, but that change does NOT propogate to the chart and thus the view. I have tried updating the plot, chart, and view, and rendering the view. Nothing causes this change to propogate UNLESS I set the input data. Is there a way around the necessity to reset the input data every time I wish to change the range displayed?
Thank you for your assistance,
Kind regards,
Luke.
 

-- 
This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. 
The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html.

This message has been scanned for viruses and dangerous content by MailScanner, 
and is believed to be clean.

Please consider the environment before printing this email.

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


More information about the vtkusers mailing list