<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
The<br>
newImage->GetPointData()->SetActiveVectors("imageScalars");<br>
was copyed out of an example, and the initilazation didn't work
without it.<br>
<br>
Ok i tryed to replace it with<br>
newImage->GetPointData()->SetVectors(newImage->GetPointData()->GetArray(0));<br>
but it has still the same behavior and complains about "No Vectors
in input" after i copyed it over.<br>
Greetings<br>
Matombo<br>
<br>
<div class="moz-cite-prefix">Am 28.10.2015 um 16:29 schrieb Cory
Quammen:<br>
</div>
<blockquote
cite="mid:CAB5Fpx5NzYg3HaVPyxGgaCWTS59izi7knWhZTigHUxd5QYrcRA@mail.gmail.com"
type="cite">
<div dir="ltr">
<div><span style="font-size:12.8px">Hi Werner,</span></div>
<div><span style="font-size:12.8px"><br>
</span></div>
<div><span style="font-size:12.8px">Consider this line.</span></div>
<span style="font-size:12.8px">
<div><span style="font-size:12.8px"><br>
</span></div>
newImage->GetPointData()-></span><span
style="font-size:12.8px">SetActiveVectors("</span><span
style="font-size:12.8px">imageScalars");</span><br>
<div><span style="font-size:12.8px"><br>
</span></div>
<div><span style="font-size:12.8px">Where is an array named
"imageScalars"? I don't see that anywhere in the code, so
whatever active vectors there might be in the image are
being unset by the call above.</span></div>
<div><span style="font-size:12.8px"><br>
</span></div>
<div><span style="font-size:12.8px">After you allocate the
scalars, you can give them a name with something like</span></div>
<div><span style="font-size:12.8px"><br>
</span></div>
<div><span style="font-size:12.8px">newImage->GetPointData()->GetArray(0)->SetName("imageScalars");</span></div>
<div><span style="font-size:12.8px"><br>
</span></div>
<div><span style="font-size:12.8px">Or you can skip naming the
array and set the active vectors with</span></div>
<div><span style="font-size:12.8px"><br>
</span></div>
<div><span style="font-size:12.8px">newImage->GetPointData()->SetVectors(newImage->GetPointData()->GetArray(0));</span></div>
<div><span style="font-size:12.8px"><br>
</span></div>
<div><span style="font-size:12.8px">HTH,</span></div>
<div><span style="font-size:12.8px">Cory</span></div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Wed, Oct 28, 2015 at 11:03 AM,
Werner Sembach <span dir="ltr"><<a moz-do-not-send="true"
href="mailto:werner@sembach.de" target="_blank">werner@sembach.de</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000"> 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>
</div>
<br>
_______________________________________________<br>
Powered by <a moz-do-not-send="true"
href="http://www.kitware.com" rel="noreferrer"
target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a
moz-do-not-send="true"
href="http://www.kitware.com/opensource/opensource.html"
rel="noreferrer" target="_blank"><a class="moz-txt-link-freetext" href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a></a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a
moz-do-not-send="true"
href="http://www.vtk.org/Wiki/VTK_FAQ" rel="noreferrer"
target="_blank"><a class="moz-txt-link-freetext" href="http://www.vtk.org/Wiki/VTK_FAQ">http://www.vtk.org/Wiki/VTK_FAQ</a></a><br>
<br>
Search the list archives at: <a moz-do-not-send="true"
href="http://markmail.org/search/?q=vtkusers"
rel="noreferrer" target="_blank">http://markmail.org/search/?q=vtkusers</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a moz-do-not-send="true"
href="http://public.kitware.com/mailman/listinfo/vtkusers"
rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/vtkusers</a><br>
<br>
</blockquote>
</div>
<br>
<br clear="all">
<div><br>
</div>
-- <br>
<div class="gmail_signature">Cory Quammen<br>
R&D Engineer<br>
Kitware, Inc.</div>
</div>
</blockquote>
<br>
</body>
</html>