>From Java you can get a vtkDataArray from the vtkImageData using data.GetPointData().GetScalars(), but then it would be up to you to convert the vtkDataArray into a java array and compute the difference.  You would also have to find a Java function to do the compression, since vtkDataCompressor doesn&#39;t have any methods that can be used from Java.<br>

<br> - David<br><br><br><div class="gmail_quote">On Fri, Jan 28, 2011 at 8:43 PM, Jonathan Morra <span dir="ltr">&lt;<a href="mailto:jonmorra@gmail.com">jonmorra@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

So I&#39;m in Java and I just realized that GetScalarPointer() isn&#39;t mapped to Java.  Is there an alternative?<div><div></div><div class="h5"><br><br><div class="gmail_quote">On Fri, Jan 28, 2011 at 7:11 PM, David Gobbi <span dir="ltr">&lt;<a href="mailto:david.gobbi@gmail.com" target="_blank">david.gobbi@gmail.com</a>&gt;</span> wrote:<br>


<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div>On Fri, Jan 28, 2011 at 7:45 PM, Jonathan Morra <span dir="ltr">&lt;<a href="mailto:jonmorra@gmail.com" target="_blank">jonmorra@gmail.com</a>&gt;</span> wrote:<br>


</div><div class="gmail_quote"><div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

I have a binary vtkImageData that a user can modify through some tools I provide them.  However, the user has requested an undo stack be made so they can go back through their changes.  In my case, storing a new binary vtkImageData every time the user changes it costs too much memory (these are large 3D volume sets).  Is there a way to store a difference between two binary vtkImageData&#39;s?  Ideally I&#39;d like to have just one vtkImageData which is the current image and then a stack of vtkImageDifferences (I made that class up) which are themselves small, but say how to go to either the next or previous state of a binary vtkImageData.<div>





<br></div><div>Does such a method exist?</div></blockquote><div><br></div></div><div>No, but it shouldn&#39;t be too hard to do this.  You can get a pointer to the data by calling GetScalarPointer() on the image data.  The size of this data (in bytes) will be product of the Dimensions, the NumberOfScalarComponents, and the ScalarSize.</div>




<div><br></div><div>So, you should easily be able to compute a bytewise difference between two images.  There&#39;s no reason to write a new filter for this, since it&#39;s just a simple for() loop.  Then, you can use vtkDataCompressor::Compress() to compress the diff so that it can be efficiently stored.  By doing everything bytewise, you don&#39;t have to worry about different datatypes, and you shouldn&#39;t lose anything in terms of efficiency.</div>




<div><br></div><div>If the image changes in size, then you could store a compressed copy of the full image rather than dealing with the difficulty of diffing images of different sizes.</div><div><br></div><div>I hope this helps.</div>




<div><br></div><div>  - David</div><div><br></div></div>
</blockquote></div><br>
</div></div></blockquote></div><br>