GLVisualize maximum intensity projection: set 'inherent' attenuation

glvisualize

#1

I am using GLVisualize to render a maximum intensity protection of some volumetric data:

viewable = visualize(array, :mip)
_view(viewable, window, camera=:perspective)

This works okay, but at certain angles the field is obscured by what I assume is some inherent attenuation applied to the bounding box in the shader routine. This is shown in the attached images, which are of the same dataset, viewed from different angles. In the second image the field is almost completely obscured.

I think that this is managed by the absorption parameter which is assigned in the appropriate default:

_default{T<:VolumeElTypes}(main::VolumeTypes{T}, s::Style, data::Dict) = @gen_defaults! data begin
...
    algorithm        = MaximumIntensityProjection
    boundingbox      = hull
    absorption       = 1f0
...

Is this the parameter I need to override? And how do I go about doing so? I have tried to override the default with keyword arguments, to no avail.


#2

Having read the volume shader fragment I can see that I was incorrect in my assumption that the absorption variable was related to what I was trying to achieve. Indeed, this is only used when visualising with _view(array, :absorption). In any case, those parameters are fixed as they do not reference the input style.

The correct way to achieve the desired effect is simply to manipulate the colormap such that that input volume is transparent where necessary. For example,

color_map = map(RGBA{U8}, GLVisualize.colormap("Blues"))
color_map[1] = RGBA{U8}(0,0,0,0)

will make transparent data close to the minimum value in the volume (in the case of the default color_norm which is set to the extrema of the data).


#3

Glad you figured it out :slight_smile: I definitely need a better validation of kw_args!

Btw, you should be able to use any array of Color.Colorant!


#4

Thank you Simon for all your work on this impressive package, it was no doubt quite an undertaking!

Do you suggest using Color.Colorant because this will give me direct control over, e.g., the alpha channel, rather than relying on a colour map?

I have been looking at some of the other volume rendering options, and I find that the absorption style seems to clip or cull parts of the image depending upon the view angle. Since it doesn’t look much like the examples in your thesis, I suspect I’m doing something wrong. Do you have any self-contained examples for this style?


#5

Do you suggest using Color.Colorant because this will give me direct control over, e.g., the alpha channel

I was just mentioning it for completeness :wink: Btw, it should be rather:

Colors.colormap("Blues")

It just works for you, since I import Colors in GLVisualize.
I think the example in the thesis was maximum intensity projection with a Gray color map.
I might be wrong though, it’s a long time ago and the algorithm has changed completely since then.

The clipping and culling is a bug :frowning: At some point I need to get back there and rework the volume rendering code!

Btw, you should try GLPlot master, there you should be able to play more easily with the parameters, like in:

just replace _view(visualize(volume)) with glplot(volume), and maybe you need to checkout GLVisualize master as well. The GUI you see in the video should open when you click on the very small button at the right!


#6

Ahh, okay, I’m pleased to hear this as I couldn’t work out what I was doing wrong! Do you think the problem is in the shader or at a higher level?

I will be sure to try out the GLPlot examples tomorrow.