Skip to content

Commit e311a72

Browse files
authored
Merge pull request #104 from eurunuela/feat/use-non-zscore-ica-maps
[FIX] Use non-z-scored ICA component maps
2 parents a475416 + b6b0be1 commit e311a72

3 files changed

Lines changed: 16 additions & 10 deletions

File tree

features.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@
288288
"category": "visualization",
289289
"description": "Display interactive brain stat map mosaic using Niivue for selected ICA component",
290290
"steps": [
291-
"Load a tedana folder containing *stat-z_components.nii.gz",
291+
"Load a tedana folder containing *_components.nii.gz",
292292
"Navigate to the 'ICA' tab",
293293
"Verify brain viewer displays 3 rows of slices (axial, sagittal, coronal) with 7 slices per row",
294294
"Verify warm/cool diverging colormap is applied (warm for positive, cool for negative)",

scripts/rica_server.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
RICA_FILE_PATTERNS = [
2727
"_metrics.tsv",
2828
"_mixing.tsv",
29-
"stat-z_components.nii.gz",
29+
"_components.nii.gz",
3030
"_mask.nii",
3131
"report.txt",
3232
"comp_",
@@ -87,7 +87,9 @@ def send_file_list(self):
8787
for f in cwd.rglob("*"):
8888
if f.is_file():
8989
# Check if file matches any Rica pattern
90-
if any(pattern in f.name for pattern in RICA_FILE_PATTERNS):
90+
if any(pattern in f.name for pattern in RICA_FILE_PATTERNS) and not (
91+
"_components.nii.gz" in f.name and "stat-z" in f.name
92+
):
9193
# Store relative path with forward slashes
9294
rel_path = str(f.relative_to(cwd)).replace("\\", "/")
9395
files.append(rel_path)
@@ -137,7 +139,11 @@ def main():
137139
cwd = Path.cwd()
138140
rica_files = []
139141
for f in cwd.rglob("*"):
140-
if f.is_file() and any(p in f.name for p in RICA_FILE_PATTERNS):
142+
if (
143+
f.is_file()
144+
and any(p in f.name for p in RICA_FILE_PATTERNS)
145+
and not ("_components.nii.gz" in f.name and "stat-z" in f.name)
146+
):
141147
rica_files.append(f.name)
142148

143149
if not rica_files:

src/PopUps/IntroPopUp.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ function IntroPopup({ onDataLoad, onLoadingStart, closePopup, isLoading, isDark
143143
(f.includes("_metrics.tsv") && !f.toLowerCase().includes("pca")) ||
144144
(f.startsWith("tedana_20") && f.endsWith(".tsv")) ||
145145
(f.includes("_mixing.tsv") && !f.toLowerCase().includes("pca") && !f.toLowerCase().includes("orth")) ||
146-
(f.includes("stat-z_components.nii.gz") && f.toLowerCase().includes("ica")) ||
146+
(f.includes("_components.nii.gz") && f.toLowerCase().includes("ica") && !f.includes("stat-z")) ||
147147
f === "betas_OC.nii.gz" ||
148148
f.includes("_mask.nii") ||
149149
f.includes("CrossComponent_metrics.json") ||
@@ -261,8 +261,8 @@ function IntroPopup({ onDataLoad, onLoadingStart, closePopup, isLoading, isDark
261261
setLoadingProgress((prev) => ({ ...prev, current: prev.current + 1 }));
262262
}
263263

264-
// ICA stat-z components NIfTI
265-
if ((filename.includes("stat-z_components.nii.gz") && filename.toLowerCase().includes("ica")) || filename === "betas_OC.nii.gz") {
264+
// ICA components NIfTI
265+
if ((filename.includes("_components.nii.gz") && filename.toLowerCase().includes("ica") && !filename.includes("stat-z")) || filename === "betas_OC.nii.gz") {
266266
const response = await fetch(`/${filepath}`);
267267
niftiBuffer = await response.arrayBuffer();
268268
setLoadingProgress((prev) => ({ ...prev, current: prev.current + 1 }));
@@ -408,7 +408,7 @@ function IntroPopup({ onDataLoad, onLoadingStart, closePopup, isLoading, isDark
408408
(f.name.startsWith("tedana_20") && f.name.endsWith(".tsv")) ||
409409
// New files for Niivue integration
410410
(f.name.includes("_mixing.tsv") && !f.name.toLowerCase().includes("pca") && !f.name.toLowerCase().includes("orth")) ||
411-
(f.name.includes("stat-z_components.nii.gz") && f.name.toLowerCase().includes("ica")) ||
411+
(f.name.includes("_components.nii.gz") && f.name.toLowerCase().includes("ica") && !f.name.includes("stat-z")) ||
412412
f.name === "betas_OC.nii.gz" ||
413413
f.name.includes("_mask.nii") ||
414414
f.name.includes("CrossComponent_metrics.json") ||
@@ -519,8 +519,8 @@ function IntroPopup({ onDataLoad, onLoadingStart, closePopup, isLoading, isDark
519519
setLoadingProgress((prev) => ({ ...prev, current: prev.current + 1 }));
520520
}
521521

522-
// ICA stat-z components NIfTI (4D brain maps for Niivue)
523-
if ((filename.includes("stat-z_components.nii.gz") && filename.toLowerCase().includes("ica")) || filename === "betas_OC.nii.gz") {
522+
// ICA components NIfTI (4D brain maps for Niivue)
523+
if ((filename.includes("_components.nii.gz") && filename.toLowerCase().includes("ica") && !filename.includes("stat-z")) || filename === "betas_OC.nii.gz") {
524524
niftiBuffer = await readFileAsArrayBuffer(file);
525525
setLoadingProgress((prev) => ({ ...prev, current: prev.current + 1 }));
526526
}

0 commit comments

Comments
 (0)