Skip to content
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

[EEG Browser] Addition of new changes to signal plot of electrophysiology_browser module from EEGNet #8415

Merged
Show file tree
Hide file tree
Changes from 138 commits
Commits
Show all changes
145 commits
Select commit Hold shift + click to select a range
bf21506
Adding EEG Browser module from aces/LORIS:main
Nov 19, 2021
589a798
[Overrides] Adding overrides to EEG Browser for annotation support an…
Nov 19, 2021
92a288b
amend props annotationForm
Nov 23, 2021
5308237
update package.json to include protobuf
Dec 3, 2021
42cb9f5
Amend metadata to include current user as annotation author
Dec 6, 2021
0952b40
fixed typo in annotationtsv header
Dec 6, 2021
4ea55ce
Update .gitignore
jesscall Dec 7, 2021
ae0b226
Added annotation labels for sara
Dec 7, 2021
eba0c0b
Apply suggestions from code review
jesscall Dec 8, 2021
c909fc6
started improvements on annatoationForm
Jan 5, 2022
32aab7c
form elements
Jan 6, 2022
83a464c
more improvements - event manager
Jan 6, 2022
5bbdd1e
edit and delete annotations
Jan 7, 2022
9515e5f
deriv structure changed for raw files, bugs fixed
Jan 10, 2022
7abe6fb
currentAnnotation state
Jan 11, 2022
a76520b
comment bug
Jan 11, 2022
7938762
time range buttons and annotations edit bugfix
Jan 18, 2022
e8b08f8
bugfix epochs visibility toggle
Jan 18, 2022
bb4b11f
labels fix
Jan 19, 2022
aaae443
2022_01_19_event_label_trial_type_fix
Jan 19, 2022
1ddc04a
document overrides
Jan 21, 2022
eef8b9c
cosmetic changes
Jan 31, 2022
7fd9029
Merge branch 'main' into 2022_01_19_event_label_trial_type_fix
jesscall Feb 7, 2022
9e0bbe3
finished sql, archive event files tool
Feb 9, 2022
9fc0a71
Merge branch 'main' into 2022_02_01_HED_DB_Architecture
jesscall Feb 9, 2022
93469da
first commit
Feb 11, 2022
43c1b25
overrides documented
Feb 15, 2022
681d82f
fixing issue with bids_import duplication of labels - LORIS-MRI/#763
Feb 15, 2022
b1a1623
don't save 'all' as chan value in DB
Feb 15, 2022
b3843ab
Merge pull request #70 from jesscall/2022_02_01_HED_DB_Architecture
jesscall Feb 24, 2022
69ffe7c
bugfix accessing events file for visualization
Mar 7, 2022
2a674eb
Epoch Refactor and Viewing HED Tags
May 9, 2022
0f0b60b
rm commented out code
May 11, 2022
f1b104b
fix interval hops to be 1s instead of 5s
Andesha Jun 1, 2022
bc17fd9
fix cursor to show 3 decimals in data series
Andesha Jun 1, 2022
cd59c99
remove popup on annotation success; add toast
Andesha Jun 1, 2022
d55af05
fix style in conditional divs
Andesha Jun 2, 2022
2510cbc
fix context switch to anno menu after timeout
Andesha Jun 2, 2022
c3ea3f4
add spacing to annotation alert
Andesha Jun 2, 2022
eb7dd02
add TextboxElement
jesscall Jun 9, 2022
223ac30
add keyboard event listener with cursor var read
Andesha Aug 13, 2022
e31dc69
add right panel keybind functionality
Andesha Aug 15, 2022
22159e5
add working support for keybind channel scrolling
Andesha Aug 15, 2022
0c7cfd8
fix double press needed for channel offset key press
Andesha Aug 15, 2022
692ea2a
add timeline scrolling support
Andesha Aug 15, 2022
41ab72b
Minor UX changes to the event panel
jeffersoncasimir Nov 30, 2022
0680c38
Increased default number of channels to 32. Adjusted display height t…
jeffersoncasimir Dec 1, 2022
6f2d370
Modified the initial time interval to 30 seconds. Added a button to t…
jeffersoncasimir Dec 2, 2022
859b41e
Right-aligned SeriesCursor text for better appearance while loading
jeffersoncasimir Dec 2, 2022
b71ea34
Merge branch 'main' into tyler-dev-keypress
Andesha Dec 5, 2022
0f10610
Merge pull request #98 from jeffersoncasimir/increase_channels_reduce…
jeffersoncasimir Dec 6, 2022
e320315
Added dataDirBasepath to config.xml and removed package-lock from .gi…
jeffersoncasimir Dec 6, 2022
cd5ab5e
Adjusted event panel max-height in consequence of having changed the …
jeffersoncasimir Dec 7, 2022
22e483d
Fixed bug when fetching chunks
jeffersoncasimir Dec 12, 2022
3203aac
Merge EEG Browser improvements and jsdoc additions from branch 'loris…
jeffersoncasimir Dec 22, 2022
b3cf5ff
Resolved some forgotten merge conflicts
jeffersoncasimir Dec 22, 2022
4555acb
Resolved some forgotten merge conflicts
jeffersoncasimir Dec 22, 2022
43a4afe
Re-enabled keyboard events
jeffersoncasimir Dec 22, 2022
34d987b
Interval jump behaviour made uniform
jeffersoncasimir Dec 22, 2022
539f897
Reduced slider handle size
jeffersoncasimir Dec 22, 2022
f38b8c9
Added <input type="number"> fields to control the time interval
jeffersoncasimir Dec 23, 2022
7a42906
Added toggle functionality for amplitude data visibility
jeffersoncasimir Dec 24, 2022
2e8b1d8
Added channel hover for value and visibility + Added ability to toggl…
jeffersoncasimir Jan 5, 2023
08758ae
Reverted EEGMontage.tsx to working version
jeffersoncasimir Jan 5, 2023
caede9f
Removed scale lines on the vertical axis on the left side
jeffersoncasimir Jan 6, 2023
9596183
Moved horizontal axis text and ticks to the outside of the graph
jeffersoncasimir Jan 6, 2023
fc155c3
Added ability to dynamically change number of displayed channels
jeffersoncasimir Jan 6, 2023
bc7c665
Fixed overflow issue
jeffersoncasimir Jan 13, 2023
20f9627
Added hover functionality to channel name
jeffersoncasimir Jan 13, 2023
9f92ee3
Fixed time selection from right to left
jeffersoncasimir Jan 16, 2023
ce000f3
Merge pull request #110 from jeffersoncasimir/eeg_cursor_improvements
jeffersoncasimir Jan 17, 2023
b9bf709
Merge pull request #111 from jeffersoncasimir/eeg_time_interval_impro…
jeffersoncasimir Jan 17, 2023
3aae190
Merge pull request #112 from jeffersoncasimir/2023_01_06_eeg_axes_vis…
jeffersoncasimir Jan 17, 2023
63f27d0
Merge branch 'main' into 2023_01_06_eeg_max_channels
jeffersoncasimir Jan 17, 2023
2dbf4a6
Merge pull request #116 from jeffersoncasimir/2023_01_16_eeg_time_sel…
jeffersoncasimir Jan 17, 2023
c5c8945
Changed channel display options to reflect discussed values
jeffersoncasimir Jan 18, 2023
db403c2
Visual improvements to the Series Renderer
jeffersoncasimir Jan 18, 2023
7bbdaca
Modification to allow 3-decimal precision on time selection
jeffersoncasimir Jan 23, 2023
d58307a
Added key shortcut to zoom to time selection + slight refactor
jeffersoncasimir Jan 23, 2023
862f256
Added zooming keyboard shortcuts and proper input field functionality
jeffersoncasimir Jan 23, 2023
6374fe1
Added prevention of interval overlap + slight component refactor
jeffersoncasimir Jan 23, 2023
12bbe76
Added constraint to prevent time selection overlap on zoom
jeffersoncasimir Jan 23, 2023
8746a81
Added buttons to interface for zooming
jeffersoncasimir Jan 23, 2023
de4c770
Slight aesthetic improvement
jeffersoncasimir Jan 23, 2023
1844b61
Slight aesthetic improvement
jeffersoncasimir Jan 23, 2023
b7d64ea
Fixed typo that led to wrong evaluation
jeffersoncasimir Jan 24, 2023
2ecd28f
Fixed comparison that led rounding errors
jeffersoncasimir Jan 24, 2023
e6fee29
Proper handling of an annotation's bounds
jeffersoncasimir Jan 24, 2023
86004ed
Added button to reset zoom to the default interval
jeffersoncasimir Jan 25, 2023
e1b6dd0
Slight visual improvements
jeffersoncasimir Jan 25, 2023
b1dcfa9
Changed location of zoom buttons to optimize usage of space
jeffersoncasimir Jan 25, 2023
b4bec34
Improved UX by not enabling 'Range' Zoom button if selection too smal…
jeffersoncasimir Jan 25, 2023
14cee2c
Slight modifications to accomodate event panel resize
jeffersoncasimir Jan 26, 2023
cac99f1
Improved memory performance by differently setting hover colors
jeffersoncasimir Jan 26, 2023
8bb546c
Removed unused import statement
jeffersoncasimir Jan 26, 2023
61fe7e3
Added channel stacking feature
jeffersoncasimir Jan 26, 2023
c41c5fa
Fixed visual inconsitency occurring between browsers
jeffersoncasimir Jan 26, 2023
5b13f16
Refinements to stacking feature + New 'Channel Isolation' feature
jeffersoncasimir Jan 26, 2023
47332cb
Merge pull request #129 from jeffersoncasimir/2023_01_26_eeg_performa…
jeffersoncasimir Jan 26, 2023
f74f863
Merge branch 'aces:main' into eeg_feature_channel_stacking
jeffersoncasimir Jan 26, 2023
162cbea
Fixed bug where selecting interval in opposite direction doesn't enab…
jeffersoncasimir Jan 26, 2023
b220942
Fixed minor behavioural bug
jeffersoncasimir Jan 27, 2023
6ea467f
UX improvements for zooming and selecting time
jeffersoncasimir Jan 27, 2023
b7d4b67
Fixed epochs disappearing when panel is open
jeffersoncasimir Jan 27, 2023
a91ef44
Epoch name follows cursor differently
jeffersoncasimir Jan 27, 2023
5a848f9
Changed behaviour of signal hovering when in 'Isolate' mode
jeffersoncasimir Jan 27, 2023
c224343
Merge branch 'main' into eeg_feature_channel_stacking
jeffersoncasimir Jan 30, 2023
6f7a65b
Merge pull request #132 from jeffersoncasimir/2023_01_27_eeg_ux_impro…
jeffersoncasimir Jan 30, 2023
d030540
Modified hovering behaviour for stacked channels
jeffersoncasimir Jan 30, 2023
af9f520
Modifications to events display
jeffersoncasimir Jan 30, 2023
bfd9c88
Limited channel offset index to prevent whitespace
jeffersoncasimir Jan 30, 2023
2aa6701
Reduced viewwer height by 20% when 4 channels are visible
jeffersoncasimir Jan 30, 2023
3adaf8a
Modified panel to show visible/total events
jeffersoncasimir Feb 1, 2023
21eceff
Merge branch 'main' into eeg_event_panel_improvements
jeffersoncasimir Feb 1, 2023
b4b2a25
Added total number of epochs to panel and included those with NaN onset
jeffersoncasimir Feb 1, 2023
e45ec20
Slight refactor for improved efficiency
jeffersoncasimir Feb 1, 2023
3d37990
Event panel message UX improvement
jeffersoncasimir Feb 1, 2023
41f0e74
Fixed parsing error
jeffersoncasimir Feb 1, 2023
3b50bf1
Fixed error thrown when trying to display epochs with NaN onset and/o…
jeffersoncasimir Feb 1, 2023
25e029a
Reduced width of durationless epochs + Improved event highlight behav…
jeffersoncasimir Feb 8, 2023
ddc462b
Minimum epoch size scales with interval
jeffersoncasimir Feb 9, 2023
5ddf0dc
Improved visibility of epoch when hovered via panel
jeffersoncasimir Feb 9, 2023
cc5b3e9
Added DC offset feature
jeffersoncasimir Feb 14, 2023
900fe52
Buttons are now in front of out bounds signals
jeffersoncasimir Feb 16, 2023
e446503
Fixed chunk fetching near edges + Refactored variable names
jeffersoncasimir Feb 16, 2023
1024119
Added overflow toggle button + Minor UI improvements
jeffersoncasimir Feb 22, 2023
2414804
Fixed capitalization of word
jeffersoncasimir Feb 22, 2023
30cd35e
First pass as fixing eslint errors
jeffersoncasimir Feb 23, 2023
f6e4521
electrophysiology_browser module improvements from EEGNet
jeffersoncasimir Feb 24, 2023
f592cee
Fixed lint errors
jeffersoncasimir Feb 24, 2023
b6598d9
Fixed lint errors
jeffersoncasimir Feb 24, 2023
b15cd8f
Fixed lint errors
jeffersoncasimir Feb 24, 2023
60095fe
Fixed css file
jeffersoncasimir Feb 24, 2023
223fc33
Merge branch '2023_02_24_electrophysiology_browser_module_eegnet' of …
jeffersoncasimir Feb 24, 2023
652f801
Re-added truncated snippet
jeffersoncasimir Feb 28, 2023
21ec40c
Minor UI changes
jeffersoncasimir Mar 3, 2023
8924a0f
Modified README to reflect new changes
jeffersoncasimir Mar 3, 2023
e014119
Fixed typo
jeffersoncasimir Mar 3, 2023
ee346b7
Merge branch 'main' into 2023_02_24_electrophysiology_browser_module_…
jeffersoncasimir Mar 29, 2023
d96d32a
Fixed lint and v18 warnings
jeffersoncasimir Mar 29, 2023
79571dd
Deleted unused images
jeffersoncasimir Mar 29, 2023
8a12eae
[EEG] Electrodes query and file download fix (#8478)
laemtl Mar 28, 2023
5b79bd5
Fix top axis
laemtl Mar 30, 2023
d2e140a
Migrate images on documentation imaging server
laemtl Apr 18, 2023
7411521
Merge branch '25.0-release' into 2023_02_24_electrophysiology_browser…
laemtl Apr 26, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion modules/electrophysiology_browser/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,3 @@ The visualization components require Protocol Buffers v3.0.0 or higher.
For install instructions, you can refer to the Protocol Buffers GitHub page: https://github.com/protocolbuffers/protobuf

To enable the visualization components, set the useEEGBrowserVisualizationComponents config (Configuration/GUI) to true and run `make dev` or 'npm install && npm run compile' from the loris root directory.

Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ svg {
user-select: none;
}

svg:not(:root) {
overflow: clip;
}

.list-group-item {
position: relative;
display: flex;
Expand Down Expand Up @@ -96,6 +100,26 @@ svg {
border: 1px solid #333;
}

.input-interval-bound {
width: 60px;
height: 22px;
font-size: 10px;
float: left;
text-align: center;
}

.btn-zoom {
margin: 0 auto 3px auto;
width: 50px;
text-align: center;
}

.col-xs-title {
color: #064785;
font-weight: bold;
text-align: center;
}

#electrode-montage .list-group {
border: 1px solid #ddd;
}
Expand Down Expand Up @@ -134,6 +158,14 @@ svg {
height: auto !important;
}

#eegSessionView .panel-heading > div > i {
cursor: pointer;
}

