WHY MATHEMATICS?
Why Mathematics? | STitch3D for Multislice Tissue Maps: 3D Neighbour Graphs, Graph Attention, Single-Cell References and Cell-Type Deconvolution
How STitch3D turns aligned serial sections and a matched single-cell atlas into joint spatial representations, coherent 3D regions and estimated cell-type distributions.
Why mathematics is important becomes easier to see when a real decision depends on it. This guide follows the mechanism from definitions and dimensions to a worked calculation, validation, practical learning and responsible use. It keeps factual evidence separate from interpretation and treats every illustrative scenario as an example rather than a promise of results.
Choose a reading route
- Pre-align serial sections in a common coordinate frame
- Build a graph that connects locations across adjacent slices
- Learn spatial representations with graph attention
- Estimate cell-type mixtures and test reference dependence
Chapter map
- 1. Serial-section inputs
- 2. Physical z positions
- 3. Pre-alignment transform
- 4. Combined coordinate system
- 5. 3D neighbour graph
- 6. Single-cell expression profiles
- 7. Shared gene matrix
- 8. Attention score
- 9. Neighbour normalization
- 10. Graph aggregation
- 11. Slice-specific effects
- 12. Gene- and spot-specific terms
- 13. Latent representation
- 14. Spatial-domain clustering
- 15. Cell-type deconvolution
- 16. Governance and learning
Visit the How Mathematics Works hub for the wider series and its connections to education, reasoning, science, computing, design and careers.
1. Serial-section inputs
The useful question is not only how to calculate, but what the calculation assumes. Each section supplies coordinates and a spot-by-gene count matrix.
A concrete situation
Ten coronal sections cover an adult mouse brain.
What the mathematics does not license
Sections may differ in coverage and quality. The same reasoning helps students move from an exercise to a real dataset.
Try it, check it, transfer it
Audit each slice before pooling. Then explain the result to someone who has not seen the formula. If the explanation needs a hidden assumption, add that assumption to the model record.
2. Physical z positions
A small example makes the mechanism visible. Slice order and spacing supply the third coordinate.
A concrete situation
Adjacent sections are 50 micrometres apart.
What the mathematics does not license
Index numbers are not physical distance. That distinction matters because a correct formula can still answer the wrong operational question.
Try it, check it, transfer it
Record section thickness and gaps. Then explain the result to someone who has not seen the formula. If the explanation needs a hidden assumption, add that assumption to the model record.
3. Pre-alignment transform
This is where modelling choices begin to affect evidence. ICP or PASTE places x-y coordinates into one frame.
A concrete situation
A rotated section moves toward its neighbour.
What the mathematics does not license
Registration error enters every later graph edge. The habit of checking assumptions is one of the practical benefits of learning mathematics.
Try it, check it, transfer it
Save transforms and residuals. Then explain the result to someone who has not seen the formula. If the explanation needs a hidden assumption, add that assumption to the model record.
4. Combined coordinate system
The central mathematical idea is concrete. Aligned x, y and z values form one 3D location matrix.
A concrete situation
Each spot receives a three-coordinate vector.
What the mathematics does not license
Axes may use incompatible scales. The same reasoning helps students move from an exercise to a real dataset.
Try it, check it, transfer it
Standardize physical units. Then explain the result to someone who has not seen the formula. If the explanation needs a hidden assumption, add that assumption to the model record.
Did You Know? In this chapter, the most important number is useful only together with its construction rule. Changing scaling, sample membership or validation design can change the numerical answer without changing the arithmetic.
5. 3D neighbour graph
Here the geometry becomes operational. Edges connect spatially nearby spots within and across slices.
A concrete situation
A spot connects to peers above and below.
What the mathematics does not license
Large gaps can create false neighbours. That distinction matters because a correct formula can still answer the wrong operational question.
Try it, check it, transfer it
Inspect cross-slice edge lengths. Then explain the result to someone who has not seen the formula. If the explanation needs a hidden assumption, add that assumption to the model record.
6. Single-cell expression profiles
This step deserves a careful pause. Annotated reference cells are summarized by cell type.
A concrete situation
Excitatory-neuron profiles become reference columns.
What the mathematics does not license
Reference labels may be incomplete. The habit of checking assumptions is one of the practical benefits of learning mathematics.
Try it, check it, transfer it
Test reference and label alternatives. Then explain the result to someone who has not seen the formula. If the explanation needs a hidden assumption, add that assumption to the model record.
7. Shared gene matrix
The useful question is not only how to calculate, but what the calculation assumes. Spatial and reference datasets retain compatible genes.
A concrete situation
Highly variable genes support learning.
What the mathematics does not license
Selection can omit rare-cell markers. The same reasoning helps students move from an exercise to a real dataset.
Try it, check it, transfer it
Reserve markers for validation. Then explain the result to someone who has not seen the formula. If the explanation needs a hidden assumption, add that assumption to the model record.
8. Attention score
A small example makes the mechanism visible. A trainable function scores each graph neighbour.
A concrete situation
One anatomically consistent neighbour receives more weight.
What the mathematics does not license
Attention is not causal importance. That distinction matters because a correct formula can still answer the wrong operational question.
Try it, check it, transfer it
Check stability across seeds. Then explain the result to someone who has not seen the formula. If the explanation needs a hidden assumption, add that assumption to the model record.
Did You Know? In this chapter, the most important number is useful only together with its construction rule. Changing scaling, sample membership or validation design can change the numerical answer without changing the arithmetic.
9. Neighbour normalization
This is where modelling choices begin to affect evidence. Softmax converts scores into weights that sum to one.
A concrete situation
Three neighbours receive 0.6, 0.3 and 0.1.
What the mathematics does not license
Crowded graphs dilute evidence. The habit of checking assumptions is one of the practical benefits of learning mathematics.
Try it, check it, transfer it
Compare degree-aware graphs. Then explain the result to someone who has not seen the formula. If the explanation needs a hidden assumption, add that assumption to the model record.
10. Graph aggregation
The central mathematical idea is concrete. Weighted neighbour messages update spot representations.
A concrete situation
Cross-slice evidence sharpens a weak layer boundary.
What the mathematics does not license
Misaligned edges spread errors. The same reasoning helps students move from an exercise to a real dataset.
Try it, check it, transfer it
Ablate cross-slice edges. Then explain the result to someone who has not seen the formula. If the explanation needs a hidden assumption, add that assumption to the model record.
11. Slice-specific effects
Here the geometry becomes operational. Parameters account for systematic slice variation.
A concrete situation
One section has lower capture efficiency.
What the mathematics does not license
Technical and biological slice change can be confused. That distinction matters because a correct formula can still answer the wrong operational question.
Try it, check it, transfer it
Use replicates and holdouts. Then explain the result to someone who has not seen the formula. If the explanation needs a hidden assumption, add that assumption to the model record.
12. Gene- and spot-specific terms
This step deserves a careful pause. The model represents systematic variation by genes and locations.
A concrete situation
A highly expressed housekeeping gene has its own baseline.
What the mathematics does not license
Extra flexibility may absorb real signals. The habit of checking assumptions is one of the practical benefits of learning mathematics.
Try it, check it, transfer it
Inspect fitted components. Then explain the result to someone who has not seen the formula. If the explanation needs a hidden assumption, add that assumption to the model record.
Did You Know? In this chapter, the most important number is useful only together with its construction rule. Changing scaling, sample membership or validation design can change the numerical answer without changing the arithmetic.
13. Latent representation
The useful question is not only how to calculate, but what the calculation assumes. Low-dimensional spot vectors combine expression and 3D context.
A concrete situation
Nearby homologous regions cluster together.
What the mathematics does not license
Embedding geometry is model dependent. The same reasoning helps students move from an exercise to a real dataset.
Try it, check it, transfer it
Validate independent anatomy. Then explain the result to someone who has not seen the formula. If the explanation needs a hidden assumption, add that assumption to the model record.
14. Spatial-domain clustering
A small example makes the mechanism visible. Latent vectors support coherent 3D region discovery.
A concrete situation
A brain layer persists across sections.
What the mathematics does not license
Cluster count changes boundaries. That distinction matters because a correct formula can still answer the wrong operational question.
Try it, check it, transfer it
Publish stability over resolutions. Then explain the result to someone who has not seen the formula. If the explanation needs a hidden assumption, add that assumption to the model record.
15. Cell-type deconvolution
This is where modelling choices begin to affect evidence. Reference profiles combine to explain each spot.
A concrete situation
A spot estimates 70 per cent neurons and 30 per cent glia.
What the mathematics does not license
Proportions inherit reference bias. The habit of checking assumptions is one of the practical benefits of learning mathematics.
Try it, check it, transfer it
Use marker and simulation checks. Then explain the result to someone who has not seen the formula. If the explanation needs a hidden assumption, add that assumption to the model record.
16. Governance and learning
The central mathematical idea is concrete. Version registration, z spacing, graphs, genes, references and optimization.
A concrete situation
A student builds a two-slice adjacency matrix.
What the mathematics does not license
A reconstructed atlas is a model. The same reasoning helps students move from an exercise to a real dataset.
Try it, check it, transfer it
Write a 3D evidence ledger. Then explain the result to someone who has not seen the formula. If the explanation needs a hidden assumption, add that assumption to the model record.
Did You Know? In this chapter, the most important number is useful only together with its construction rule. Changing scaling, sample membership or validation design can change the numerical answer without changing the arithmetic.
A seven-day practice lab
- Day 1: define the decision, observation unit, X variables and Y or reference condition.
- Day 2: reproduce the smallest worked example and check every dimension, unit and sign.
- Day 3: build a transparent baseline and write what it assumes.
- Day 4: fit the main method inside a training-only pipeline; record every parameter.
- Day 5: challenge one assumption with a deliberately difficult dataset or operating regime.
- Day 6: compare validation metrics with the practical workload created by errors.
- Day 7: present one supported conclusion, one unresolved uncertainty and one safe next experiment.
Questions for a student, parent or mentor
- Which part of the model is a mathematical definition, and which part is a choice?
- What small calculation would catch a sign, scale or dimension error?
- What evidence comes from training, validation and the untouched test?
- What benign condition could look like a fault or prediction failure?
- How would the answer change for another response, asset, school project or time period?
- What should a human review before acting on the score?
A method-specific audit before deployment
STitch3D first places multiple approximately parallel tissue sections into a shared three-dimensional coordinate system, using ICP or PASTE for pre-alignment. It then constructs a 3D neighbour graph so a spot can borrow evidence within its slice and from nearby spots on adjacent slices.
A graph-attention model jointly uses spatial-transcriptomics counts, the 3D graph and cell-type-specific expression profiles derived from a matched single-cell RNA-sequencing reference. The model learns spot representations for spatial-domain discovery and estimates cell-type proportions across the reconstructed volume.
The model separates gene-, spot- and slice-specific contributions so shared biology can be strengthened while technical slice effects are controlled. That decomposition is an assumption, not a guarantee: a mismatched reference, incorrect pre-alignment, uneven slice spacing or missing tissue can create confident but wrong 3D patterns.
Frequently asked questions
What is STitch3D?
STitch3D jointly models multiple spatial-transcriptomics slices and a paired single-cell RNA-sequencing reference to reconstruct 3D regions and cell-type distributions.
Why is pre-alignment required?
A 3D graph needs comparable coordinates; STitch3D workflows use methods such as ICP or PASTE before graph construction.
What does graph attention do?
It learns data-dependent weights for neighbouring spots so their information contributes unequally to each updated representation.
How is the single-cell reference used?
Cell-type-specific expression profiles from annotated single-cell data guide deconvolution and representation learning.
What is a cell-type proportion?
It is an estimated nonnegative mixture for a spot under the model and reference, not a direct count of intact cells.
What can make a 3D pattern unreliable?
Misregistration, wrong slice spacing, missing tissue, batch effects or an unrepresentative reference can all create systematic error.
Primary source and fact-check note
Gefei Wang, Jia Zhao, Yan Yan, Yang Wang, Angela Ruohao Wu and Can Yang, “Construction of a 3D whole organism spatial atlas by joint modelling of multiple slices with deep neural networks,” Nature Machine Intelligence 5, 1200–1213 (2023), DOI 10.1038/s42256-023-00734-1. Definitions and core claims in this article were checked against this primary publication. Calculations shown here were independently recomputed. Examples are educational illustrations; they are not reported industrial performance results.
Useful next reading
Keep the options open. Mathematics education supports clearer questions, transferable problem-solving skills and informed choices across science, engineering, computing, AI, statistics, design and many other careers. It does not guarantee intelligence, income, admission or employment; those outcomes depend on far more than one subject or model.
Extended laboratory: topic-specific validation and responsible use
Slice audit
Check coverage, counts, orientation and physical z positions.
Registration audit
Save pre-alignment transforms and residuals.
Graph audit
Inspect within- and cross-slice edge lengths.
Reference audit
Compare matched single-cell atlases and label sets.
Did You Know? A sophisticated adjustment can be algebraically correct and still answer the wrong scientific question when samples, labels, batches or validation boundaries are wrong.
Attention audit
Test edge weights and seed stability.
Deconvolution audit
Use simulations and withheld marker genes.
Domain audit
Repeat clustering resolutions and slice holdouts.
Final claim
A 3D atlas is reconstructed evidence, not direct observation.
Did You Know? A sophisticated adjustment can be algebraically correct and still answer the wrong scientific question when samples, labels, batches or validation boundaries are wrong.
Mechanism workshop: calculate, challenge and transfer
Workshop 1: Serial-section inputs
Begin with this mechanism: Each section supplies coordinates and a spot-by-gene count matrix. Work through the concrete case: Ten coronal sections cover an adult mouse brain. Make the limitation visible: Sections may differ in coverage and quality. Complete the evidence step: Audit each slice before pooling. Write the coordinates, graphs, matrices, costs, weights, transformations, losses, couplings or displacement fields with named dimensions and physical units. Calculate one small example by hand, then vary one assumption and explain which output moves and why. Reserve complete sections, donors, platforms, regions, genes or landmarks outside tuning when testing transfer. Keep measurement, fitted representation, statistical evidence, biological interpretation and decision on separate notebook lines so a student, parent or reviewer can audit the mathematics.
Workshop 2: Physical z positions
Begin with this mechanism: Slice order and spacing supply the third coordinate. Work through the concrete case: Adjacent sections are 50 micrometres apart. Make the limitation visible: Index numbers are not physical distance. Complete the evidence step: Record section thickness and gaps. Write the coordinates, graphs, matrices, costs, weights, transformations, losses, couplings or displacement fields with named dimensions and physical units. Calculate one small example by hand, then vary one assumption and explain which output moves and why. Reserve complete sections, donors, platforms, regions, genes or landmarks outside tuning when testing transfer. Keep measurement, fitted representation, statistical evidence, biological interpretation and decision on separate notebook lines so a student, parent or reviewer can audit the mathematics.
Workshop 3: Pre-alignment transform
Begin with this mechanism: ICP or PASTE places x-y coordinates into one frame. Work through the concrete case: A rotated section moves toward its neighbour. Make the limitation visible: Registration error enters every later graph edge. Complete the evidence step: Save transforms and residuals. Write the coordinates, graphs, matrices, costs, weights, transformations, losses, couplings or displacement fields with named dimensions and physical units. Calculate one small example by hand, then vary one assumption and explain which output moves and why. Reserve complete sections, donors, platforms, regions, genes or landmarks outside tuning when testing transfer. Keep measurement, fitted representation, statistical evidence, biological interpretation and decision on separate notebook lines so a student, parent or reviewer can audit the mathematics.
Workshop 4: Combined coordinate system
Begin with this mechanism: Aligned x, y and z values form one 3D location matrix. Work through the concrete case: Each spot receives a three-coordinate vector. Make the limitation visible: Axes may use incompatible scales. Complete the evidence step: Standardize physical units. Write the coordinates, graphs, matrices, costs, weights, transformations, losses, couplings or displacement fields with named dimensions and physical units. Calculate one small example by hand, then vary one assumption and explain which output moves and why. Reserve complete sections, donors, platforms, regions, genes or landmarks outside tuning when testing transfer. Keep measurement, fitted representation, statistical evidence, biological interpretation and decision on separate notebook lines so a student, parent or reviewer can audit the mathematics.
Did You Know? A sophisticated adjustment can be algebraically correct and still answer the wrong scientific question when samples, labels, batches or validation boundaries are wrong.
Workshop 5: 3D neighbour graph
Begin with this mechanism: Edges connect spatially nearby spots within and across slices. Work through the concrete case: A spot connects to peers above and below. Make the limitation visible: Large gaps can create false neighbours. Complete the evidence step: Inspect cross-slice edge lengths. Write the coordinates, graphs, matrices, costs, weights, transformations, losses, couplings or displacement fields with named dimensions and physical units. Calculate one small example by hand, then vary one assumption and explain which output moves and why. Reserve complete sections, donors, platforms, regions, genes or landmarks outside tuning when testing transfer. Keep measurement, fitted representation, statistical evidence, biological interpretation and decision on separate notebook lines so a student, parent or reviewer can audit the mathematics.
Workshop 6: Single-cell expression profiles
Begin with this mechanism: Annotated reference cells are summarized by cell type. Work through the concrete case: Excitatory-neuron profiles become reference columns. Make the limitation visible: Reference labels may be incomplete. Complete the evidence step: Test reference and label alternatives. Write the coordinates, graphs, matrices, costs, weights, transformations, losses, couplings or displacement fields with named dimensions and physical units. Calculate one small example by hand, then vary one assumption and explain which output moves and why. Reserve complete sections, donors, platforms, regions, genes or landmarks outside tuning when testing transfer. Keep measurement, fitted representation, statistical evidence, biological interpretation and decision on separate notebook lines so a student, parent or reviewer can audit the mathematics.
Workshop 7: Shared gene matrix
Begin with this mechanism: Spatial and reference datasets retain compatible genes. Work through the concrete case: Highly variable genes support learning. Make the limitation visible: Selection can omit rare-cell markers. Complete the evidence step: Reserve markers for validation. Write the coordinates, graphs, matrices, costs, weights, transformations, losses, couplings or displacement fields with named dimensions and physical units. Calculate one small example by hand, then vary one assumption and explain which output moves and why. Reserve complete sections, donors, platforms, regions, genes or landmarks outside tuning when testing transfer. Keep measurement, fitted representation, statistical evidence, biological interpretation and decision on separate notebook lines so a student, parent or reviewer can audit the mathematics.
Workshop 8: Attention score
Begin with this mechanism: A trainable function scores each graph neighbour. Work through the concrete case: One anatomically consistent neighbour receives more weight. Make the limitation visible: Attention is not causal importance. Complete the evidence step: Check stability across seeds. Write the coordinates, graphs, matrices, costs, weights, transformations, losses, couplings or displacement fields with named dimensions and physical units. Calculate one small example by hand, then vary one assumption and explain which output moves and why. Reserve complete sections, donors, platforms, regions, genes or landmarks outside tuning when testing transfer. Keep measurement, fitted representation, statistical evidence, biological interpretation and decision on separate notebook lines so a student, parent or reviewer can audit the mathematics.
Did You Know? A sophisticated adjustment can be algebraically correct and still answer the wrong scientific question when samples, labels, batches or validation boundaries are wrong.
Workshop 9: Neighbour normalization
Begin with this mechanism: Softmax converts scores into weights that sum to one. Work through the concrete case: Three neighbours receive 0.6, 0.3 and 0.1. Make the limitation visible: Crowded graphs dilute evidence. Complete the evidence step: Compare degree-aware graphs. Write the coordinates, graphs, matrices, costs, weights, transformations, losses, couplings or displacement fields with named dimensions and physical units. Calculate one small example by hand, then vary one assumption and explain which output moves and why. Reserve complete sections, donors, platforms, regions, genes or landmarks outside tuning when testing transfer. Keep measurement, fitted representation, statistical evidence, biological interpretation and decision on separate notebook lines so a student, parent or reviewer can audit the mathematics.
Workshop 10: Graph aggregation
Begin with this mechanism: Weighted neighbour messages update spot representations. Work through the concrete case: Cross-slice evidence sharpens a weak layer boundary. Make the limitation visible: Misaligned edges spread errors. Complete the evidence step: Ablate cross-slice edges. Write the coordinates, graphs, matrices, costs, weights, transformations, losses, couplings or displacement fields with named dimensions and physical units. Calculate one small example by hand, then vary one assumption and explain which output moves and why. Reserve complete sections, donors, platforms, regions, genes or landmarks outside tuning when testing transfer. Keep measurement, fitted representation, statistical evidence, biological interpretation and decision on separate notebook lines so a student, parent or reviewer can audit the mathematics.
Workshop 11: Slice-specific effects
Begin with this mechanism: Parameters account for systematic slice variation. Work through the concrete case: One section has lower capture efficiency. Make the limitation visible: Technical and biological slice change can be confused. Complete the evidence step: Use replicates and holdouts. Write the coordinates, graphs, matrices, costs, weights, transformations, losses, couplings or displacement fields with named dimensions and physical units. Calculate one small example by hand, then vary one assumption and explain which output moves and why. Reserve complete sections, donors, platforms, regions, genes or landmarks outside tuning when testing transfer. Keep measurement, fitted representation, statistical evidence, biological interpretation and decision on separate notebook lines so a student, parent or reviewer can audit the mathematics.
Workshop 12: Gene- and spot-specific terms
Begin with this mechanism: The model represents systematic variation by genes and locations. Work through the concrete case: A highly expressed housekeeping gene has its own baseline. Make the limitation visible: Extra flexibility may absorb real signals. Complete the evidence step: Inspect fitted components. Write the coordinates, graphs, matrices, costs, weights, transformations, losses, couplings or displacement fields with named dimensions and physical units. Calculate one small example by hand, then vary one assumption and explain which output moves and why. Reserve complete sections, donors, platforms, regions, genes or landmarks outside tuning when testing transfer. Keep measurement, fitted representation, statistical evidence, biological interpretation and decision on separate notebook lines so a student, parent or reviewer can audit the mathematics.
Did You Know? A sophisticated adjustment can be algebraically correct and still answer the wrong scientific question when samples, labels, batches or validation boundaries are wrong.
Workshop 13: Latent representation
Begin with this mechanism: Low-dimensional spot vectors combine expression and 3D context. Work through the concrete case: Nearby homologous regions cluster together. Make the limitation visible: Embedding geometry is model dependent. Complete the evidence step: Validate independent anatomy. Write the coordinates, graphs, matrices, costs, weights, transformations, losses, couplings or displacement fields with named dimensions and physical units. Calculate one small example by hand, then vary one assumption and explain which output moves and why. Reserve complete sections, donors, platforms, regions, genes or landmarks outside tuning when testing transfer. Keep measurement, fitted representation, statistical evidence, biological interpretation and decision on separate notebook lines so a student, parent or reviewer can audit the mathematics.
Workshop 14: Spatial-domain clustering
Begin with this mechanism: Latent vectors support coherent 3D region discovery. Work through the concrete case: A brain layer persists across sections. Make the limitation visible: Cluster count changes boundaries. Complete the evidence step: Publish stability over resolutions. Write the coordinates, graphs, matrices, costs, weights, transformations, losses, couplings or displacement fields with named dimensions and physical units. Calculate one small example by hand, then vary one assumption and explain which output moves and why. Reserve complete sections, donors, platforms, regions, genes or landmarks outside tuning when testing transfer. Keep measurement, fitted representation, statistical evidence, biological interpretation and decision on separate notebook lines so a student, parent or reviewer can audit the mathematics.
Workshop 15: Cell-type deconvolution
Begin with this mechanism: Reference profiles combine to explain each spot. Work through the concrete case: A spot estimates 70 per cent neurons and 30 per cent glia. Make the limitation visible: Proportions inherit reference bias. Complete the evidence step: Use marker and simulation checks. Write the coordinates, graphs, matrices, costs, weights, transformations, losses, couplings or displacement fields with named dimensions and physical units. Calculate one small example by hand, then vary one assumption and explain which output moves and why. Reserve complete sections, donors, platforms, regions, genes or landmarks outside tuning when testing transfer. Keep measurement, fitted representation, statistical evidence, biological interpretation and decision on separate notebook lines so a student, parent or reviewer can audit the mathematics.
Workshop 16: Governance and learning
Begin with this mechanism: Version registration, z spacing, graphs, genes, references and optimization. Work through the concrete case: A student builds a two-slice adjacency matrix. Make the limitation visible: A reconstructed atlas is a model. Complete the evidence step: Write a 3D evidence ledger. Write the coordinates, graphs, matrices, costs, weights, transformations, losses, couplings or displacement fields with named dimensions and physical units. Calculate one small example by hand, then vary one assumption and explain which output moves and why. Reserve complete sections, donors, platforms, regions, genes or landmarks outside tuning when testing transfer. Keep measurement, fitted representation, statistical evidence, biological interpretation and decision on separate notebook lines so a student, parent or reviewer can audit the mathematics.
