View Issue Details

IDProjectCategoryView StatusLast Update
0003009Slicer4Core: Base Codepublic2014-03-06 05:54
Reporternicole Assigned Toalexy  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version 
Target VersionSlicer 4.3.0Fixed in VersionSlicer 4.4.0 
Summary0003009: Slice compositing pipeline not respecting color table alpha values
Description

Trying to craft a custom color table that has opacity values of 0 for the middle values, the slice compositing pipeline is not respecting the opacity values in the table when displaying the foreground + background volumes.

Steps To Reproduce

Load atlas.nii and functional_result.nii as greyscale volumes, place in foreground and background.
Load fmriLUT.ctbl as a color table
Assign fmriLUT to be the color node for functional_result
Set the window for functional_result to be 10000, set the level to be 0.

Note that the opacity slider has to be used for compositing the two volumes rather than Slicer using the opacity=0 levels from the color table.

Additional Information

Playing with the compositing options, alpha blend and reverse alpha blend don't work, but add seems to get a bit closer.

From Jon Koller:
Yes, I am loading both as greyscale volumes and using fmriLUT.ctbl for the functional_result image. [...] My functional_result image has values from -5000 to 0 (corresponding to results in one direction) and values from 0 to 5000 (corresponding to results in the other direction). [...] I want to be able to load an image like this, that has negative and positive values, but set some threshold that would apply to both directions, positive and negative. That's what I was trying to do with my .ctbl, make it transparent in the -1300 to +1300 range by setting the window/level to 10,000 / 0 and scaling the color table accordingly.

From Steve:
I had a quick look at this and I think the issue is in the compositing pipeline (SliceLogic) somehow discarding the alpha channel for the foreground volume. Probably it is replacing it with the fade value rather than multiplying the fade times the alpha.

TagsNo tags attached.

Relationships

related to 0002970 closedalexy Background label color obscures the view when non-zero 

Activities

2013-03-14 07:14

 

ColorTableOpacityData.zip (781,121 bytes)
jmk1

jmk1

2013-03-19 07:23

reporter   ~0008145

Hi,

any progress on this? We are really excited to use it in several projects!

thanks,
Jon

jmk1

jmk1

2013-04-01 14:45

reporter   ~0008277

any updates?

thanks,
Jon

nicole

nicole

2013-04-02 08:52

administrator   ~0008285

Hi Jon,

With the priority set to normal and severity set to minor, it's fallen below other critical bugs in Alex's work flow. Would you like to have it re-prioritised?

jmk1

jmk1

2013-04-03 09:39

reporter   ~0008301

Hi Nicole,

If we could raise the priority, that would be great. This would be a really cool feature for us, and I know there are several others in our lab who would use slicer if it could display images like this.

thanks,
Jon

jmk1

jmk1

2013-04-11 14:35

reporter   ~0008378

Hi Nicole and Alex,

Sorry, I don't mean to be a pain. I'm making figures for two different papers that will be submitted by the end of the month. I'd love to use slicer to make these figures. Do you have a guess as to whether this will be fixed by then? If not, I need to look for another way to make my figures. Again, not trying to be a pain, I just need to decide what I'll be using.

thanks,
Jon

alexy

alexy

2013-04-12 05:39

developer   ~0008380

I loaded the volumes and LUT and the picture I got seems to respect 0 alpha.
I am attaching the image, is it not what you expected to see?

2013-04-12 05:40

 

LUT_Blend.PNG (220,716 bytes)
LUT_Blend.PNG (220,716 bytes)
jmk1

jmk1

2013-04-12 05:57

reporter   ~0008381

Hi Alex,

Thanks for taking a look. Are you sure it's really alpha 0? Or is it just blending the black with the background image? Try adjusting the foreground image slider and watching the background image. If you see the background image getting darker and lighter as you go, then that means it's mixing the background image with the black part of the foreground image. What I want it to look like is the background image untouched in the parts of the foreground image that are not red or blue when the foreground image is turned up to 100%.

thanks,
Jon

alexy

alexy

2013-04-12 06:41

developer   ~0008382

Hi Jon,
It seems that right now it is doing alpha blend:
the resulting blend_alpha = fg_opacity fg_alpha + (1-fg_opacity) bg_alpha

