# Lacunae Orientation

Try again with test ellipsoids that have their long axes parallel to each other, but with different rotations about the long axis.

Also - it would help a great deal if you could publish your test images and a description of what you expect to see.

Interesting. This image shows 1:2:5 ellipsoids rotated by 10 degrees. The colour gradation makes some sense. However, what I was expecting to see was for all these ellipsoids to have the same colour as the long axis is oriented in the same direction.

That’s close to what’s expected, although the red one on the left should be green-ish (so, this is a really helpful test image that exposes buggy behaviour). Could you make a series that goes through the full range of 0-360° with 10° increments, and try again? Also - could you share these images with us as developers? They would be very helpful to test code changes against.

Glad we clarified that. This scheme represents rotation of the short axes around the longest axis, so if your lacunae are all oriented longitudinally, parallel to the proximodistal axis of a long bone, the colour (hue) represents the alignment of the flattening of the lacuna, which is usually parallel to the circumference of the cortex (i.e. flattened between bone lamellae).

A helpful addition to this test image would be a series between 0 and 180° of elevation of the long axis. So left to right in the test image would be rotation around the long axis (0-360°, continuing what you have here) and top to bottom would be rotation of the long axis 0-180°, towards and then away from the viewer.

If you could make that and then explain what your ideal LUT would look like, I can try to put that into code.

OK, so I have created a test image that I think is what you are chasing. It was a pain to create, so hopefully it’s what you are referring to. It’s the 0-360 deg sequence as before, but repeated with a change in rotation of the long axis (I think) from 0-180 at 10 degree increments. A cone denotes the ellipsoid at zero, zero. It’s a much larger file but I am happy to share it. I will also share the original single set at zero degrees rotation. What’s the best way to share these larger files? I can place a link via Cloudstor.

Regarding the LUT. Can we alter the code so that the long axis orientation of the ellipsoids denotes the colour shift, rather than the rotation around the long axis?

I must say it looks pretty cool.

This is really interesting and close to what I would like. The ellipsoids need to have their centroids in a single plane (you have them stacked in 3 planes), with long axis tilting through 180° top to bottom and short axis rotating 360° around long axis left to right. Ideally 10° increment in both so it would be 36 × 18 ellipsoids in a single sheet. If it is a total pain and you are doing it by hand I will work out how to do it in a script.

I understand. You want to be able to see them all in a single sheet so to speak. Like this image.
Yes, it was a pain. I’m not that fluent with Blender, the program I have been using to create these ellipsoids, and was not able to easily find the functionality to repeat the commands. Scripting it would be ideal. If you could do this it would be a big help. I might try, but I dare say a script will beat me.

I scripted a way to generate a test image of rotated ellipsoids. It’s not doing the rotations quite the way I’d like but you can still see across the top row hue changing as a function of rotation around the long axis but also on the left, right and centre columns changing with rotation of the long axis. So it’s not working as I hoped, but is doing at least something…

There are a lot of unintuitive sudden changes in hue, rather than a smooth gradient across the image, so something is not right.

The test image is here: Tilted Ellipsoids.tif.zip (384.7 KB)

This is more like it, in terms of the test ellipsoids doing what they ought to. Colours still not right.

Test data are here: Tilted Ellipsoids.tif.zip (398.9 KB)

You beat me to it. Here is my version. The file size is getting up there so I can do a downsampled version perhaps. I’ll try and share the zip file. So, should I pull your new version of the particle analyser?

1 Like

Yes, still working on it. Just make sure your local copy that you’re testing with is up to date with my `particle-analyser` branch and that each time you pull changes you run the build script again.

When you see all these ellipsoids with different orientations laid out like this, it becomes obvious that there are a few different ways to express orientation with colour, and the choice of LUT comes down to what you want to show is similar and what is different.

This version applies hue based on deflection of the particle’s long axis from the z axis of the image. It doesn’t do anything with the rotation of the long axis around the image z axis, or the rotation of the particle’s short axes around its long axis. @Killr_Chiton please let me know if this is OK - pushed just now.

