<meta http-equiv="Content-Type" content="text/html charset=us-ascii">That did the trick!<div class=""><br class=""></div><div class="">Thanks, seems very obvious in hindsight.</div><div class=""><br class=""></div><div class="">Regards,</div><div class="">Richard</div><div class=""><br class=""><div><blockquote style='border-left:2px solid #CCCCCC;padding:0 1em' type="cite" class=""><div class="">On 03 Jul 2015, at 19:24, Dan Lipsa-2 [via VTK] <<a href="/user/SendEmail.jtp?type=node&node=5732724&i=0" target="_top" rel="nofollow" link="external">[hidden email]</a>> wrote:</div><br class="Apple-interchange-newline"><div class="">

        <div dir="ltr" class="">Did you called Modified() on your image data? This is how downstream algorithms know to recompute their results.<br class=""></div><br class=""><div class="gmail_quote"><div dir="ltr" class="">On Fri, Jul 3, 2015 at 4:50 AM mbcx9rb9 <<a href="x-msg://2/user/SendEmail.jtp?type=node&amp;node=5732713&amp;i=0" target="_top" rel="nofollow" link="external" class="">[hidden email]</a>> wrote:<br class=""></div><blockquote style='border-left:2px solid #CCCCCC;padding:0 1em' style="border-left:2px solid #CCCCCC;padding:0 1em" class="gmail_quote">i have a vtkImageData, which I would like to be able to calculate the max,<br class="">
min, average, etc. via vtkImageAccumulate. Then I want to be able to edit<br class="">
the image data, update the image accumulate and see the new statistics.<br class="">
<br class="">
However, it seems that vtkImageAccumulate doesn't work how I hoped it would.<br class="">
When I change my image data, my image accumulate still returns the original<br class="">
statistics of the image data before I made the changes.<br class="">
<br class="">
If I edit my image data, am I obliged to reinitialise my image accumulate to<br class="">
be able to see the statistics on the edited image data?<br class="">
<br class="">
I have attached a simple example of a matrix with one voxel=100 and whose<br class="">
max is found with imageaccumulate. Then, a voxel of 200 is added,<br class="">
imageaccumulate is updated, but returns a max of 100 instead of the new 200.<br class="">
Finally, a new imageaccumulate is used to verify that the actually max is<br class="">
200 as expected.<br class="">
<br class="">
Any ideas of where I'm going wrong would be greatly appreciated.<br class="">
<br class="">
<br class="">
<br class="">
    // create image data<br class="">
    vtkSmartPointer<vtkImageData> id = vtkSmartPointer<vtkImageData>::New();<br class="">
    id->SetSpacing(1,1,1);<br class="">
    id->SetExtent(0,99,0,99,0,99);<br class="">
    id->AllocateScalars(VTK_DOUBLE,1);<br class="">
<br class="">
    // set all values to zero<br class="">
    for (int i=id->GetExtent()[0]; i<=id->GetExtent()[1]; i++) {<br class="">
        for (int j=id->GetExtent()[2]; j<=id->GetExtent()[3]; j++) {<br class="">
            for (int k=id->GetExtent()[4]; k<=id->GetExtent()[5]; k++) {<br class="">
                double* voxel =<br class="">
static_cast<double*>(id->GetScalarPointer(i,j,k));<br class="">
                voxel[0] = 0;<br class="">
            }<br class="">
        }<br class="">
    }<br class="">
<br class="">
    // set one voxel value to 100<br class="">
    double* voxel = static_cast<double*>(id->GetScalarPointer(50,50,50));<br class="">
    voxel[0] = 100;<br class="">
<br class="">
    // set image accumulate<br class="">
    vtkSmartPointer<vtkImageAccumulate> ia =<br class="">
vtkSmartPointer<vtkImageAccumulate>::New();<br class="">
    ia->SetInputData(id);<br class="">
    ia->SetComponentExtent(id->GetExtent());<br class="">
    ia->SetComponentOrigin(id->GetOrigin());<br class="">
    ia->SetComponentSpacing(id->GetSpacing());<br class="">
    ia->Update();<br class="">
<br class="">
    // output the max in the matrix (should be 100)<br class="">
    std::cout << "max before change: " << ia->GetMax()[0] << std::endl;<br class="">
<br class="">
    // change a different voxel to 200<br class="">
    voxel = static_cast<double*>(id->GetScalarPointer(50,50,60));<br class="">
    voxel[0] = 200;<br class="">
<br class="">
    // update image accumulate<br class="">
    ia->Update();<br class="">
    std::cout << "max after change (want this value to be 200): " <<<br class="">
