<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Ok it makes even less sense to me now:<br>
<br>
For testingpupose i have changed:<br>
void MainWindow::updateImage(vtkSmartPointer<vtkImageData>
newImage) {<br>
image->ShallowCopy(newImage);<br>
image->Modified();<br>
<br>
qvtkWidget->GetRenderWindow()->Render();<br>
}<br>
too<br>
void MainWindow::updateImage(vtkSmartPointer<vtkImageData>
newImage) {<br>
image->ShallowCopy(newImage);<br>
initializeImage2()<br>
<br>
qvtkWidget->GetRenderWindow()->Render();<br>
}<br>
where inizializeImage2 prints a different picture than the first
inizialization.<br>
<br>
And this works, but when i do this:<br>
<br>
void MainWindow::updateImage(vtkSmartPointer<vtkImageData>
newImage) {<br>
image = newImage;<br>
initializeImage2()<br>
<br>
qvtkWidget->GetRenderWindow()->Render();<br>
}<br>
<br>
nothing in the output changes at all.<br>
<br>
this doesn't make sense to me anymore. What am i missing guys? pls
help<br>
<br>
void MainWindow::initializeImage2()<br>
{<br>
unsigned int dim = 20;<br>
<br>
image->SetDimensions(dim, dim, 1);<br>
image->SetSpacing(1.0, 1.0, 1.0);<br>
image->SetOrigin(0.0, 0.0, 0.0);<br>
<br>
image->AllocateScalars(VTK_DOUBLE,3);<br>
<br>
for(unsigned int x = 0; x < dim; x++)<br>
{<br>
for(unsigned int y = 0; y < dim; y++)<br>
{<br>
double* pixel =
static_cast<double*>(image->GetScalarPointer(x,y,0));<br>
pixel[0] = 1.0;<br>
pixel[1] = 1.0;<br>
pixel[2] = 0.0;<br>
}<br>
}<br>
image->GetPointData()->SetVectors(image->GetPointData()->GetArray(0));<br>
//image->GetPointData()->SetActiveVectors("ImageScalars");<br>
image->Modified();<br>
}<br>
<br>
<div class="moz-cite-prefix">Am 28.10.2015 um 16:03 schrieb Werner
Sembach:<br>
</div>
<blockquote cite="mid:5630E3AA.9050700@sembach.de" type="cite">
<meta http-equiv="content-type" content="text/html;
charset=windows-1252">
So i have a function that gehts a vtkImageData*<br>
and should replace another, already displayed, vtkImageData*<br>
<br>
void MainWindow::updateImage(vtkSmartPointer<vtkImageData>
newImage) {<br>
image->ShallowCopy(newImage);<br>
image->Modified();<br>
<br>
qvtkWidget->GetRenderWindow()->Render();<br>
}<br>
<br>
however when i try to run this i get the error "vtkHedgeHog
(0xa3fc80): No vectors in input data"<br>
<br>
if i use a standart assignment (image = newImage) the display
doesn't change at all<br>
<br>
<br>
<br>
initial image is created here (image is a instance variable):<br>
<br>
void MainWindow::initializeImage()<br>
{<br>
unsigned int dim = 20;<br>
<br>
image->SetDimensions(dim, dim, 1);<br>
image->SetSpacing(1.0, 1.0, 1.0);<br>
image->SetOrigin(0.0, 0.0, 0.0);<br>
<br>
image->AllocateScalars(VTK_DOUBLE,3);<br>
<br>
for(unsigned int x = 0; x < dim; x++)<br>
{<br>
for(unsigned int y = 0; y < dim; y++)<br>
{<br>
double* pixel =
static_cast<double*>(image->GetScalarPointer(x,y,0));<br>
pixel[0] = -1;<br>
pixel[1] = 1;<br>
pixel[2] = 0.0;<br>
}<br>
}<br>
image->GetPointData()->SetActiveVectors("ImageScalars");<br>
image->Modified();<br>
}<br>
<br>
the new image is generated here:<br>
<br>
void MainWindow::on_actionTest_Update_triggered()<br>
{<br>
vtkSmartPointer<vtkImageData> newImage =
vtkSmartPointer<vtkImageData>::New();<br>
unsigned int dim = 30;<br>
<br>
newImage->SetDimensions(dim, dim, 1);<br>
newImage->SetSpacing(1.0, 1.0, 1.0);<br>
newImage->SetOrigin(0.0, 0.0, 0.0);<br>
<br>
newImage->AllocateScalars(VTK_DOUBLE,3);<br>
<br>
for(unsigned int x = 0; x < dim; x++)<br>
{<br>
for(unsigned int y = 0; y < dim; y++)<br>
{<br>
double* pixel =
static_cast<double*>(newImage->GetScalarPointer(x,y,0));<br>
pixel[0] = 1;<br>
pixel[1] = 0.0;<br>
pixel[2] = 0.0;<br>
}<br>
}<br>
newImage->GetPointData()->SetActiveVectors("imageScalars");<br>
newImage->Modified();<br>
updateImage(newImage);<br>
}<br>
<br>
<meta name="qrichtext" content="1">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<style type="text/css">
p, li { white-space: pre-wrap; }
</style> <br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Powered by <a class="moz-txt-link-abbreviated" href="http://www.kitware.com">www.kitware.com</a>
Visit other Kitware open-source projects at <a class="moz-txt-link-freetext" href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a>
Please keep messages on-topic and check the VTK FAQ at: <a class="moz-txt-link-freetext" href="http://www.vtk.org/Wiki/VTK_FAQ">http://www.vtk.org/Wiki/VTK_FAQ</a>
Search the list archives at: <a class="moz-txt-link-freetext" href="http://markmail.org/search/?q=vtkusers">http://markmail.org/search/?q=vtkusers</a>
Follow this link to subscribe/unsubscribe:
<a class="moz-txt-link-freetext" href="http://public.kitware.com/mailman/listinfo/vtkusers">http://public.kitware.com/mailman/listinfo/vtkusers</a>
</pre>
</blockquote>
<br>
</body>
</html>