Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5361f6ea21 | |||
| ee023c26c1 | |||
| 06c9ff0ecf | |||
| 542dd85a78 | |||
| 3e0f70ea49 | |||
| d6c71e0ab2 | |||
| 87073fb218 | |||
| 3d0fbd5c5e | |||
| 3f38f5a978 |
31
changelog.md
31
changelog.md
@@ -1,3 +1,34 @@
|
||||
# Version 1.1.4
|
||||
|
||||
- Fixed some display text to now display the correct information
|
||||
- A new option under Analysis has been added to export the data from a specified participant as a csv file. Fixes [Issue 19](https://git.research.dezeeuw.ca/tyler/flares/issues/19), [Issue 27](https://git.research.dezeeuw.ca/tyler/flares/issues/27)
|
||||
- Added 2 new parameters - TIME_WINDOW_START and TIME_WINDOW_END. Fixes [Issue 29](https://git.research.dezeeuw.ca/tyler/flares/issues/29)
|
||||
- These parameters affect the visualization of the significance and contrast images but do not change the total time modeled underneath
|
||||
- Fixed the duration of annotations edited from a BORIS file from 0 seconds to their proper duration
|
||||
- Added the annotation information to each participant under their "File information" window
|
||||
- Fixed Macs not being able to save snirfs attempting to be updated from BORIS files, and in general the updated files not respecting the path chosen by the user
|
||||
|
||||
|
||||
# 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)
|
||||
- Fixed the description under "Update events in snirf file..."
|
||||
|
||||
|
||||
# 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
|
||||
|
||||
- Fixed the number of rectangles in the progress bar to 19
|
||||
|
||||
52
flares.py
52
flares.py
@@ -50,12 +50,12 @@ from scipy.spatial.distance import cdist
|
||||
|
||||
# Backen visualization needed to be defined for pyinstaller
|
||||
import pyvistaqt # type: ignore
|
||||
import vtkmodules.util.data_model
|
||||
import vtkmodules.util.execution_model
|
||||
# import vtkmodules.util.data_model
|
||||
# import vtkmodules.util.execution_model
|
||||
|
||||
# External library imports for mne
|
||||
from mne import (
|
||||
EvokedArray, SourceEstimate, Info, Epochs, Label,
|
||||
EvokedArray, SourceEstimate, Info, Epochs, Label, Annotations,
|
||||
events_from_annotations, read_source_spaces,
|
||||
stc_near_sensors, pick_types, grand_average, get_config, set_config, read_labels_from_annot
|
||||
) # type: ignore
|
||||
@@ -132,6 +132,11 @@ ENHANCE_NEGATIVE_CORRELATION: bool
|
||||
|
||||
SHORT_CHANNEL: bool
|
||||
|
||||
REMOVE_EVENTS: list
|
||||
|
||||
TIME_WINDOW_START: int
|
||||
TIME_WINDOW_END: int
|
||||
|
||||
VERBOSITY = True
|
||||
|
||||
# FIXME: Shouldn't need each ordering - just order it before checking
|
||||
@@ -179,6 +184,9 @@ REQUIRED_KEYS: dict[str, Any] = {
|
||||
"PSP_THRESHOLD": float,
|
||||
|
||||
"SHORT_CHANNEL": bool,
|
||||
"REMOVE_EVENTS": list,
|
||||
"TIME_WINDOW_START": int,
|
||||
"TIME_WINDOW_END": int
|
||||
# "REJECT_PAIRS": bool,
|
||||
# "FORCE_DROP_ANNOTATIONS": list,
|
||||
# "FILTER_LOW_PASS": float,
|
||||
@@ -1074,7 +1082,7 @@ def epochs_calculations(raw_haemo, events, event_dict):
|
||||
|
||||
# Plot drop log
|
||||
# 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))
|
||||
|
||||
# Plot for each condition
|
||||
@@ -1108,7 +1116,7 @@ def epochs_calculations(raw_haemo, events, event_dict):
|
||||
evokeds3 = []
|
||||
colors = []
|
||||
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):
|
||||
evoked = epochs[cond].average(picks="hbo")
|
||||
@@ -1470,9 +1478,15 @@ def resource_path(relative_path):
|
||||
|
||||
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
|
||||
set_config('MNE_NIRS_FOLD_PATH', resource_path("../../mne_data/fOLD/fOLD-public-master/Supplementary")) # type: ignore
|
||||
# # Locate the fOLD excel files
|
||||
# else:
|
||||
# logger.info("yabba")
|
||||
# set_config('MNE_NIRS_FOLD_PATH', resource_path("../../mne_data/fOLD/fOLD-public-master/Supplementary")) # type: ignore
|
||||
|
||||
output = None
|
||||
|
||||
@@ -1534,8 +1548,8 @@ def fold_channels(raw: BaseRaw) -> None:
|
||||
"Brain_Outside",
|
||||
]
|
||||
|
||||
cmap1 = plt.cm.get_cmap('tab20') # First 20 colors
|
||||
cmap2 = plt.cm.get_cmap('tab20b') # Next 20 colors
|
||||
cmap1 = plt.get_cmap('tab20') # First 20 colors
|
||||
cmap2 = plt.get_cmap('tab20b') # Next 20 colors
|
||||
|
||||
# Combine the colors from both colormaps
|
||||
colors = [cmap1(i) for i in range(20)] + [cmap2(i) for i in range(20)] # Total 40 colors
|
||||
@@ -1611,6 +1625,7 @@ def fold_channels(raw: BaseRaw) -> None:
|
||||
for ax in axes[len(hbo_channel_names):]:
|
||||
ax.axis('off')
|
||||
|
||||
plt.show()
|
||||
return fig, legend_fig
|
||||
|
||||
|
||||
@@ -2935,6 +2950,19 @@ def process_participant(file_path, progress_callback=None):
|
||||
logger.info("14")
|
||||
|
||||
# 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)
|
||||
fig_individual["Design Matrix"] = fig_design_matrix
|
||||
if progress_callback: progress_callback(15)
|
||||
@@ -3008,7 +3036,11 @@ def process_participant(file_path, progress_callback=None):
|
||||
contrast_dict = {}
|
||||
|
||||
for condition in all_conditions:
|
||||
delay_cols = [col for col in all_delay_cols if col.startswith(f"{condition}_delay_")]
|
||||
delay_cols = [
|
||||
col for col in all_delay_cols
|
||||
if col.startswith(f"{condition}_delay_") and
|
||||
TIME_WINDOW_START <= int(col.split("_delay_")[-1]) <= TIME_WINDOW_END
|
||||
]
|
||||
|
||||
if not delay_cols:
|
||||
continue # skip if no columns found (shouldn't happen?)
|
||||
|
||||
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