<div dir="ltr">My approach with this kind of change has been to create a new subclass of vtkDataSet. If you add some meta-data to vtkImageData that is then ignored by all or most of algorithms, you will end up with confused users. You could potentially do something at the executive layer that can automatically transform this new dataset to vtkImageData when using vtkImageData algorithms. It should be trivial to add support to the volume rendering code after that.<div><br></div><div>Given that we are looking at VTK-m for much of the future algorithm, I would suggest that VTK-m natively supports both ordering. Then if we replace any VTK algorithms with VTK-m implementations, it would work out of box.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jul 19, 2017 at 1:34 PM, Marcus D. Hanwell <span dir="ltr"><<a href="mailto:marcus.hanwell@kitware.com" target="_blank">marcus.hanwell@kitware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span class="">On Wed, Jul 19, 2017 at 1:11 PM, David Gobbi <span dir="ltr"><<a href="mailto:david.gobbi@gmail.com" target="_blank">david.gobbi@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><div class="m_5467743943916970977m_-4074399561967842780h5">On Wed, Jul 19, 2017 at 10:55 AM, Marcus D. Hanwell <span dir="ltr"><<a href="mailto:marcus.hanwell@kitware.com" target="_blank">marcus.hanwell@kitware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span class="m_5467743943916970977m_-4074399561967842780m_7581085470231967816gmail-">On Wed, Jul 19, 2017 at 12:35 PM, David Thompson <span dir="ltr"><<a href="mailto:david.thompson@kitware.com" target="_blank">david.thompson@kitware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Marcus,<br>
<div><div class="m_5467743943916970977m_-4074399561967842780m_7581085470231967816gmail-m_-941235466975338250h5"><br>
> We work on Tomviz, and one of its primary goals is to work with volumes in an intuitive way making heavy use of the volume rendering code. It also needs to interact with several libraries that operate on volumes, ideally using our Python NumPy integration and zero copy approaches to process data in place.<br>
><br>
> One of the challenges has been preserving the Fortran ordering of the single component scalar data. We will also be adding support for multi-component data soon. What are people's thoughts on potentially adding some API to vtkImageData to mark it as C ordered?<br>
><br>
> That would largely just geometrically transform how the volume is rendered, but ensure a contour is correctly extracted and aligned. It would then let us use the default C ordering, simplifying our application code, and the current order could remain the default. I would suggest considering the same for the vtk.js work too.<br>
><br>
> It is feasible to make these changes in the application logic too, but this feels like a fairly common problem that others would also hit from time to time. Maybe I am missing more corner cases, so I am posting this in hopes of feedback before writing any code (or asking someone else to).<br>
<br>
</div></div>I think a common problem would be that many image filters choose a particular order to process data because access is much faster in one plane than others. Are you thinking that those filters would also adjust their algorithms/traverse order to accommodate FORTRAN ordering when it is present on the input (and presumably output)?</blockquote><div><br></div></span><div>My ideal scenario is to mark a vtkImageData as C ordered (default it to Fortran/what it is now). It may be easier to manage more of that at an application level though too, I was more thinking out loud and wondering if other people had explored this or solved it in other ways. I get the historical perspective, and possibly that what I want may not be needed by the wider VTK community.</div><div><br></div><div>I would like to leave as much of VTK alone as possible, and so let most VTK stuff continue as it always has, but be able to pass a vtkImageData to a 3D NumPy array as C ordered, operate on it, and then render the result. We currently go to great pains to ensure if comes back as Fortran ordered, and there is no way to set a default. I also find that most stuff assumes the C ordering, so it can require some reshuffling of the data which can involve large volumes.</div></div></div></div></blockquote><div><br></div></div></div><div>It's already possible to add extra flags to any VTK data set, without making any changes to VTK itself.</div><div><br></div><div>The simplest way is to add an array to the vtkFieldData of the data set.  You could add a field data array called "ImageOrdering" that would hold the flag.</div><div><br></div><div>Another way (a little trickier) is to add your own information key.  For example, for my VTK DICOM pipelines I've defined a key called PATIENT_MATRIX that stores a 4x4 matrix to define the image orientation.</div></div></div></div></blockquote><div><br></div></span><div>Totally, I knew about that, but VTK wouldn't particularly use that information in rendering, but we could then use it at an application level. Thanks for the pointers on how you are using it.</div></div></div></div>
<br>______________________________<wbr>_________________<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/<wbr>opensource/opensource.html</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=vtk-developers" rel="noreferrer" target="_blank">http://markmail.org/search/?q=<wbr>vtk-developers</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/vtk-developers" rel="noreferrer" target="_blank">http://public.kitware.com/<wbr>mailman/listinfo/vtk-<wbr>developers</a><br>
<br>
<br></blockquote></div><br></div>