if fg=funtional_result_volume; bg=atlas_volume; and fg_opacity = 1.0

blend_alpha = fg_alpha, which is what I see currently.

But you want it to be blend_alpha = bg_alpha always independent of opacity, am I correct?

2013-04-12 06:52

 

LUT_Blend1.PNG (458,231 bytes)
LUT_Blend1.PNG (458,231 bytes)
alexy

alexy

2013-04-12 06:55

developer   ~0008383

Jon, is that what you expectat
fg=funtional_result_volume; bg=atlas_volume; fg opacity 100%
(see LUT_Blend1 image)?

This was made using vtkImageBlend::BlendMode(VTK_IMAGE_BLEND_MODE_COMPOUND) which is not currently exposed in slicer UI.

jmk1

jmk1

2013-04-12 06:59

reporter   ~0008384

Hi Alex,
Almost. in your blend_alpha formula, if the fg_alpha is 0.0 (which it is in the middle of fmriLUT.ctbl (see rows 100 through 170), and fg_opacity = 1.0, then blend_alpha would = 0, not fg_alpha. In fact, if fg_alpha = 0.0, then blend_alpha will always be some fraction of bg_alpha, dependent on fg_opacity.

Am I wrong in the way I'm thinking about alpha? In my mind it means that if a foreground voxel has alpha 0, then it should be "transparent", and simply show the background voxel at 100%. Is this wrong?

So maybe the formula should be this?

blend_alpha = fg_opacity fg_alpha + (1 - fg_opacityfg_alpha) * bg_alpha

That way if fg_alpha = 0.0, then blend_alpha will = bg_alpha, and the fg_alpha would still modulate blend_alpha the same way if it was = 1.0, which it almost always is.

Feel free to call me if chatting would be easier, 314-488-7132

thanks again,
Jon

jmk1

jmk1

2013-04-12 07:10

reporter   ~0008385

Hi Alex,

Sorry, I didn't see your second response before I sent that last note. It's hard to tell, but it still doesn't look right. If you just select "none" for the foreground image in the view from that last image, does the background image look the same? and when you turn the foreground image back on, does that background image get "darker"? It's hard to tell from the pictures.

alexy

alexy

2013-04-12 07:33

developer   ~0008386

Jon, I suggest we discuss it with Steve, he is more knowledgeable about this pipeline. Are you available next Tuesday, April 16th?

jmk1

jmk1

2013-04-12 08:15

reporter   ~0008387

Sure, I'm available then. And actually, as I look back at Steve's comment, he even says "Probably it is replacing it with the fade value rather than multiplying the fade times the alpha", which I think is what I just suggested in the formula, right now in the bg part of the blend equation it's fg_opacity (the fade) and not fg_opacity*fg_alpha (the fade times the alpha).

2013-04-16 12:10

 

VtkMRMLScalarVolumeDisplayNode.pdf (33,643 bytes)
alexy

alexy

2013-04-16 12:12

developer   ~0008411

Jon, after talking to Steve we have decided that we have to restructure the pipeline as shown in the diagram

jmk1

jmk1

2013-04-16 12:21

reporter   ~0008412

Hi Alex,

Thanks for the update. It looks like there are two new steps in the pipeline to implement. Any idea as to when this will be done?

thanks again for moving this along,
Jon

2013-04-16 18:01

 

2013-04-19 10:11

 

LUT_Blend2.PNG (424,513 bytes)
LUT_Blend2.PNG (424,513 bytes)
alexy

alexy

2013-04-19 10:13

developer   ~0008448

Here is a result of the new pipeline at fg opacity = 1. The bg does not changes as I decrease fg opacity, but fg fades to nothing at 0.
Jon, is this what you expect?

jmk1

jmk1

2013-04-19 10:18

reporter   ~0008449

Yes, I think that's it! yay! Will this be in tonight's build?

alexy

alexy

2013-04-19 10:23

developer   ~0008450

I am testing performance now, scrolling seems just a bit slower but but should be probably ok

alexy

alexy

2013-04-19 10:44

developer   ~0008451

Updated vtkMRMLScalarVolumeDisplayNode visualization pipeline to fix alpha compositing problem as described in the attached diagram.
Rev. 21900

pieper

pieper

2013-04-20 13:00

administrator   ~0008454

Great!

jcfr

jcfr

2013-04-23 07:02

administrator   ~0008466

Out of curiosity, is the nice schematics reported in "VtkMRMLScalarVolumeDisplayNode.pdf " added to either the wiki or doxygen ?

pieper

pieper

2013-04-23 07:23

administrator   ~0008467

Good question - do we have a way to add pdf or png files to doxygen?

BTW, I made them with LucidChart, which is a very simple browser-based drawing package.

jcfr

jcfr

2013-04-23 07:39

administrator   ~0008468

Doxygen support images: http://www.stack.nl/~dimitri/doxygen/manual/commands.html#cmdimage

We would need to make sure the IMAGE_PATH settings is properly configured: https://github.com/Slicer/Slicer/blob/master/Utilities/Doxygen/Doxyfile.txt.in#L744

As a convention, we could do the following:
1) If needed, add a directory named "Documentation" to library, loadable module, etc ...
2) Add images to a sub directory of the documentation folder: /path/to/Documentation/images

