Skip to content

Commit cbf7db7

Browse files
committed
Blend mode shortcut
1 parent def8717 commit cbf7db7

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/main/java/bdv/viewer/NavigationActions.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ public class NavigationActions extends Actions
4848
public static final String TOGGLE_INTERPOLATION = "toggle interpolation";
4949
public static final String TOGGLE_FUSED_MODE = "toggle fused mode";
5050
public static final String TOGGLE_GROUPING = "toggle grouping";
51+
public static final String TOGGLE_BLEND_MODE = "toggle blending mode";
5152
public static final String SET_CURRENT_SOURCE = "set current source %d";
5253
public static final String TOGGLE_SOURCE_VISIBILITY = "toggle source visibility %d";
5354
public static final String ALIGN_XY_PLANE = "align XY plane";
@@ -59,6 +60,7 @@ public class NavigationActions extends Actions
5960
public static final String[] TOGGLE_INTERPOLATION_KEYS = new String[] { "I" };
6061
public static final String[] TOGGLE_FUSED_MODE_KEYS = new String[] { "F" };
6162
public static final String[] TOGGLE_GROUPING_KEYS = new String[] { "G" };
63+
public static final String[] TOGGLE_BLEND_MODE_KEYS = new String[] { "U" };
6264
public static final String SET_CURRENT_SOURCE_KEYS_FORMAT = "%s";
6365
public static final String TOGGLE_SOURCE_VISIBILITY_KEYS_FORMAT = "shift %s";
6466
public static final String[] ALIGN_XY_PLANE_KEYS = new String[] { "shift Z" };
@@ -84,6 +86,7 @@ public void getCommandDescriptions( final CommandDescriptions descriptions )
8486
descriptions.add( TOGGLE_INTERPOLATION, TOGGLE_INTERPOLATION_KEYS, "Switch between nearest-neighbor and n-linear interpolation mode in BigDataViewer." );
8587
descriptions.add( TOGGLE_FUSED_MODE, TOGGLE_FUSED_MODE_KEYS, "TODO" );
8688
descriptions.add( TOGGLE_GROUPING, TOGGLE_GROUPING_KEYS, "TODO" );
89+
descriptions.add( TOGGLE_BLEND_MODE, TOGGLE_BLEND_MODE_KEYS, "Switch between summing and averaging (and possibly custom blending) of overlapping sources" );
8790

8891
final String[] numkeys = new String[] { "1", "2", "3", "4", "5", "6", "7", "8", "9", "0" };
8992
IntStream.range( 0, numkeys.length ).forEach( i -> {
@@ -121,6 +124,9 @@ public static void installModeActions( final Actions actions, final ViewerState
121124
actions.runnableAction( () -> toggleInterpolation( state ), TOGGLE_INTERPOLATION, TOGGLE_INTERPOLATION_KEYS );
122125
actions.runnableAction( () -> toggleFusedMode( state ), TOGGLE_FUSED_MODE, TOGGLE_FUSED_MODE_KEYS );
123126
actions.runnableAction( () -> toggleGroupingMode( state ), TOGGLE_GROUPING, TOGGLE_GROUPING_KEYS );
127+
128+
final BlendModeSwitcher blending = new BlendModeSwitcher( state );
129+
actions.runnableAction( blending::switchToNextMode, TOGGLE_BLEND_MODE, TOGGLE_BLEND_MODE_KEYS );
124130
}
125131

126132
public static void installTimeActions( final Actions actions, final ViewerState state )

src/main/resources/bdv/ui/keymap/default.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@
7171
action: toggle grouping
7272
contexts: [bdv]
7373
triggers: [G]
74+
- !mapping
75+
action: toggle blending mode
76+
contexts: [bdv]
77+
triggers: [U]
7478
- !mapping
7579
action: set current source 0
7680
contexts: [bdv]

0 commit comments

Comments
 (0)