Compare commits
5 Commits
v1.1.1
...
3e0f70ea49
| Author | SHA1 | Date | |
|---|---|---|---|
| 3e0f70ea49 | |||
| d6c71e0ab2 | |||
| 87073fb218 | |||
| 3d0fbd5c5e | |||
| 3f38f5a978 |
19
changelog.md
19
changelog.md
@@ -1,3 +1,22 @@
|
|||||||
|
# Version 1.1.3
|
||||||
|
|
||||||
|
- Added back the ability to use the fOLD dataset. Fixes [Issue 23](https://git.research.dezeeuw.ca/tyler/flares/issues/23)
|
||||||
|
- 5th option has been added under Analysis to get to fOLD channels per participant
|
||||||
|
- Added an option to cancel the running process. Fixes [Issue 15](https://git.research.dezeeuw.ca/tyler/flares/issues/15)
|
||||||
|
- Prevented graph images from showing when participants are being processed. Fixes [Issue 24](https://git.research.dezeeuw.ca/tyler/flares/issues/24)
|
||||||
|
- Allow the option to remove all events of a type from all loaded snirfs. Fixes [Issue 25](https://git.research.dezeeuw.ca/tyler/flares/issues/25)
|
||||||
|
- Added new icons in the menu bar
|
||||||
|
- Added a terminal to interact with the app in a more command-like form
|
||||||
|
- Currently the terminal has no functionality but some features for batch operations will be coming soon!
|
||||||
|
- Inter-Group viewer now has the option to visualize the average response on the brain of all participants in the group. Fixes [Issue 26](https://git.research.dezeeuw.ca/tyler/flares/issues/24)
|
||||||
|
|
||||||
|
|
||||||
|
# Version 1.1.2
|
||||||
|
|
||||||
|
- Fixed incorrect colormaps being applied
|
||||||
|
- Added functionality to utilize external event markers from a file. Fixes [Issue 6](https://git.research.dezeeuw.ca/tyler/flares/issues/6)
|
||||||
|
|
||||||
|
|
||||||
# Version 1.1.1
|
# Version 1.1.1
|
||||||
|
|
||||||
- Fixed the number of rectangles in the progress bar to 19
|
- Fixed the number of rectangles in the progress bar to 19
|
||||||
|
|||||||
41
flares.py
41
flares.py
@@ -50,12 +50,12 @@ from scipy.spatial.distance import cdist
|
|||||||
|
|
||||||
# Backen visualization needed to be defined for pyinstaller
|
# Backen visualization needed to be defined for pyinstaller
|
||||||
import pyvistaqt # type: ignore
|
import pyvistaqt # type: ignore
|
||||||
import vtkmodules.util.data_model
|
# import vtkmodules.util.data_model
|
||||||
import vtkmodules.util.execution_model
|
# import vtkmodules.util.execution_model
|
||||||
|
|
||||||
# External library imports for mne
|
# External library imports for mne
|
||||||
from mne import (
|
from mne import (
|
||||||
EvokedArray, SourceEstimate, Info, Epochs, Label,
|
EvokedArray, SourceEstimate, Info, Epochs, Label, Annotations,
|
||||||
events_from_annotations, read_source_spaces,
|
events_from_annotations, read_source_spaces,
|
||||||
stc_near_sensors, pick_types, grand_average, get_config, set_config, read_labels_from_annot
|
stc_near_sensors, pick_types, grand_average, get_config, set_config, read_labels_from_annot
|
||||||
) # type: ignore
|
) # type: ignore
|
||||||
@@ -132,6 +132,8 @@ ENHANCE_NEGATIVE_CORRELATION: bool
|
|||||||
|
|
||||||
SHORT_CHANNEL: bool
|
SHORT_CHANNEL: bool
|
||||||
|
|
||||||
|
REMOVE_EVENTS: list
|
||||||
|
|
||||||
VERBOSITY = True
|
VERBOSITY = True
|
||||||
|
|
||||||
# FIXME: Shouldn't need each ordering - just order it before checking
|
# FIXME: Shouldn't need each ordering - just order it before checking
|
||||||
@@ -179,6 +181,7 @@ REQUIRED_KEYS: dict[str, Any] = {
|
|||||||
"PSP_THRESHOLD": float,
|
"PSP_THRESHOLD": float,
|
||||||
|
|
||||||
"SHORT_CHANNEL": bool,
|
"SHORT_CHANNEL": bool,
|
||||||
|
"REMOVE_EVENTS": list,
|
||||||
# "REJECT_PAIRS": bool,
|
# "REJECT_PAIRS": bool,
|
||||||
# "FORCE_DROP_ANNOTATIONS": list,
|
# "FORCE_DROP_ANNOTATIONS": list,
|
||||||
# "FILTER_LOW_PASS": float,
|
# "FILTER_LOW_PASS": float,
|
||||||
@@ -1074,7 +1077,7 @@ def epochs_calculations(raw_haemo, events, event_dict):
|
|||||||
|
|
||||||
# Plot drop log
|
# Plot drop log
|
||||||
# TODO: Why show this if we never use epochs2?
|
# TODO: Why show this if we never use epochs2?
|
||||||
fig_epochs_dropped = epochs2.plot_drop_log()
|
fig_epochs_dropped = epochs2.plot_drop_log(show=False)
|
||||||
fig_epochs.append(("fig_epochs_dropped", fig_epochs_dropped))
|
fig_epochs.append(("fig_epochs_dropped", fig_epochs_dropped))
|
||||||
|
|
||||||
# Plot for each condition
|
# Plot for each condition
|
||||||
@@ -1108,7 +1111,7 @@ def epochs_calculations(raw_haemo, events, event_dict):
|
|||||||
evokeds3 = []
|
evokeds3 = []
|
||||||
colors = []
|
colors = []
|
||||||
conditions = list(epochs.event_id.keys())
|
conditions = list(epochs.event_id.keys())
|
||||||
cmap = plt.cm.get_cmap("tab10", len(conditions))
|
cmap = plt.get_cmap("tab10", len(conditions))
|
||||||
|
|
||||||
for idx, cond in enumerate(conditions):
|
for idx, cond in enumerate(conditions):
|
||||||
evoked = epochs[cond].average(picks="hbo")
|
evoked = epochs[cond].average(picks="hbo")
|
||||||
@@ -1470,9 +1473,15 @@ def resource_path(relative_path):
|
|||||||
|
|
||||||
def fold_channels(raw: BaseRaw) -> None:
|
def fold_channels(raw: BaseRaw) -> None:
|
||||||
|
|
||||||
|
# if getattr(sys, 'frozen', False):
|
||||||
|
path = os.path.expanduser("~") + "/mne_data/fOLD/fOLD-public-master/Supplementary"
|
||||||
|
logger.info(path)
|
||||||
|
set_config('MNE_NIRS_FOLD_PATH', resource_path(path)) # type: ignore
|
||||||
|
|
||||||
# Locate the fOLD excel files
|
# # Locate the fOLD excel files
|
||||||
set_config('MNE_NIRS_FOLD_PATH', resource_path("../../mne_data/fOLD/fOLD-public-master/Supplementary")) # type: ignore
|
# else:
|
||||||
|
# logger.info("yabba")
|
||||||
|
# set_config('MNE_NIRS_FOLD_PATH', resource_path("../../mne_data/fOLD/fOLD-public-master/Supplementary")) # type: ignore
|
||||||
|
|
||||||
output = None
|
output = None
|
||||||
|
|
||||||
@@ -1534,8 +1543,8 @@ def fold_channels(raw: BaseRaw) -> None:
|
|||||||
"Brain_Outside",
|
"Brain_Outside",
|
||||||
]
|
]
|
||||||
|
|
||||||
cmap1 = plt.cm.get_cmap('tab20') # First 20 colors
|
cmap1 = plt.get_cmap('tab20') # First 20 colors
|
||||||
cmap2 = plt.cm.get_cmap('tab20b') # Next 20 colors
|
cmap2 = plt.get_cmap('tab20b') # Next 20 colors
|
||||||
|
|
||||||
# Combine the colors from both colormaps
|
# Combine the colors from both colormaps
|
||||||
colors = [cmap1(i) for i in range(20)] + [cmap2(i) for i in range(20)] # Total 40 colors
|
colors = [cmap1(i) for i in range(20)] + [cmap2(i) for i in range(20)] # Total 40 colors
|
||||||
@@ -1611,6 +1620,7 @@ def fold_channels(raw: BaseRaw) -> None:
|
|||||||
for ax in axes[len(hbo_channel_names):]:
|
for ax in axes[len(hbo_channel_names):]:
|
||||||
ax.axis('off')
|
ax.axis('off')
|
||||||
|
|
||||||
|
plt.show()
|
||||||
return fig, legend_fig
|
return fig, legend_fig
|
||||||
|
|
||||||
|
|
||||||
@@ -2935,6 +2945,19 @@ def process_participant(file_path, progress_callback=None):
|
|||||||
logger.info("14")
|
logger.info("14")
|
||||||
|
|
||||||
# Step 14: Design Matrix
|
# Step 14: Design Matrix
|
||||||
|
events_to_remove = REMOVE_EVENTS
|
||||||
|
|
||||||
|
filtered_annotations = [ann for ann in raw.annotations if ann['description'] not in events_to_remove]
|
||||||
|
|
||||||
|
new_annot = Annotations(
|
||||||
|
onset=[ann['onset'] for ann in filtered_annotations],
|
||||||
|
duration=[ann['duration'] for ann in filtered_annotations],
|
||||||
|
description=[ann['description'] for ann in filtered_annotations]
|
||||||
|
)
|
||||||
|
|
||||||
|
# Set the new annotations
|
||||||
|
raw_haemo.set_annotations(new_annot)
|
||||||
|
|
||||||
design_matrix, fig_design_matrix = make_design_matrix(raw_haemo, short_chans)
|
design_matrix, fig_design_matrix = make_design_matrix(raw_haemo, short_chans)
|
||||||
fig_individual["Design Matrix"] = fig_design_matrix
|
fig_individual["Design Matrix"] = fig_design_matrix
|
||||||
if progress_callback: progress_callback(15)
|
if progress_callback: progress_callback(15)
|
||||||
|
|||||||
1
icons/terminal_24dp_1F1F1F.svg
Normal file
1
icons/terminal_24dp_1F1F1F.svg
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#1f1f1f"><path d="M160-160q-33 0-56.5-23.5T80-240v-480q0-33 23.5-56.5T160-800h640q33 0 56.5 23.5T880-720v480q0 33-23.5 56.5T800-160H160Zm0-80h640v-400H160v400Zm140-40-56-56 103-104-104-104 57-56 160 160-160 160Zm180 0v-80h240v80H480Z"/></svg>
|
||||||
|
After Width: | Height: | Size: 340 B |
1
icons/upgrade_24dp_1F1F1F.svg
Normal file
1
icons/upgrade_24dp_1F1F1F.svg
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#1f1f1f"><path d="M280-160v-80h400v80H280Zm160-160v-327L336-544l-56-56 200-200 200 200-56 56-104-103v327h-80Z"/></svg>
|
||||||
|
After Width: | Height: | Size: 216 B |
Reference in New Issue
Block a user