Extracting directionality from NIfTI files

Hi everyone,
I have written a simple VTK NIfTI file viewer and want to be able to indicate which side of the images is left. By default, vtkNIFTIImageReader provides the data in voxel space, which has arbitrary orientation. How can access the data in scanner/patient space so I know which directions are left/anterior/superior? Do I need to use vtkImageReslice to apply the Qform matrix to the volume?
thank you in advance for your help,

It is completely up to you - it depends on how you want to define the rendering coordinate system (parallel to IJK axes or LPS axes).

Note that a new lightweight VTK-based image viewer is created in every few weeks. Instead of joining the crowd and create yet another one, it would be so much better if you could check out existing ones and choose the one that is the closest to what you need and try to collaborate with its developer.

A recent example is this: https://github.com/kitware/F3D

If you need any new features, you can copy from full-featured applications, such as 3D Slicer or MITK.

Thank you (yet again) for your expert advice, @lassoan. I would ideally like RAS coordinates but any permutation/polarity of that would work.

The reason why I’m not using existing VTK NIfTI viewers (e.g., 3D Slicer, which is Fantastic) is that:

  1. I’m working in C# and am not a strong C++ coder
  2. I would like the option of commercializing the package I’m working on

In my experience, existing VTK image viewers are based in C++ and use Qt, which is not licensed for free commercial use.

Fortunately, this is not the case at all. Qt is available with LGPL license, so it is free for commercial use. The only limitation is that if you modify Qt itself then you need to contribute back those changes to Qt. There are many commercial applications built on VTK and Qt, using the free LGPL Qt license.

Of course, Qt company wants to make money, so they try to convince you to buy a commercial license, but it is not necessary. Lately they have even introduced small inconveniences, such as withholding LTS releases from free users (thereby forcing free users to become testers of new releases), but using recent releases is not a bad idea anyway. I don’t think Qt Company would ever go as far as stop distributing Qt with LGPL license, as they know that people would just switch to different GUI toolkits then.

If you allow me a side comment: Qt Charts, for example, has a more restrictive GPL license. Other parts of Qt may have different licensing as well.

Yes, Qt has even more relaxed license than LGPL for many of its components, and it has 8 add-on modules with more restrictive GPL/commercial license (charts, data visualization, animation, oauth, virtual keyboard, webassembly, quick 3d, quick webgl). These restricted add-ons have very limited scope and VTK already covers charts, data, and visualization, so VTK/Qt-based desktop applications generally don’t need these add-ons anyway.

1 Like