#eegSessionView .panel-heading > div > i:hover {
scale: 1.05;
}

#eegSidebar {
top: 0;
bottom: 0;
Expand Down Expand Up @@ -186,10 +218,10 @@ svg {
/* Large Devices, Wide Screens */
@media only screen and (min-width : 1200px) {
.pull-right-lg {
float: right;
text-align: right;
}

.pagination-nav {
padding-top: 0;
}
}
}
Binary file modified modules/electrophysiology_browser/images/event-panel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified modules/electrophysiology_browser/images/overall-view.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified modules/electrophysiology_browser/images/signal-values.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# EEG Browser Visualization

## Main dependencies

- [Ramda](https://ramdajs.com)
A practical functional library for JavaScript programmers.

Expand Down Expand Up @@ -32,24 +31,52 @@ The EEG Browser visualization component adds support for some useful visual help
### Signal Viewer
![Signal Viewer](./../../images/signal-values-details.png) <br/><br/>
Several tools can be used to navigate through the Signal Viewer:
- The **Timeline Range View** (1) can be used to change the boundaries of the viewed timeline.
- The **Amplitude** and **Filter** tools (2) can be used to increase/reduce the amplitude scale and apply high or low-pass filters.
- The **Channel navigation** (3) can be used to navigate through the viewed channels.
- The **Event Panel** (4) can be used to display information about the events when event data is available.
- If the selected timeline range contains more than 100 events, a message (5) indicates the user to reduce the boundaries of the timeline in order to display the event data.
- The **Zoom Controls** (1) can be used to increase or reduce the time interval while maintaining the same midpoint.
- *Reset*: Set 'zoom' level to default value (5 second interval).
- *+ / -*: Zoom in or out, respectively.
- *Region*: This button becomes available when a region is highlighted on the plot (left-click drag). Pressing it sets the time interval to the selected region.
- The **Timeline Range View** (2) can be used to change the boundaries of the viewed timeline.
- *[<] / [>]*: These arrows translate the interval bounds backwards or forwards, respectively, by 1 second.
- *[<<] / [>>]*: These arrows translate the interval bounds backwards or forwards, respectively, by the value of the interval.
- *Text fields*: The text fields can be edited to manually set the interval.
- *Sliders*: The sliders can be dragged as an alternative way to set the interval range.
- The **Amplitude** and **Filter** tools and the **Show/Hide Overflow** button (3) can be used to increase/reduce the amplitude scale, apply high or low-pass filters, or toggle the visibility of signal spillage, respectively.
- The **Channel Navigation** (4) toolbar can be used to navigate through the viewed channels.
- *Dropdown*: This dropdown allow to change the number of displayed channels. Currently supported values are: 4, 8 16, 32 or 64 visible channels.
- *Text field*: This can be used to manually set the starting index of the displayed channels.
- *[<] / [>]*: These arrows translate the visible channel range backwards or forwards, respectively, by 1 channel.
- *[<<] / [>>]*: These arrows translate the visible channel range backwards or forwards, respectively, by the number of displayed channel.
- The **Channel Adjustment** (5) buttons can be used to vertically adjust the position of the signals.
- *DC/NO Offset*: This button toggles the subtraction of DC offset from the signals, used to center them with respect to their assigned row.
- *Stack/Spread*: This button toggles the channels from being in their assigned row to being all stacked on the same row. [[Stacked View Demo](#stacked-view)]
- The **Event Panel** (6) can be used to display information about the events when event data is available.
- If the selected timeline range contains more than 500 events, a message inside the panel indicates the user to reduce the boundaries of the timeline in order to display the event data.
<br/><br/>
<p align="center">
<img width="650" src="./../../images/signal-values.png"/><br/>
<sub>Signal Viewer with signal values and event data displayed.</sub>
<p style="text-align: center;">
<img width src="./../../images/signal-values.png"/><br/>
<sub>Signal Viewer with hovered signal value and event data displayed.</sub>
</p>


### Stacked View
Hovering channel names while in 'stacked' or 'spread (default)' view will thicken the respective signal(s). While in stacked view, a feature called "Isolate" becomes available. [[Isolate Mode Demo](#isolate-mode)]
<br/><br/>![Stacked View](./../../images/signal-stacked.png) <br/>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think these images should be here. The sentences make sense without them and I don't think they add enough value to justify the cost of adding binary files to our github repo.



### Isolate Mode
Hovering channel names while in 'isolate' mode will make that signal the only visible signal on the plot.
<br/><br/>![Isolate Mode](./../../images/signal-isolated.png) <br/>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think these images should be here. The sentences make sense without them and I don't think they add enough value to justify the cost of adding binary files to our github repo.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @driusan - I have an updated commit ready to push, but just for context, these images were added to be consistent with @laemtl's documentation, and I think, requested originally by Leigh.
@laemtl should we move these elsewhere?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if we have the option to host the files on a server to avoid committing the images. Documentation wise, I think those images were a good addition to document the module's new features.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@driusan This PR updates a README that was already containing images. Maybe we can discuss the images issue later to not hold this PR?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, once images are committed they're in the repo forever and need to be downloaded with every clone.



### Electrode Map
The current implementation of the Electrode Map supports 2 display modes: 2D and 3D.

| 2D View | 3D View |
|:-------------------------:|:-------------------------:|
|<img width="300" src="./../../images/electrodes-2d-hover.png"/><br/> The 2D view is a stereographic projection of the electrodes position. Electrodes are indexed and their name is displayed on mouse hover. | <img width="300" src="./../../images/electrodes-3d.png" /><br/> The 3D view displays the exact position of the electrodes on the brain. |


### Future developements to come
A signal annotation feature is currently under development.


A signal annotation feature is currently under development.
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import * as R from 'ramda';
import {scaleOrdinal} from 'd3-scale';
import {schemeDark2, schemeCategory10} from 'd3-scale-chromatic';

// import * as R from 'ramda';
// import {schemeCategory10, schemeSet3} from 'd3-scale-chromatic';
// export const colorOrder = scaleOrdinal(
// R.concat(schemeCategory10, schemeSet3)
// );

export const colorOrder = scaleOrdinal();
export const colorOrder = scaleOrdinal(
R.concat(schemeDark2, schemeCategory10)
);

/**
* hex2rgba
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {createEpicMiddleware} from 'redux-observable';
import thunk from 'redux-thunk';
import {fetchJSON, fetchText} from '../ajax';
import {rootReducer, rootEpic} from '../series/store';
import {MAX_CHANNELS} from '../vector';
import {DEFAULT_MAX_CHANNELS, DEFAULT_TIME_INTERVAL} from '../vector';
import {
setChannels,
emptyChannels,
Expand All @@ -15,6 +15,7 @@ import {
setEpochs,
setDatasetMetadata,
setPhysioFileID,
setFilteredEpochs,
} from '../series/store/state/dataset';
import {setDomain, setInterval} from '../series/store/state/bounds';
import {updateFilteredEpochs} from '../series/store/logic/filterEpochs';
Expand Down Expand Up @@ -107,11 +108,11 @@ class EEGLabSeriesProvider extends Component<CProps> {
})
);
this.store.dispatch(setChannels(emptyChannels(
Math.min(limit, channelMetadata.length),
Math.min(this.props.limit, channelMetadata.length),
1
)));
this.store.dispatch(setDomain(timeInterval));
this.store.dispatch(setInterval(timeInterval));
this.store.dispatch(setInterval(DEFAULT_TIME_INTERVAL));
}
}).then(() => {
return events.instances.map((instance) => {
Expand Down Expand Up @@ -160,7 +161,7 @@ class EEGLabSeriesProvider extends Component<CProps> {
})
)
);
this.store.dispatch(updateFilteredEpochs());
this.store.dispatch(setFilteredEpochs(epochs.map((_, index) => index)));
})
;

Expand Down Expand Up @@ -199,7 +200,7 @@ class EEGLabSeriesProvider extends Component<CProps> {
}

static defaultProps = {
limit: MAX_CHANNELS,
limit: DEFAULT_MAX_CHANNELS,
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ type CProps = {
* @param root0.setCurrentAnnotation
* @param root0.physioFileID
* @param root0.annotationMetadata
* @param root0.toggleEpoch,
* @param root0.updateActiveEpoch,
* @param root0.interval
* @param root0.toggleEpoch
* @param root0.updateActiveEpoch
*/
const AnnotationForm = ({
timeSelection,
Expand All @@ -55,10 +59,17 @@ const AnnotationForm = ({
setCurrentAnnotation,
physioFileID,
annotationMetadata,
toggleEpoch,
updateActiveEpoch,
interval,
}: CProps) => {
const [startEvent = '', endEvent = ''] = timeSelection || [];
const [event, setEvent] = useState([startEvent, endEvent]);
const [event, setEvent] = useState<(number | string)[]>(
[
startEvent,
endEvent,
]
);
const [label, setLabel] = useState(
currentAnnotation ?
currentAnnotation.label :
Expand Down Expand Up @@ -97,13 +108,14 @@ const AnnotationForm = ({
* @param val
*/
const handleStartTimeChange = (id, val) => {
const value = parseInt(val);
const value = parseFloat(val);
setEvent([value, event[1]]);

if (validate([value, event[1]])) {
let endTime = event[1];

if (typeof endTime === 'string') {
endTime = parseInt(endTime);
endTime = parseFloat(endTime);
}
setTimeSelection(
[
Expand All @@ -120,13 +132,14 @@ const AnnotationForm = ({
* @param val
*/
const handleEndTimeChange = (name, val) => {
const value = parseInt(val);
const value = parseFloat(val);
setEvent([event[0], value]);

if (validate([event[0], value])) {
let startTime = event[0];

if (typeof startTime === 'string') {
startTime = parseInt(startTime);
startTime = parseFloat(startTime);
}
setTimeSelection(
[
Expand Down Expand Up @@ -203,10 +216,10 @@ const AnnotationForm = ({
let startTime = event[0];
let endTime = event[1];
if (typeof startTime === 'string') {
startTime = parseInt(startTime);
startTime = parseFloat(startTime);
}
if (typeof endTime === 'string') {
endTime = parseInt(endTime);
endTime = parseFloat(endTime);
}
const duration = endTime - startTime;

Expand Down Expand Up @@ -401,18 +414,30 @@ const AnnotationForm = ({
id="start-time"
min="0"
label="Start Time"
value={event[0]}
value={event
? Math.min(
parseFloat(event[0] ? event[0].toString() : ''),
parseFloat(event[1] ? event[1].toString() : '')
)
: ''
}
required={true}
onUserInput={handleStartTimeChange}
/>
<NumericElement
name="end-time"
id="end-time"
min="0"
label="End Time"
value={event[1]}
required={true}
onUserInput={handleEndTimeChange}
name="end-time"
id="end-time"
min="0"
label="End Time"
value={event
? Math.max(
parseFloat(event[0] ? event[0].toString() : ''),
parseFloat(event[1] ? event[1].toString() : '')
)
: ''
}
required={true}
onUserInput={handleEndTimeChange}
/>
<SelectElement
name="label"
Expand All @@ -432,7 +457,7 @@ const AnnotationForm = ({
/>
<button
type="submit"
disabled={isSubmitted}
disabled={isSubmitted || !validate(event)}
onClick={handleSubmit}
className="btn btn-primary btn-xs"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ type CProps = {
],
color: string,
opacity: number,
minWidth: number,
};

/**
Expand All @@ -23,6 +24,7 @@ type CProps = {
* @param root0.scales
* @param root0.color
* @param root0.opacity
* @param root0.minWidth
*/
const Epoch = (
{
Expand All @@ -32,14 +34,18 @@ const Epoch = (
scales,
color,
opacity,
minWidth,
}: CProps) => {
onset = isNaN(onset) ? 0 : onset;
duration = isNaN(duration) ? 0 : duration;

const start = vec2.fromValues(
scales[0](onset),
scales[1](-parentHeight/2),
);

const end = vec2.fromValues(
scales[0](onset + duration) + MIN_EPOCH_WIDTH,
scales[0](onset + Math.max(duration, minWidth)),
scales[1](parentHeight/2)
);

Expand All @@ -62,6 +68,7 @@ const Epoch = (
Epoch.defaultProps = {
color: '#dae5f2',
opacity: 1,
minWidth: MIN_EPOCH_WIDTH,
};

export default Epoch;
Loading