Kitware / itk-vtk-viewer

2D / 3D web image, mesh, and point set viewer using itk-wasm and vtk.js
https://kitware.github.io/itk-vtk-viewer/
BSD 3-Clause "New" or "Revised" License
202 stars 61 forks source link

Option for setting the origin #347

Open oeway opened 3 years ago

oeway commented 3 years ago

Would be nice to have an option to determine the origin, for example, for the ImJoy api.

Currently, the default origin for itk-vtk-viewer located in the lower-left corner, however, for microscopy images, the origin is located in the top-left corner.

thewtex commented 3 years ago

ITK and ImageJ (I believe) treat the origin in the lower left, but VTK and VTK.js put the origin in the top left corner. We now have a nice axis tools that helps visualize this (works in 2D and 3D):

localhost_8080__fileToLoad=https___kitware github io_itk-vtk-viewer_docs_imjoy png

I could create an ImJoy plugin to flip the data vertically.

oeway commented 3 years ago

In fact, the origin of imagej is actually top-left-- same as the current version of itk-vtk-viewer FznygvcVRS

I had the impression that itk-vtk-viewer's origin is lower-left, and I checked an old plugin, and it actually located lower left:

Screenshot 2020-11-04 at 22 24 26

The plugin is here

What's happening?

thewtex commented 3 years ago

It could be related to how the data is read in -- e.g. ITK reads JPEGs in the natural (C-order) pixel order, but VTK flips the data in the J direction because of this "upper-left origin" issue. In the above two examples, what is reading in the data from file?