• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

vanvalenlab / deepcell-label / 4179371273

pending completion
4179371273

Pull #425

github

GitHub
Merge f653b3e2b into 375a2da88
Pull Request #425: Implement buttons for matching cell types with marker panel

449 of 921 branches covered (48.75%)

Branch coverage included in aggregate %.

59 of 107 new or added lines in 15 files covered. (55.14%)

1 existing line in 1 file now uncovered.

3170 of 4883 relevant lines covered (64.92%)

582.62 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

38.46
/frontend/src/Project/service/raw/layerMachine.js
1
/** Manages the controls for a layer in color mode, including
2
 * which channel to show, the dynamic range, whether to show the layer, and the color.
3
 */
4
import { assign, Machine } from 'xstate';
5

6
const CHANNEL_COLORS = ['#FF0000', '#00FF00', '#0000FF', '#00FFFF', '#FF00FF', '#FFFF00'];
18✔
7

8
const createLayerMachine = (layer, numChannels) =>
18✔
9
  Machine(
844✔
10
    {
11
      context: {
12
        layer,
13
        channel: layer % numChannels,
14
        on: true,
15
        color: CHANNEL_COLORS[layer] || '#FF0000',
844!
16
        range: [0, 255],
17
      },
18
      on: {
19
        SET_LAYER: { actions: 'setLayer' },
20
        SET_CHANNEL: { actions: 'setChannel' },
21
        SET_COLOR: { actions: 'setColor' },
22
        RESET_COLORS: { actions: 'resetColors' },
23
        TOGGLE_ON: { actions: 'toggleOn' },
24
        SET_RANGE: { actions: 'setRange' },
25
      },
26
    },
27
    {
28
      actions: {
29
        setLayer: assign({ layer: (_, event) => event.layer }),
2✔
30
        setChannel: assign({ channel: (_, { channel }) => channel }),
×
31
        setColor: assign({ color: (_, { color }) => color }),
×
32
        resetColors: assign({
NEW
33
          color: (_, evt) => CHANNEL_COLORS[evt.layer] || '#FF0000',
×
34
        }),
UNCOV
35
        toggleOn: assign({ on: ({ on }) => !on }),
×
36
        setRange: assign({
37
          range: (_, { range }) => [
×
38
            Math.max(0, Math.min(255, range[0])),
39
            Math.max(0, Math.min(255, range[1])),
40
          ],
41
        }),
42
      },
43
    }
44
  );
45

46
export default createLayerMachine;
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc