• 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

68.75
/frontend/src/Project/service/imageMachine.js
1
/** Manages the controls the image, such as what time to show.
2
 *
3
 * Spawns rawMachine and labeledMachine to control the raw and labeled images.
4
 */
5

6
import { actions, assign, Machine, send, sendParent, spawn } from 'xstate';
7
import { fromEventBus } from './eventBus';
8
import createLabeledMachine from './labeledMachine';
9
import createRawMachine from './raw/rawMachine';
10

11
const { pure, respond } = actions;
18✔
12

13
const createImageMachine = ({ projectId, eventBuses, undoRef }) =>
18✔
14
  Machine(
813✔
15
    {
16
      id: 'image',
17
      entry: [send('REGISTER_UI', { to: undoRef }), 'spawnActors'],
18
      invoke: [
19
        { id: 'eventBus', src: fromEventBus('image', () => eventBuses.image) },
17✔
20
        { src: fromEventBus('labeled', () => eventBuses.load, 'DIMENSIONS') },
17✔
21
      ],
22
      context: {
23
        projectId,
24
        duration: 1,
25
        numFeatures: 1,
26
        numChannels: 1,
27
        t: 0,
28
        rawRef: null,
29
        labeledRef: null,
30
        eventBuses,
31
        undoRef,
32
      },
33
      on: {
34
        DIMENSIONS: { actions: 'setDimensions' },
35
        SET_T: { actions: ['setT', 'sendToEventBus'] },
36
        SAVE: { actions: 'save' },
37
        RESTORE: { actions: 'restore' },
38
        // Needed to rerender canvas
39
        ADD_LAYER: { actions: sendParent((c, e) => e) },
×
NEW
40
        FETCH_LAYERS: { actions: sendParent((c, e) => e) },
×
41
        REMOVE_LAYER: { actions: sendParent((c, e) => e) },
1✔
42
      },
43
    },
44
    {
45
      actions: {
46
        setDimensions: assign({
47
          duration: (context, event) => event.duration,
12✔
48
          numFeatures: (context, event) => event.numFeatures,
12✔
49
          numChannels: (context, event) => event.numChannels,
12✔
50
        }),
51
        setT: assign({ t: (_, { t }) => t }),
×
52
        sendToEventBus: send((c, e) => e, { to: 'eventBus' }),
×
53
        spawnActors: assign((context) => ({
813✔
54
          rawRef: spawn(createRawMachine(context), 'raw'),
55
          labeledRef: spawn(createLabeledMachine(context), 'labeled'),
56
        })),
57
        save: respond(({ t }) => ({ type: 'RESTORE', t })),
12✔
58
        restore: pure((_, { t }) => {
59
          return [send({ type: 'SET_T', t }), respond('RESTORED')];
×
60
        }),
61
      },
62
    }
63
  );
64

65
export default createImageMachine;
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