<div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">There is a convolution class, I don't know whether you can make it work for your case:</div><div class="gmail_default" style=""><font face="verdana, sans-serif"><a href="http://www.vtk.org/doc/nightly/html/classvtkImageConvolve.html">http://www.vtk.org/doc/nightly/html/classvtkImageConvolve.html</a></font><br></div><div class="gmail_default" style=""><font face="verdana, sans-serif"><br></font></div><div class="gmail_default" style=""><font face="verdana, sans-serif">HTH</font></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Nov 18, 2015 at 3:15 PM, mbcx9rb9 <span dir="ltr"><<a href="mailto:richard.j.brown@live.co.uk" target="_blank">richard.j.brown@live.co.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi all,<br>
<br>
I have a large vtkImageData (imgData) and I wish to add a smaller<br>
vtkImageData (kernel) multiple times to it.<br>
<br>
Is there a quicker way than adding each component separately?<br>
<br>
At the moment I have something below, which is repeated for each kernel:<br>
<br>
<br>
// indices to add kernel<br>
int x = 10;<br>
int y = 10;<br>
int z = 10;<br>
<br>
int *kerExt = kernel->GetExtent();<br>
<br>
// all kernel elements<br>
for (int i= kernel->GetExtent()[0]; i<= kernel->GetExtent()[1]; i++)<br>
{<br>
for (int j= kernel->GetExtent()[2]; j<= kernel->GetExtent()[3]; j++)<br>
{<br>
for (int k= kernel->GetExtent()[4]; k<= kernel->GetExtent()[5]; k++)<br>
{<br>
<br>
// check that the point is inside the surface<br>
if (x+i >= imgData->GetExtent()[0] &&<br>
x+i <= imgData->GetExtent()[1] &&<br>
y+j >= imgData->GetExtent()[2] &&<br>
y+j <= imgData->GetExtent()[3] &&<br>
z+k >= imgData->GetExtent()[4] &&<br>
z+k <= imgData->GetExtent()[5])<br>
{<br>
<br>
static_cast<double*>(imgData->GetScalarPointer(i+x,j+y,k+z))[0] +=<br>
static_cast<double*>(kernel->GetScalarPointer(i,j,k))[0];<br>
}<br>
}<br>
}<br>
}<br>
<br>
<br>
<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://vtk.1045678.n5.nabble.com/speedy-vtkImageData-addition-tp5735087.html" rel="noreferrer" target="_blank">http://vtk.1045678.n5.nabble.com/speedy-vtkImageData-addition-tp5735087.html</a><br>
Sent from the VTK - Users mailing list archive at Nabble.com.<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" rel="noreferrer" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Search the list archives at: <a 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 href="http://public.kitware.com/mailman/listinfo/vtkusers" rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/vtkusers</a><br>
</blockquote></div><br></div>