-
Notifications
You must be signed in to change notification settings - Fork 95
Add ScaledBrightnessARGBConverter #385
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
This is to enable in BDV a better display control for label images This converter allows for better controling the visibility of ARGB segmentation. The scale value is used to alter the brightness of colors, which is better suited than altering R G and B in bulk. This could be used in the BDV, to finely control the visibility of a segmentation overlay in the shape of an ARGB image.
|
If possible, I would like to avoid the dependency on We could just inline the |
|
I couldn't resist... I think it should be more or less: v := max(r,g,b) and then r' := min(255, r+m) Could you try whether that works? |
This code is adapted from https://www.cs.rit.edu/~ncs/color/t_convert.html with feedback from Claude AI. It improves the previous version by getting rid of the Color dependency and by being thread safe (removing the need for a float[] field).
|
Done! |
|
Could you try what I suggested above: I think this should be exactly the same as via HSB conversion. |
|
I had tried and it does not seem to work. The display is unsensitive to private static final int getScaledColor( final int color, final double scale )
{
final int r = ARGBType.red( color );
final int g = ARGBType.green( color );
final int b = ARGBType.blue( color );
final int v = Math.max( r, Math.max( g, b ) );
final double m = Math.min( 1., v / scale ) - v;
final int nr = ( int ) Math.min( 255, r + m );
final int ng = ( int ) Math.min( 255, g + m );
final int nb = ( int ) Math.min( 255, b + m );
return 0xff000000 | ( nr << 16 ) | ( ng << 8 ) | nb;
}
|










This is to enable in BDV a better display control for label images
This converter allows for better controling the visibility of ARGB segmentation. The scale value is used to alter the brightness of colors, which is better suited than altering R G and B in bulk.
This could be used in the BDV, to finely control the visibility of a segmentation overlay in the shape of an ARGB image.