ia->GetMax()[0] << std::endl;<br class="">
<br class="">
    // create second image accumulate to verify that the max is, as it<br class="">
should be, 200<br class="">
    vtkSmartPointer<vtkImageAccumulate> ia2 =<br class="">
vtkSmartPointer<vtkImageAccumulate>::New();<br class="">
    ia2->SetInputData(id);<br class="">
    ia2->SetComponentExtent(id->GetExtent());<br class="">
    ia2->SetComponentOrigin(id->GetOrigin());<br class="">
    ia2->SetComponentSpacing(id->GetSpacing());<br class="">
    ia2->Update();<br class="">
    std::cout << "max with ia2 (should be 200): " << ia2->GetMax()[0] <<<br class="">
std::endl;<br class="">
<br class="">
<br class="">
<br class="">
--<br class="">
View this message in context: <a href="http://vtk.1045678.n5.nabble.com/updating-vtkImageAccumulate-tp5732697.html" rel="nofollow" target="_blank" link="external" class="">http://vtk.1045678.n5.nabble.com/updating-vtkImageAccumulate-tp5732697.html</a><br class="">
Sent from the VTK - Users mailing list archive at <a href="http://Nabble.com" class="" target="_top" rel="nofollow" link="external">Nabble.com</a>.<br class="">
_______________________________________________<br class="">
Powered by <a href="http://www.kitware.com/" rel="nofollow" target="_blank" link="external" class="">www.kitware.com</a><br class="">
<br class="">
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="nofollow" target="_blank" link="external" class="">http://www.kitware.com/opensource/opensource.html</a><br class="">
<br class="">
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" rel="nofollow" target="_blank" link="external" class="">http://www.vtk.org/Wiki/VTK_FAQ</a><br class="">
<br class="">
Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers" rel="nofollow" target="_blank" link="external" class="">http://markmail.org/search/?q=vtkusers</a><br class="">
<br class="">
Follow this link to subscribe/unsubscribe:<br class="">
<a href="http://public.kitware.com/mailman/listinfo/vtkusers" rel="nofollow" target="_blank" link="external" class="">http://public.kitware.com/mailman/listinfo/vtkusers</a><br class="">
</blockquote></div>
<br class="">_______________________________________________
<br class="">Powered by <a href="http://www.kitware.com" class="" target="_top" rel="nofollow" link="external">www.kitware.com</a>
<br class=""><br class="">Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_top" rel="nofollow" link="external" class="">http://www.kitware.com/opensource/opensource.html</a><br class=""><br class="">Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_top" rel="nofollow" link="external" class="">http://www.vtk.org/Wiki/VTK_FAQ</a><br class=""><br class="">Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers" target="_top" rel="nofollow" link="external" class="">http://markmail.org/search/?q=vtkusers</a><br class=""><br class="">Follow this link to subscribe/unsubscribe:
<br class=""><a href="http://public.kitware.com/mailman/listinfo/vtkusers" target="_top" rel="nofollow" link="external" class="">http://public.kitware.com/mailman/listinfo/vtkusers</a><br class="">

        
        
        
        <br class="">
        <br class="">
        <hr noshade="noshade" size="1" class="">
        <div style="color:#444; font: 12px tahoma,geneva,helvetica,arial,sans-serif;" class="">
                <div style="font-weight:bold" class="">If you reply to this email, your message will be added to the discussion below:</div>
                <a href="http://vtk.1045678.n5.nabble.com/updating-vtkImageAccumulate-tp5732697p5732713.html" class="" target="_top" rel="nofollow" link="external">http://vtk.1045678.n5.nabble.com/updating-vtkImageAccumulate-tp5732697p5732713.html</a>
        </div>
        <div style="color:#666; font: 11px tahoma,geneva,helvetica,arial,sans-serif;margin-top:.4em;line-height:1.5em" class="">
                
                To unsubscribe from updating vtkImageAccumulate, <a href="" class="" target="_top" rel="nofollow" link="external">click here</a>.<br class="">
                <a href="http://vtk.1045678.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml" rel="nofollow" style="font:9px serif" class="" target="_top" link="external">NAML</a>
        </div></div></blockquote></div><br class=""></div>

        
        
        
<br/><hr align="left" width="300" />
View this message in context: <a href="http://vtk.1045678.n5.nabble.com/updating-vtkImageAccumulate-tp5732697p5732724.html">Re: updating vtkImageAccumulate</a><br/>
Sent from the <a href="http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html">VTK - Users mailing list archive</a> at Nabble.com.<br/>