Mri Reconstruction logo

Mri Reconstruction

Community
KeWang0622
mri-reconstruction

Read before turning MR data into images or parameter maps: raw k-space (Cartesian, radial, spiral, EPI; twix, ISMRMRD, numpy), GRAPPA/SENSE, coil combination, off-resonance correction, BART or SigPy, and T1, T2/EPG, T2*, water-fat (PDFF), ASL, DCE or QSM maps. Prevents silent errors in encoding sign, acceleration pattern, orientation, noise covariance and floor, water- fat swaps, timing origin and units. Ships tested numpy helpers and a finish check. Trained networks: deep-learning-recon; diffusion: diffusion-mri.

Overview

PublisherKeWang0622
RepositoryMRFoundry
Skill namemri-reconstruction
Stars
31
Forks
0
Bundled files
15
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 15 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by KeWang0622 on GitHub. Read the source before you install it.

Installation

Install the Mri Reconstruction AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/KeWang0622/MRFoundry/tree/main/skills/mri-reconstruction
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/KeWang0622/MRFoundry.git /tmp/MRFoundry
mkdir -p .claude/skills
cp -r /tmp/MRFoundry/skills/mri-reconstruction .claude/skills/mri-reconstruction
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Mri Reconstruction in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Mri Reconstruction on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Mri Reconstruction is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

MRFoundry: MRI Reconstruction and Quantitative Maps

Do the work with the tested helpers below instead of re-deriving their maths; open only the row you need. Hand-written versions of these steps failed silently in evaluation runs.

Route

TaskUse (scripts/)Read only if needed
Undersampled multi-coil Cartesian: R, offset and ACS from the mask, GRAPPA, CG-SENSE, prewhitening, coil combination, SNR unitsmrfoundry_rawrecon.py: sampling_pattern, grappa_from_mask, sense_combine, prewhitenraw-data checklist
Non-Cartesian (radial, spiral): exact forward model, NUFFT least squares; off-resonance with a field mapmrfoundry_reconlib.py: offres_least_squares, smooth_fieldraw-data checklist
Water-fat separation, PDFF, R2* (multi-echo GRE, multi-peak fat)fatwater_lib.py: fat_offsets_hz, fit_fat_water, fat_fractionquantitative maps
BART or SigPy pipelines; twix, ISMRMRD, .cfl filesbart_recon.shBART and SigPy
T1, T2, T2*, VFA, dictionaries, multi-echo spin echo with B1 (EPG)qmri_fit.pyquantitative maps
ASL CBF and arrival time, single or multiple delaysqmri_fit.py: asl_pairs_by_delay, slice_delays, asl_effective_efficiency (background suppression), m0_finite_tr, asl_cbf_pcasl, fit_asl_multidelayASL
DCE: signal to concentration, extended Toftsqmri_fit.py: spgr_concentration, fit_toftsDCE
QSM: phase to field, background removal, dipole inversion, reference regionqsm_lib.py: run_pipeline (phase_misfit_fraction < 0.01; --selftest with your acquisition must PASS)QSM
Fixed settings of a fitted model (nuisance values, spectra, fractions)model calibration
One-file standalone entrypointpython .agents/skills/mri-research-workflow/scripts/inline_helpers.py <module.py> <functions> --into <entrypoint.py> copies the tested helpers

Import with sys.path.insert(0, '.agents/skills/mri-reconstruction/scripts'). python <module>.py --api prints the signatures (do not read the sources); scripts/test_<module>.py has worked examples. Never retype a helper into a standalone entrypoint: copy it with inline_helpers.py (a retyped GRAPPA took the wrong acceleration factor from the mask and still gave plausible maps).

Checks that prevent silent errors

  1. Write the conventions down first: axis order and which sample is k = 0, encoding sign (exp(-i2πk·r): ifft2c; exp(+i2πk·r): image_from_kspace(ksp, encoding_sign=+1)), readout oversampling, output grid [y, x], units and time origin of every input. Read protocol values from the file or sidecar.
  2. Validate with an independent forward model: simulate a known asymmetric object or parameter set through your exact sampling and timing (direct_dft_signed, direct_dft, quadrature, analytic signals), then run your pipeline: orientation_check(img, truth) must return ('identity', (0, 0)) and parameters must come back. A round trip through your own transforms cannot reveal a sign, axis or timing error.
  3. Noise: Psi = E[n n^H] from noise samples [coil, samples] (noise_covariance); scale it by noise dwell / imaging dwell (scale_noise_covariance); averaging N acquisitions divides it by N. SNR units: snr_units_image; confirm the real-part noise SD is 1 on a pure-noise or pseudo-replica run, never from low-magnitude pixels of the image.
  4. Choose the reconstruction by simulated error (rank_reconstructions with your sampling and measured noise; metric= the endpoint error when the deliverable is a parameter map): exact data consistency is not image quality; at R >= 3 it keeps or amplifies noise.
  5. Fits: use the stated model and time origin. Multi-echo magnitude at low SNR: combine coils with the SAME phase-preserving weights for every echo (sense_combine), then pass noise_sigma (and n_channels for RSS) to fit_monoexp or fit_dictionary; an RSS log-linear fit overestimates T2 by several percent. Water-fat: fit_fat_water chooses among field-map candidates with a smooth field (voxelwise minima swap water and fat in isolated high-fat regions), then fat_fraction(water_real, fat_real, flip, TR, T1w, T1f, b1). Check map units against expected ranges (finish_check.py --range).
  6. Standalone entrypoints read every protocol value (matrix, coils, acceleration, delays, echo times, field strength, slice timing, frame times, scale factors) from the inputs; run them on a second simulated input with OTHER values (another acceleration, field strength or echo train) before finishing.

Before you finish

python .agents/skills/mri-research-workflow/scripts/finish_check.py --require <every deliverable name> \
    --rerun "python <entrypoint> <documented arguments with {inputs} and {out}>" --inputs <input folder>

Put the entrypoint and all outputs in the folder the task names (the workspace root if none). Fix every FAIL line and rerun the check. Report numbers read back from the saved outputs.

Setup and scope

  • Use the workspace interpreter (.venv/bin/python if present) and -m pip install only missing packages; numpy and scipy cover every helper here. Read the tool setup guide only if an install fails or you need BART, Julia or a GPU toolbox.
  • Ongoing projects with .mrfoundry/INDEX.md: project memory. Citations: reading list; method evidence and claims: evaluation guide.
  • Trained networks: deep-learning-recon. Acquisition design: pulse-sequence-design. Diffusion models: diffusion-mri. Spectroscopy: mri-research (scripts/mrs_lib.py).

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Mri Reconstruction AI skill do?

Read before turning MR data into images or parameter maps: raw k-space (Cartesian, radial, spiral, EPI; twix, ISMRMRD, numpy), GRAPPA/SENSE, coil combination, off-resonance correction, BART or SigPy, and T1, T2/EPG, T2*, water-fat (PDFF), ASL, DCE or QSM maps. Prevents silent errors in encoding sign, acceleration pattern, orientation, noise covariance and floor, water- fat swaps, timing origin and units. Ships tested numpy helpers and a finish check. Trained networks: deep-learning-recon; diffusion: diffusion-mri.

Why use Mri Reconstruction on TypingMind?

Because you install it once and use it with any model. Mri Reconstruction is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Mri Reconstruction in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/KeWang0622/MRFoundry/tree/main/skills/mri-reconstruction. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Mri Reconstruction?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Mri Reconstruction?

As many as you like. As long as a model supports skills, you can use Mri Reconstruction with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Mri Reconstruction AI skill free?

Yes. It is published on GitHub by KeWang0622 under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