Skip to main content

MRI Cutting — Final State

Branch​

MRI-Cutting

Current Approach​

MRI spherical cutting is geometric / coverage-only, rather than using CT-style intensity gating.

Regular Cut and Plane-Guided Cut share the maskInsideSphere path.

PolicyMRICT
Voxel eligibilitySphere coverage only (minValue: null)Iso / skull threshold (minValue = cut-time iso)
Erase / background writeeraseValue: 0Default 0
BoundarySoft anti-aliasing (binaryCarving: false)Same
Do not useDisplay iso, MRI tissue threshold, fixed MR intensity floor—

Stage 1A Implementation​

Stage 1A is implemented in:

  • sphereCutMaskParams.js
  • Cursor3D live cutting path
  • Cursor3D rebuild path

Cut History stores the cut-time mask fields:

  • eraseValue
  • minValue
  • binaryCarving
  • continuousScooping
  • modality

This allows replay to use the saved cutting behavior rather than re-reading the current iso slider.

For MRI spherical and plane-guided cuts:

minValue: null
eraseValue: 0
binaryCarving: false

The cut is therefore based on geometric sphere coverage rather than MRI intensity.

Contour / Path Cuts​

Contour/path cuts are outside Stage 1A scope.

Their current behavior is unchanged.

Contour cuts erase voxels to:

scalars.getRange()[0]

rather than using a hardcoded 0.

MRI Clinician Note​

Plan displays the MR-specific clinician note:

MRI signal intensity is sequence-dependent…

This reinforces that MRI intensity should not be treated like a fixed CT/HU tissue threshold.

Supporting MRI Work​

Additional work on the branch includes:

  • Plan NIfTI loading fix
  • MRI transfer-function path restored in Plan and View
  • applyMrIsoTransferFunctions is used when modality/profile is identified as MR

Final State

MRI Datasets Tested​

A formal cutting-specific dataset test matrix has not yet been recorded on this branch.

Available library MRI samples include:

  • MRI Cardiac 3D and Cine
  • MRI PROSTATEx

Related MRI transfer-function work exercised:

  • T1 series
  • T2 series
  • Modality tag MR

Cutting-specific dataset pass/fail results still need to be recorded from manual Plan testing.

Erase Value 0​

eraseValue: 0 is wired as the Stage 1A default for:

  • Regular spherical cuts
  • Plane-guided spherical cuts

This behavior is also covered by unit tests.

However, consistent visual success across different MRI datasets has not yet been confirmed in the repository.

For now, 0 should be treated as the working erase-value experiment rather than a final validated rule for every MRI dataset.

Cases Where Removed Regions May Remain Visible​

No dataset-level failure list has been recorded.

Residual visibility may still occur when:

  • The dataset background/air value is not near 0.
  • Writing 0 places the erased voxels inside an opaque part of the MRI transfer function.
  • Soft anti-aliasing leaves partially blended intensities around the cut boundary.
  • Modality detection fails and the volume falls back to CT-style rendering behavior.

In the modality fallback case, a narrow CT-style white band can make a valid carved region appear visually incomplete or weak.


Interaction With MRI Transfer Functions

MRI cutting changes the underlying scalar values.

The visible result is then determined by the MRI transfer function.

The MR transfer function currently uses:

  • A warm-tinted appearance
  • Opacity concentrated around the selected intensity region
  • Approximately zero opacity near the lower end of the transfer-function curve

Erasing to 0 produces a visually clean hole only when 0 lies in the transparent portion of the transfer function for that MRI series.

Changing the intensity slider or other display settings can therefore change how visible a cut appears without changing the actual carved voxels.

Contour cuts currently use:

scalars.getRange()[0]

This may better represent a transparent background than a fixed 0 when the MRI volume minimum is not zero.


Live Cutting vs Save Plan Replay

Live cutting and Save Plan reconstruction are designed to use the same Stage 1A spherical-cut behavior.

Live Cutting​

Live cutting uses:

buildSphereCutMaskParams

Rebuild / Load Replay​

Rebuild and Plan replay use:

resolveSphereCutMaskParamsFromHistory

The stored cut-time mask fields are used during replay.

For MRI, replay forces:

minValue: null

so replay does not reintroduce current-iso gating.

Legacy Cut History entries that do not contain the newer mask fields also receive coverage-only MRI defaults.

There is no intentional Stage 1A code-path difference between live spherical cutting and Save Plan replay.

If a visible difference appears between live and loaded cuts, likely areas to investigate include:

  • MRI transfer-function state
  • Intensity/display state
  • Older Cut History created before Stage 1A
  • Modality/profile detection

rather than the sphere-carving rule itself.


Recommended Next Experiment

If MRI holes still appear incomplete:

  1. Load the failing MRI series.

  2. Compare:

    scalars.getRange()[0]

    with:

    0
  3. Retest spherical and plane-guided cuts using:

    eraseValue = scalars.getRange()[0]

  4. Compare the result with the current eraseValue: 0 behavior.

  5. Confirm that modality/profile during the cut is:

    MR / mr

    and that the renderer has not fallen back to CT behavior.

  6. If the boundary still appears incomplete, compare:

    binaryCarving: false

    against:

    binaryCarving: true

This will help determine whether the remaining visibility comes from:

  • The erase value
  • The MRI transfer function
  • Modality detection
  • Soft anti-aliasing at the cut boundary

Branch Status Summary

ItemStatus
Stage 1A geometric MRI sphere / plane-guided cutDone
eraseValue: 0 initial experimentWired; empirical consistency TBD
Cut-time mask fieldsDone
Rebuild / Save Plan replay supportDone
Contour MRI carve policyUnchanged; uses data minimum
Formal MRI dataset test matrixNot recorded yet