Analysis of acute stroke-like lesions in MELAS: Distribution, potential boundaries and spreading pattern.
Paper
Loaded from Europe PMC by your browser, not stored by OSCR: doi.org · Europe PMC
The paper is loaded when this pane is shown.
The authors' code
Python · 335 lines · 9.8 KB · BSD-3-Clause
- import numpy as np
- from numpy.linalg import eig
- from numpy.linalg import norm
- from scipy.optimize import minimize_scalar
- import matplotlib.pyplot as plt
- import seaborn as sns
- def whiten(X, use_np=True):
- """Utility function to whiten data without zero-mean centering. Whitening means removing correlation between
- features and making the individual features have unit variance.
- :param
- X : np.array
- Data matrix. This is assumed to be in the (uncommon) format n_features x n_samples
- use_np : bool, optional (default: `True`)
- Whether to use numpy to compute the covariance matrix
- :returns
- Z : np.array
- Data matrix, whitened to remove covariance between the features
- """
- if use_np:
- C_X = np.cov(X, rowvar=True)
- else:
- C_X = (X - X.mean(1)) @ (X - X.mean(1)).T
- D, E = eig(C_X)
- V = E @ np.diag(1 / np.sqrt(D)) @ E.T
- Z = V @ X
- return Z
- def rotation(phi):
- """Create 2D rotation matrix
- :param
- phi : float
- The angle by which we want to rotate.
- :returns
- A : np.array
- A 2D rotation matrix
- """
- return np.array([[np.cos(phi), np.sin(phi)],
- [-np.sin(phi), np.cos(phi)]])
- def loss(Y):
- """Compute the loss for a given reconstruction Y.
- This will simply be the sum of squared elements in the restriction
- of Y to it's negative elements
- :param
- Y : np.array
- Data matrix, reconstrcution of the sources
- :returns
- l : np.float
- The loss
- """
- # restrict Y to it's negative elements
- n_samples = Y.shape[1]
- Y_neg = np.where(Y < 0, Y, 0)
- return 1 / (2 * n_samples) * norm(Y_neg, ord='fro') ** 2
- def obj_fun(phi, Z):
- """Objective to be used for finding the optimum rotation angle
- :param
- phi : float
- Rotation angle for which we wish to compute the los
- Z : np.matrix
- Whitened data matrix. Must have two rows, each corresponding to one feature.
- :returns
- l : float
- loss corresponding to a rotation of Z in 2D around phi
- """
- # check input
- if Z.shape[0] != 2:
- raise ValueError('Z has more than two features.')
- # rotate the data
- W = rotation(phi)
- Y = W @ Z
- return loss(Y)
- def givens(n, i, j, phi):
- """Compute n-dimensional givens rotation
- :param
- n : int
- Dimension of the rotation matrix to be computed
- i, j : int
- Dimensions i and j define the surface we wish to rotate in
- phi : float
- Rotation angle
- :returns
- R : np.array
- Given's rotation
- """
- R = np.eye(n)
- R[i, i], R[j, j] = np.cos(phi), np.cos(phi)
- R[i, j], R[j, i] = np.sin(phi), -np.sin(phi)
- return R
- def torque(Y):
- """Compute torque values of Y.
- These correspond to the gradient if different directions, where
- each direction is a possible rotation in a surface defines by two axis. The resulting matrix of
- torque values will have zeroes on the diagonal and will by symmetric.
- :param
- Y : np.matrix
- Reconstruction of the sourdes
- :returns
- t_max : float
- Maximum torque value found
- ixs : tuple
- i-j coordinates corresponding to the max. This defines a hyperplane in n-dimensional space.
- G : np.array
- Matrix of torque values. Symmetric and zero on the diagonal. Only the upper half is computed.
- """
- # compute the rectified parts of Y
- Y_pos = np.where(Y > 0, Y, 0)
- Y_neg = np.where(Y < 0, Y, 0)
- # compute torque values
- n = Y.shape[0]
- G = np.zeros((n, n))
- for i in range(n):
- for j in range(i + 1, n):
- G[i, j] = np.dot(Y_pos[i, :], Y_neg[j, :]) - np.dot(Y_neg[i, :], Y_pos[j, :])
- # find max and corresponding indices
- t_max = np.amax(np.abs(G))
- result = np.where(np.abs(G) == t_max)
- ixs = [result[i][0] for i in range(len(result))]
- return t_max, ixs, G
- def run_nn_ica(X, t_tol=1e-1, t_neg=None, verbose=1, i_max=1e3, print_all=100,
- whiten_mat=True, keep='last', return_all=False):
- """Algorithm to run non-negative indipendent component analysis.
- Given some data X, find matrices A and S such that
- X = A S,
- where S is non-negative and has indipendent rows. We pose no
- constraint on the matrix A.
- This algorithm is implemented as described in Plumbley, 2003, and
- relies upon whitening and rotating the data. This is guaranteed to
- converge only if the sources are 'well grounded', i.e. have probability
- down to zero. Note that this is the implementation for a square mixing
- matrix A.
- Parameters
- --------
- X : np.array,
- The data matrix of shape (n_features, n_samples)
- t_tol : float, optional (default: `1e-1`)
- Stopping tolerance. If the maximum torque falls below this
- value, stop.
- t_neg: float, optional (default: `None`)
- Stopping number of negative elements. If #negative elements crosses
- this threshold, stop.
- verbose : int, optional (default: `1`)
- How much output to give
- i_max : int, optional (default: `1e3`)
- Maximum number of iterations
- print_all : int, optional (default: `100`)
- Print every print_all iterations
- whiten : bool, optional (default: `True`)
- whether to whiten the input matrix
- keep: Str, optional (default: `'last'`)
- which reconstruction to keep, possible options are:
- `'last'`, `'best_neg'`, `'best_tol'`
- and correspond to last, smallest #negative elements and smallest tolerance
- respectively
- return_all: bool, optional (default: `False`)
- whether to return all of the progress of Y, W
- returns Y_best, W_best, Z, t_max_arr, ys, ws
- Returns
- --------
- Y : np.array
- The reconstructed sources, up to scaling and permutation
- W : np.array
- The final rotation matrix
- Z : np.array
- The whitened data
- t_max_arr : np.array
- The maximum torque values for each iteration
- """
- assert keep in ('last', 'best_neg', 'best_tol'), f'Unknown selection criterion `{keep}`.'
- def set_best(Y, W, tol):
- nonlocal Y_best, W_best, tol_best
- if return_all:
- ys.append(Y)
- ws.append(W)
- if keep == 'last':
- is_better = True
- if keep == 'best_neg':
- is_better = Y_best is None or np.sum(Y_best < 0) > np.sum(Y < 0)
- else:
- is_better = tol_best > tol
- if is_better:
- Y_best, W_best = Y, W
- tol_best = tol # need to keep memory of this
- # lists that records the progress of Y and W
- ys = []
- ws = []
- # best values and tolerance so far
- Y_best, W_best = None, None
- tol_best = np.inf
- t_neg = -np.inf if t_neg is None else t_neg
- # initialise
- n = X.shape[0]
- W = np.eye(n)
- t_max_arr = []
- # whiten the data
- Z = whiten(X) if whiten_mat else X
- Y = W @ Z
- i = 0
- while True:
- # compute the max torque of Y and corresponding indices
- t_max, ixs, _ = torque(Y)
- t_max_arr.append(t_max)
- set_best(Y, W, t_max)
- if t_max < t_tol or np.sum(Y_best < 0) < t_neg: # converged
- print('=' * 10)
- print('i = {}, t_max = {:.2f}, ixs = {}, #negative = {}'.format(i, t_max, ixs, np.sum(Y_best < 0)))
- print('Converged. Returning the reconstruction.')
- if return_all:
- return Y_best, W_best, Z, t_max_arr, ys, ws
- return Y_best, W_best, Z, t_max_arr
- if i > i_max and t_max > t_max_arr[-2]: # failed to converge
- print('=' * 10)
- print('i = {}, t_max = {:.2f}, ixs = {}, #negative = {}'.format(i, t_max, ixs, np.sum(Y_best < 0)))
- print(f'Error: Failed to converge. Returning current matrices.')
- if return_all:
- return Y_best, W_best, Z, t_max_arr, ys, ws
- return Y_best, W_best, Z, t_max_arr
- # print some information
- if (verbose > 0) and (i % print_all == 0):
- print('i = {}, t_max = {:.2f}, ixs = {}, #negative = {}'.format(i, t_max, ixs, np.sum(Y < 0)))
- # reduce to axis pair, find rotation angle and construct givens matrix
- Y_red = Y[ixs, :]
- opt_res = minimize_scalar(fun=obj_fun, bounds=(0, 2 * np.pi), method='bounded', args=Y_red)
- R = givens(n, ixs[0], ixs[1], opt_res['x'])
- # update the rotation matrix W and the reconstruction matrix Y
- W = R @ W
- Y = R @ Y
- i += 1
- def plot_ica_reconstruction(data, labels=None, *args, **kwargs):
- """Plotting function for ICA reconstruction
- Parameters
- --------
- data: List[np.ndarray]
- Matrices to be plotted.
- titles: Union[List, Str, NoneType], optional (default: `None`)
- Corresponding titles, if present
- *args, **kwargs:
- additional arguments for `sns.distplot`
- Returns
- --------
- None
- """
- plt.close('all')
- n_sources, n_mat = data[0].shape[0], len(data)
- for i, d in enumerate(data):
- assert d.shape[0] == n_sources, f'Wrong number of features for `data[{i}].shape[0]` == `{d.shape[0]}` != `{n_sources}`.'
- if labels is not None and len(labels) != n_mat:
- print(f'Inconsistent number of titles given `{len(labels)}` != `{n_mat}`, showing no labels.')
- labels = None
- fig, axes = plt.subplots(nrows=n_sources, ncols=n_mat, figsize=(4 * n_mat, 4 * n_sources))
- if not isinstance(axes, np.ndarray):
- axes = np.array([[axes]])
- elif axes.ndim != 2:
- # treat only 1 source specifically
- axes = np.expand_dims(axes, axis=(n_sources) != 1)
- for i, row in enumerate(axes):
- for j, (A, ax) in enumerate(zip(data, row)):
- sns.distplot(A[i, :], *args, ax=ax, kde=False,
- axlabel='{}_{}'.format(labels[j], i) if labels is not None else None,
- **kwargs)
- fig.suptitle("Non-negative ICA")
- fig.tight_layout(rect=[0, 0, 1, 0.97])
- fig.show()
main.py at commit 27c801b, under BSD-3-Clause · at the source
Overview
- Department of Neurology, Peking University First Hospital, 8 Xishiku Street, Xicheng District, Beijing, 100034, China
- Beijing Key Laboratory of Neurovascular Disease Discovery, Peking University First Hospital, 8 Xishiku Street, Xicheng District, Beijing, 100034, China
- Department of Radiology, Peking University First Hospital, 8 Xishiku Street, Xicheng District, Beijing, 100034, China
Abstract
The abstract is not reproduced here: the paper's license (CC BY-NC-ND) does not allow it. Read it in the paper, at the publisher or on Europe PMC.
Repositories
Its files are read in the Code ↔ Paper reader above.
Marius1311/Non-negative-ICA
27c801b5b73c7fb954fd0a5fbaa41fe6da424d96, 6 December 2019Availability: 1 check, the latest on 27 September 2026: the link answers
- 27 September 2026: the link answers
4 files
- nn_ica/
main.py , Python, 335 lines - notebooks/
nn_ica_examples.ipynb , Jupyter, 212 lines - LICENSE, License, 29 lines
- README.md, Text, 5 lines
DlutMedimgGroup/Chinese-Brain-PET-Template
a65f5379cd121d577c51326d9434c329b0491650, 28 November 2021Availability: 1 check, the latest on 27 September 2026: the link answers
- 27 September 2026: the link answers
11 files
- Matlab Scripts/
Organize_File.m , MATLAB, 6 lines - Matlab Scripts/
Reset_Origin.m , MATLAB, 13 lines - Matlab Scripts/
SPMt_Compute.m , MATLAB, 13 lines - Matlab Scripts/
SPMt_Inference.m , MATLAB, 17 lines - Matlab Scripts/
SPMt_Specify.m , MATLAB, 30 lines - Matlab Scripts/
Spatial_Normalization.m , MATLAB, 40 lines - Matlab Scripts/
aver_in_percentile_range , MATLAB, 10 lines.m - Matlab Scripts/
main.m , MATLAB, 39 lines - Matlab Scripts/
normalize2mean.m , MATLAB, 40 lines - LICENSE, License, 21 lines
- README.md, Text, 91 lines
Tracing map
Proposed by the machine: these links were found in the paper and verified at the source, without human review. The map will receive a Zenodo DOI once one of the paper's authors has validated it with their ORCID.
What the map holds:
- 2 repositories of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
- 11 scripts, each with its path and the digest of its content;
- no match between paragraphs and code yet;
- neither the text of the paper nor the code itself.
Its JSON (tracing-map.json) is deposited on Zenodo with its DOI once the map is validated.
Data
No dataset and no data link were found in the paper.
Availability statements
The paper has a data availability statement and a data availability statement. Its license (CC BY-NC-ND) does not allow reproducing them here; in short, from what the harvester recognized in them:
- they say that the data are available on request
Read them in the paper: doi.org/10.1016/j.ynirp.2026.100365.
Versions
The history of this record: each version stored by the harvester or made by a correction of its authors or of the maintainers of its code, and what changed in its facts. The texts of the paper (its abstract, its availability statements) are not part of it; versions that changed only those are not listed.
Version 2, 28 September 2026
- Authors: added Huada Tang (0009-0002-5900-4551); Junyu Liu (0009-0006-8960-6325); Fangda Leng (0000-0002-1691-3811); removed Huada Tang; Junyu Liu; Fangda Leng
Version 1, 27 September 2026: the first record
Recorded: type, language, journal, volume, issue, pages, dates, 8 authors, 5 keywords, 1 funder, 31 references.
Cite
This paper
Tang, H., Liu, J., Cai, X., Leng, F., Hu, J., Zhao, Y., Wang, Z., & Yu, L. (2026). Analysis of acute stroke-like lesions in MELAS: Distribution, potential boundaries and spreading pattern. Neuroimage. Reports, 6(3), 100365. https://
BibTeX
@article{tang2026analysi
author = {Tang, Huada and Liu, Junyu and Cai, Xiying and Leng, Fangda and Hu, Jiaqi and Zhao, Yang and Wang, Zhaoxia and Yu, Lei},
title = {{Analysis of acute stroke-like lesions in MELAS: Distribution, potential boundaries and spreading pattern}},
journal = {Neuroimage. Reports},
year = {2026},
month = jun,
volume = {6},
number = {3},
pages = {100365},
publisher = {Elsevier},
issn = {2666-9560},
doi = {10.1016/
url = {https://
pmid = {42389051},
pmcid = {PMC13320026}
}
RIS
TY - JOUR
AU - Tang, Huada
AU - Liu, Junyu
AU - Cai, Xiying
AU - Leng, Fangda
AU - Hu, Jiaqi
AU - Zhao, Yang
AU - Wang, Zhaoxia
AU - Yu, Lei
TI - Analysis of acute stroke-like lesions in MELAS: Distribution, potential boundaries and spreading pattern
T2 - Neuroimage. Reports
J2 - Neuroimage Rep
PY - 2026
DA - 2026/
VL - 6
IS - 3
SP - 100365
SN - 2666-9560
PB - Elsevier
DO - 10.1016/
UR - https://
LA - en
ER -
CSL-JSON
{
"id": "10.1016/
"type": "article-journal",
"title": "Analysis of acute stroke-like lesions in MELAS: Distribution, potential boundaries and spreading pattern",
"container-title": "Neuroimage. Reports",
"author": [
{
"family": "Tang",
"given": "Huada"
},
{
"family": "Liu",
"given": "Junyu"
},
{
"family": "Cai",
"given": "Xiying"
},
{
"family": "Leng",
"given": "Fangda"
},
{
"family": "Hu",
"given": "Jiaqi"
},
{
"family": "Zhao",
"given": "Yang"
},
{
"family": "Wang",
"given": "Zhaoxia"
},
{
"family": "Yu",
"given": "Lei"
}
],
"container-title-short":
"volume": "6",
"issue": "3",
"page": "100365",
"DOI": "10.1016/
"PMID": "42389051",
"PMCID": "PMC13320026",
"ISSN": "2666-9560",
"publisher": "Elsevier",
"URL": "https://
"language": "en",
"issued": {
"date-parts": [
[
2026,
6,
24
]
]
}
}
The tracing map gets a citation of its own once an author has validated it and it has a DOI.
Similar papers
The papers with a page that share the most with this one: the tools found in their code, their categories, datasets, cited references and authors, the rarest counting most.
- [1] doi:10.1038/s41586-026-10631-3 [code]
- A prognostic human brain network for diffuse midline glioma.Journal: NatureIn common: Tools for NIfTI and ANALYZE image (MATLAB), SPM, seaborn, 3 other tools, clinical / translational, 1 reference
- [2] doi:10.1002/hbm.70602 [code]
- Neuroimaging Correlates of Post-Stroke Pain After Ischemic Stroke: Secondary Analysis of the INSPiRE-TMS Trial.Journal: Human brain mappingIn common: Tools for NIfTI and ANALYZE image (MATLAB), SPM, seaborn, 3 other tools, stroke, clinical / translational
- [3] doi:10.1111/ene.70678 [code]
- Who Falls After a Stroke? Evidence From a Prospective Stroke Cohort.Journal: European journal of neurologyIn common: Tools for NIfTI and ANALYZE image (MATLAB), SPM, seaborn, 3 other tools, stroke, clinical / translational
- [4] doi:10.1002/advs.202523009 [code]
- Personalized Network-Guided Neuromodulation Enhances Human Working Memory.Journal: Advanced science (Weinheim, Baden-Wurttemberg, Germany)In common: Tools for NIfTI and ANALYZE image (MATLAB), SPM, seaborn, 3 other tools, 1 reference
- [5] doi:10.1371/journal.pbio.3003856 [code]
- Aging and metabolism contribute separately to brain-body health.Journal: PLoS biologyIn common: Tools for NIfTI and ANALYZE image (MATLAB), SPM, seaborn, 3 other tools, structural MRI / diffusion, clinical / translational
- [6] doi:10.1162/imag.a.1264 [code]
- Data-driven subtyping and staging of ALS: A multicenter, longitudinal, deformation-based morphometry study.Journal: Imaging neuroscience (Cambridge, Mass.)In common: SPM, seaborn, SciPy, 2 other tools, structural MRI / diffusion, clinical / translational, 1 reference
- [7] doi:10.1002/mrm.70336 [code]
- Offline Reconstruction of Diffusion MRI Acquisitions for Comparison Between Complex PCA-Based and AI-Based Denoising.Journal: Magnetic resonance in medicineIn common: Tools for NIfTI and ANALYZE image (MATLAB), SPM, seaborn, 3 other tools, structural MRI / diffusion
- [8] doi:10.1016/j.xcrm.2026.102943 [code]
- Parent-of-origin effects in Alzheimer's liability dissociate neurocognitive and cardiovascular traits in at-risk individuals.Journal: Cell reports. MedicineIn common: Tools for NIfTI and ANALYZE image (MATLAB), SPM, seaborn, 3 other tools, clinical / translational
- [9] doi:10.1093/braincomms/fcag176 [code]
- Tau topography subtypes account for clinical heterogeneity and longitudinal trajectories in early-onset Alzheimer's disease.Journal: Brain communicationsIn common: Tools for NIfTI and ANALYZE image (MATLAB), SPM, seaborn, 3 other tools, clinical / translational
- [10] doi:10.1002/ana.78206 [code]
- Multimodal Image Guidance in Subthalamic Deep Brain Stimulation for Parkinson's Disease.Journal: Annals of neurologyIn common: Tools for NIfTI and ANALYZE image (MATLAB), SPM, seaborn, 3 other tools, clinical / translational
Contribute
The authors of this paper can claim it, correct its record and validate its tracing map, and the maintainers of its code (its owner, or a public member of its organization) correct what it says of their repository; anyone signed in can ask for its removal. Every request goes to OSCR's own machine, which answers it; your account page follows them.
Sign in with ORCID to claim this paper as one of its authors, correct its record or validate its tracing map: when the paper's metadata lists your ORCID iD, you are recognized at once. Maintainers of its code: sign in with GitHub, then claim the repository on your account page.
Claim this paper
Correct its record
Say what each link of this record is, remove the ones that are not the paper's, add the ones that are missing. The correction becomes a new version of the record, in its Versions section.
Validate its tracing map
You validate the map as this page shows it: 2 repositories of the authors' code, each at its verified commit and with its license, 11 scripts, and 0 matches between paragraphs and code (see the Code and Map sections). It then receives a DOI on Zenodo, with you (your ORCID iD) and OSCR as its creators; the code itself is not deposited.
The map's fingerprint: sha256:69c323fac533227e…
Add the badge to its README
The badge links the code to this page. Copy one of these into the README of the paper's code: only you decide where it goes, and nothing is changed for you.
Markdown
[, paste the snippet at the top, then “Commit changes…” and, to review it first, “Create a new branch and start a pull request”. You open the pull request; OSCR asks for no permission.
Request its removal
To ask OSCR to remove this record, the copies of its authors' scripts or its tracing map, use the removal request page: signed in, you say who you are, what to remove and why, then review and confirm the request. Published rules decide every request (how).
Discussion, reproductions, activity
Discussion: questions and error reports about this paper and its code, from signed-in readers and its authors. It opens with sign-in.
Reproductions: reports from readers who ran the authors' code: what they reproduced, with which environment, commit and data. It opens with sign-in.
Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.