It means, if doxygen can be generated on a given platform, we would scan the source tree for path matching "*/Documentation/images" and append them to the IMAGE_PATH setting.

What do you think ?

pieper

pieper

2013-04-23 13:14

administrator   ~0008469

I think it sounds great to have the option to add pngs to the doxygen - as we discussed today, probably a good idea to come up with our wish list for a nice system to be implemented in the namic renewal.

jcfr

jcfr

2014-03-06 05:15

administrator   ~0011069

Closing resolved issues that have not been updated in more than 3 months

Issue History

Date Modified Username Field Change
2013-03-14 07:14 nicole New Issue
2013-03-14 07:14 nicole Status new => assigned
2013-03-14 07:14 nicole Assigned To => alexy
2013-03-14 07:14 nicole File Added: ColorTableOpacityData.zip
2013-03-19 07:23 jmk1 Note Added: 0008145
2013-04-01 14:45 jmk1 Note Added: 0008277
2013-04-02 08:52 nicole Note Added: 0008285
2013-04-03 09:39 jmk1 Note Added: 0008301
2013-04-11 14:35 jmk1 Note Added: 0008378
2013-04-12 05:39 alexy Note Added: 0008380
2013-04-12 05:39 alexy Status assigned => feedback
2013-04-12 05:40 alexy File Added: LUT_Blend.PNG
2013-04-12 05:57 jmk1 Note Added: 0008381
2013-04-12 06:41 alexy Note Added: 0008382
2013-04-12 06:52 alexy File Added: LUT_Blend1.PNG
2013-04-12 06:55 alexy Note Added: 0008383
2013-04-12 06:59 jmk1 Note Added: 0008384
2013-04-12 07:10 jmk1 Note Added: 0008385
2013-04-12 07:33 alexy Note Added: 0008386
2013-04-12 08:15 jmk1 Note Added: 0008387
2013-04-16 12:10 alexy File Added: VtkMRMLScalarVolumeDisplayNode.pdf
2013-04-16 12:12 alexy Note Added: 0008411
2013-04-16 12:21 jmk1 Note Added: 0008412
2013-04-16 18:01 pieper File Added: Screen Shot 2013-04-16 at 9.59.59 PM.png
2013-04-18 13:53 pieper Relationship added related to 0002970
2013-04-19 10:11 alexy File Added: LUT_Blend2.PNG
2013-04-19 10:13 alexy Note Added: 0008448
2013-04-19 10:18 jmk1 Note Added: 0008449
2013-04-19 10:23 alexy Note Added: 0008450
2013-04-19 10:44 alexy Note Added: 0008451
2013-04-19 10:44 alexy Status feedback => resolved
2013-04-19 10:44 alexy Resolution open => fixed
2013-04-20 13:00 pieper Note Added: 0008454
2013-04-23 07:02 jcfr Note Added: 0008466
2013-04-23 07:23 pieper Note Added: 0008467
2013-04-23 07:39 jcfr Note Added: 0008468
2013-04-23 13:14 pieper Note Added: 0008469
2014-03-06 05:15 jcfr Note Added: 0011069
2014-03-06 05:16 jcfr Status resolved => closed
2014-03-06 05:54 jcfr Fixed in Version => Slicer 4.4.0