SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2403.06227 · 2024

PEPSI: Pathology-Enhanced Pulse-Sequence-Invariant Representations for Brain MRI

arXiv · PDF · Open in the Atlas

Code that ran

7 of 9 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 2 honoured the contract we drafted, 1 violated it and 0 have no contract verdict; 4 failures of our instrument; 2 no recorded run), measured 2026-11-22; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2403.06227.json · badge: /api/ran/2403.06227.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
peirong26/PEPSI canonical (classifier label)
classifier basis: census
7 ran · 2 no recorded run
FunctionStatusWhere it lives
align_shape Ran
ran, violated the contract we drafted
peirong26/PEPSI/PEPSI/models/evaluator.py
code served (permissive licence) · get_code("5c9440fb374410ce")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple, ndim 4, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

torch.manual_seed(0)

# Create two 3D arrays with different shapes
# The function accesses .shape and indexes with [:s, :r, :c]
nda1 = np.random.randn(5, 6, 7)
nda2 = np.random.randn(3, 4, 8)

ARGS = {
    'nda1': nda1,
    'nda2': nda2
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 4, dtype family float — a tuple output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
even_sample Ran
ran, honoured the contract we drafted
peirong26/PEPSI/PEPSI/visualizer.py
code served (permissive licence) · get_code("aef4107b9a82b29c")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 1, dtype family int; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np
from math import ceil

# The function even_sample takes:
# - orig_len: an integer representing the original length
# - num: an integer representing the number of samples to generate

ARGS = {
    "orig_len": 100,
    "num": 10
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family int — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
gaussian_loss Ran
ran; our contract draft was wrong, not the code
peirong26/PEPSI/PEPSI/models/losses.py
code served (permissive licence) · get_code("6bd5446ea46e3dd1")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# Create small tensors for the function parameters
batch_size = 2
dim = 4

# outputs_mu: mean predictions from model
outputs_mu = torch.randn(batch_size, dim)

# outputs_sigma: log-variance predictions from model
outputs_sigma = torch.randn(batch_size, dim)

# targets: ground truth values
targets = torch.randn(batch_size, dim)

# weights: scalar or tensor weights for each sample
weights = 1.0

ARGS = {
    "outputs_mu": outputs_mu,
    "outputs_sigma": outputs_sigma,
    "targets": targets,
    "weights": weights,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_onehot Ran
ran; our contract draft was wrong, not the code
peirong26/PEPSI/PEPSI/models/evaluator.py
code served (permissive licence) · get_code("5bbdc15bd4bc1394")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 4, dtype family float, shape (33, 2, 3, 4) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np
import torch

torch.manual_seed(0)

# The function expects:
# - label: a numpy array that will be squeezed and converted to tensor
# - device: a torch device

# Looking at the function body:
# - label is squeezed, converted to tensor, and indexed into lut
# - The result is indexed into onehotmatrix which has shape (n_labels, n_labels)
# - The final permute is [3, 0, 1, 2], suggesting the onehot tensor has 4 dimensions
# - Working backwards: onehotmatrix[lut[label]] produces shape (batch, height, width, n_labels)
# - So label should be a 3D array (batch, height, width) or similar

# Create a small label array with values matching the label_list_segmentation
# We'll use a small spatial grid (2x3x4) to keep it tiny
label_data = np.array([
    [[0, 14, 15, 16],
     [24, 77, 85, 2],
     [3, 4, 7, 8]],
    [[10, 11, 12, 13],
     [17, 18, 26, 28],
     [41, 42, 43, 46]]
], dtype=np.int64)

device = torch.device('cpu')

ARGS = {
    'label': label_data,
    'device': device
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 4, dtype family float, shape (33, 2, 3, 4) — shape (33, 2, 3, 4) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
l1_loss Ran
ran; our contract draft was wrong, not the code
peirong26/PEPSI/PEPSI/models/losses.py
code served (permissive licence) · get_code("1112222d38da99ce")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# Create small tensors for outputs and targets
outputs = torch.randn(2, 4)
targets = torch.randn(2, 4)

# Create weights tensor with same shape as outputs/targets
weights = torch.ones(2, 4)

ARGS = {
    "outputs": outputs,
    "targets": targets,
    "weights": weights,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
l2_loss Ran
ran; our contract draft was wrong, not the code
peirong26/PEPSI/PEPSI/models/losses.py
code served (permissive licence) · get_code("21d2dd0d7c3c815e")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# Create small tensors for outputs and targets
outputs = torch.randn(2, 4)  # batch_size=2, dim=4
targets = torch.randn(2, 4)  # batch_size=2, dim=4

# Create weights tensor (can be scalar or same shape as outputs/targets)
weights = torch.ones(2, 4)

ARGS = {
    "outputs": outputs,
    "targets": targets,
    "weights": weights,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
pad_shape Ran
ran, honoured the contract we drafted
peirong26/PEPSI/PEPSI/visualizer.py
code served (permissive licence) · get_code("66a524eaae73c605")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 3, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np

# Create a list of numpy arrays with different shapes to be padded
# The function will pad them all to the same maximum shape

# 2D arrays with different sizes
array1_2d = np.array([[1.0, 2.0, 3.0],
                       [4.0, 5.0, 6.0]])  # shape (2, 3)

array2_2d = np.array([[7.0, 8.0],
                       [9.0, 10.0],
                       [11.0, 12.0],
                       [13.0, 14.0]])  # shape (4, 2)

array_list_2d = [array1_2d, array2_2d]

# 3D arrays with different sizes
array1_3d = np.random.randn(2, 3, 4)  # shape (2, 3, 4)
array2_3d = np.random.randn(3, 2, 5)  # shape (3, 2, 5)

array_list_3d = [array1_3d, array2_3d]

# 4D arrays with different sizes
array1_4d = np.random.randn(2, 3, 4, 5)  # shape (2, 3, 4, 5)
array2_4d = np.random.randn(3, 2, 3, 4)  # shape (3, 2, 3, 4)

array_list_4d = [array1_4d, array2_4d]

# Test with 2D arrays
ARGS = {
    "array_list": array_list_2d
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 3, dtype family float — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_head Not yet run
unverified (harvested, no recorded run)
peirong26/PEPSI/PEPSI/models/head.py
code served (permissive licence) · get_code("136b636aa89c201c")
How it ran

no invocation recorded.

match_shape Not yet run
unverified (harvested, no recorded run)
peirong26/PEPSI/PEPSI/visualizer.py
code served (permissive licence) · get_code("24494a5b455a5ef5")
How it ran

no invocation recorded.

Also present in other papers' code

Of 9 samples lifted from this paper's linked repositories, 9 carry a function identity and 0 do not. Of the 9 distinct functions with an identity, 9 are also present in other papers whose code we hold (9 with at least one paper dated earlier, 0 the same month, 0 later) and 0 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
align_shape 1 other paper
1 dated earlier
2311.16914 (2023-11)
Brain-ID: Learning Contrast-agnostic Anatomical Representations for Brain Imaging
even_sample 1 other paper
1 dated earlier
2311.16914 (2023-11)
Brain-ID: Learning Contrast-agnostic Anatomical Representations for Brain Imaging
gaussian_loss 1 other paper
1 dated earlier
2311.16914 (2023-11)
Brain-ID: Learning Contrast-agnostic Anatomical Representations for Brain Imaging
get_head 1 other paper
1 dated earlier
2311.16914 (2023-11)
Brain-ID: Learning Contrast-agnostic Anatomical Representations for Brain Imaging
get_onehot 1 other paper
1 dated earlier
2311.16914 (2023-11)
Brain-ID: Learning Contrast-agnostic Anatomical Representations for Brain Imaging
l1_loss 1 other paper
1 dated earlier
2311.16914 (2023-11)
Brain-ID: Learning Contrast-agnostic Anatomical Representations for Brain Imaging
l2_loss 1 other paper
1 dated earlier
2311.16914 (2023-11)
Brain-ID: Learning Contrast-agnostic Anatomical Representations for Brain Imaging
match_shape 1 other paper
1 dated earlier
2311.16914 (2023-11)
Brain-ID: Learning Contrast-agnostic Anatomical Representations for Brain Imaging
pad_shape 1 other paper
1 dated earlier
2311.16914 (2023-11)
Brain-ID: Learning Contrast-agnostic Anatomical Representations for Brain Imaging

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-22.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Remarkable progress has been made by data-driven machine-learning methods in the analysis of MRI scans. However, most existing MRI analysis approaches are crafted for specific MR pulse sequences (MR contrasts) and usually require nearly isotropic acquisitions. This limits their applicability to diverse real-world clinical data, where scans commonly exhibit variations in appearances due to being obtained with varying sequence parameters, resolutions, and orientations -- especially in the presence of pathology. In this paper, we propose PEPSI, the first pathology-enhanced, and pulse-sequence-invariant feature representation learning model for brain MRI. PEPSI is trained entirely on synthetic images with a novel pathology encoding strategy, and enables co-training across datasets with diverse pathologies and missing modalities. Despite variations in pathology appearances across different MR pulse sequences or the quality of acquired images (e.g., resolution, orientation, artifacts, etc), PEPSI produces a high-resolution image of reference contrast (MP-RAGE) that captures anatomy, along with an image specifically highlighting the pathology. Our experiments demonstrate PEPSI's remarkable capability for image synthesis compared with the state-of-the-art, contrast-agnostic synthesis models, as it accurately reconstructs anatomical structures while differentiating between pathology and normal tissue. We further illustrate the efficiency and effectiveness of PEPSI features for downstream pathology segmentations on five public datasets covering white matter hyperintensities and stroke lesions. Code is available at https://github.com/peirong26/PEPSI.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2403.06227")
get_code_for_paper("2403.06227")
have("2403.06227")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2403.06227.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2403.06227.svg)](https://syntology.ai/paper/2403.06227)

Connect an agent — have() is free.