Also - could people with colour vision differences let me know how the HSB wheel looks - is there a section that is contrasty or not contrasty? I see that there is red, green and yellow in this LUT which is not ideal.

Edit - I found this excellent simulator for testing LUTs for colour accessibility.

1 Like

This colour scheme is much more accessible than the previous one

1 Like

Hi Michael. It works on my system. I will take a look at the LUT simulator as well. Many thanks for this. I have tried it on an actual dataset and the result seems to make sense. Obviously the shape of the lacunae are not all the same size and shape, so I will try and interpret what is happening in the real scenario, but very promising.

Regarding the “HSB wheel”. A “scale bar” of the colour orientation would be a useful addition so that the orientation angle can be seen on the image. How do you achieve this in the particle analyser plugin?

It would also be great to be able to export the data in another format that is currently available in the 3D viewer. Not sure how this might be done. Exporting separate RGB channels as 3D tiff stacks?

Hi Michael, I think I have spotted an issue, but it could be my Friday brain misfiring. In the test image the ellipsoids in the ovals and squares on the diagonal share (I think) the same orientation and share the same colour mapping. However, the ellipsoids in the oval vs square (top to bottom) also share the same colour mapping despite having obviously different orientations.

True - it helps to do this stuff with fresh and properly-firing neurons!

You’ve identified 4 groups of ellipsoids with the same orientation. Our ellipsoids don’t have a polarity - there’s no head and tail - which means that 120° = 60°, when you consider the deflection of the long axis from the vertical (z) axis. Without polarity there’s no way to tell whether you should set the colour according to the big angle or the small angle.

Going left to right you see ellipsoids rotating around the z axis, with the same deflection from the z axis. That’s why the colours are in horizontal stripes, and the lack of polarity is why they reflect about the horizontal midline (90°).

Yes, quite right. Not sure of the best way to implement it to be honest. However, the angles of the ellipsoids do correspond to the angles of a standard HSB colour wheel. Perhaps that is the best thing to do: copy a suitably-licensed HSB wheel and label it with the correct values - note though that this LUT uses the HSB 180-360° range, mapped to 90-180° and 90-0°, for accessibility.

1 Like

What about an orientation stack? Essentially the pixels of each particle coloured according to the LUT. Later on in ImageJ2 we might be able to use a tensor pixel type and assign the rotation matrix to each lacuna pixel.

Hi Michael. I’m a colleague of @Killr_Chiton. Thanks for all of your hard work trying to progress this. The color-coding that he is after is similar to that used in diffusion MRI. The idea is to color each ellipsoid according to the orientation of the principal eigenvector. The simplest approach is to map the x, y and z components of this vector to R, G and B values respectively and to modulate the brightness according to a scalar measure of anisotropy (with 0 for a perfect sphere). It is then easy to recognize groups of ellipsoids that run left-to-right, front-to-back or top-to-bottom. Admittedly many oblique directions can be more difficult to discern. However, other color-mapping schemes have been proposed to improve this ambiguity (see https://doi.org/10.1002/nbm.3902 section 2.2 and figure 2).

Thanks for that very interesting review @Andrew_Mehnert. The problem with straight xyz → RGB conversion is as the authors state:

similar colors (arrows in A) are sometimes assigned to quite different orientations

This comes about because orientation is different depending on whether or not you assume polarity. So you have to map RGB properly to the 8 + and - octants of the orientation separately if it’s to make sense (which is pointed out in fig 2A). Simple mapping means that a vector in +,-,+ xyz space will get a different colour than its tail in -,+,-, which is problematic when orientation vectors lack polarity. I think that can be handled by a simple negation of all xyz values if z is negative. Visualising the situation as a vector’s head passes down through the z = 0 plane in an xy quadrant and its tail emerges up through the opposite xy quadrant, and keeping the colour gradient continuous and meaningful, is difficult. You can get a colour but it’s nearly uninterpretable.

This is why the HSB wheel is convenient - the colours continuously loop around 360° in a single plane and each hue relates uniquely to a single angle so you can work backwards from hue to angle.

Ultimately it comes down to what the question is, and whether the major eigenvector is really the most interesting thing about osteocyte lacunar orientation.