Learning center

MR Spectroscopy: complex FID, ppm coordinates and numeric exports

Follow one synthetic selected voxel through two routes, complex FFT values, coordinate precision and the seven-file export package.

Written guide to the two-route MR Spectroscopy example in Medical Image Processing. A synthetic file contains four voxels, each with a complex time signal. The saved native review follows one selected voxel through FID display, Fourier spectrum and numeric exports. These constructed tones do not identify metabolites or establish performance on patient data.

1. Keep the complex signal and its axes

Open MR Spectroscopy, identified as medical_image/spectroscopy. The reviewed actions are LOAD MRS, LOAD METADATA, RUN, EXPORT LATEST and OPEN VIEWER. This is an app-specific local workflow; medical upload access and the full launcher journey require their own evidence.

The saved tones.npy contains complex128 values with shape 2 × 1 × 2 × 64. Its metadata declares ZYXN: three spatial axes followed by 64 signal samples. There are four voxels, not 64 image slices. Retain both real and imaginary components; a magnitude-only array is not the same input.

The zero-based selected voxel is [1, 0, 1] in Z, Y, X order. The FID and Fourier routes report that voxel. Keeping the full input file does not mean every voxel’s spectrum was independently checked. The input-preparation lesson explains how array shape, metadata and the selected region define the calculation.

For the accepted staged-package sequence, choose LOAD MRS for tones.npy, then LOAD METADATA for its companion JSON. That metadata supplies selected_voxel_zyx = [1, 0, 1]. The reviewed run left Selected voxel Z,Y,X blank, allowing that metadata value to apply; a filled entry overrides the metadata. Check the declared selection before Run so the displayed and exported single-voxel arrays refer to the intended location.

2. Preserve dwell time, frequency and chemical-shift convention

The fixture declares a 0.001-second dwell time, 125 MHz spectrometer frequency, the 1H nucleus and a 4.7 ppm chemical-shift reference. It also supplies a spatial affine and explicitly sets ppm_increases_with_frequency to true. These are input declarations, not values inferred from the visible peak.

The 64 saved time coordinates run from 0 to 0.063 seconds. The table’s duration_s is the last sample time measured from the first sample at zero: 63 intervals of 0.001 seconds. Do not confuse that displayed span with 64 dwell intervals.

For this declared sign convention, ppm equals 4.7 plus the frequency offset in Hz divided by the spectrometer frequency in MHz. Changing the dwell time, frequency, reference or sign changes the coordinates. A ppm value alone does not supply an acquisition profile, a compound assignment or a concentration.

3. Select only the two demonstrated routes

Select Complex FID acquisition evidence and FID Fourier spectrum, with route IDs fid_acquisition and spectrum_fft. The saved run completed both routes with no errors. Its run receipt, route results and export manifest retain validated: false.

The FID figure includes real, imaginary and magnitude curves against time. The Fourier figure includes real and magnitude curves against chemical shift. The saved viewer contains two plots and two summary tables. A magnitude plot cannot preserve the sign or phase of a complex spectrum; retain the complex array for numeric reuse.

The selected Fourier route applies an unnormalized complex FFT followed by fftshift. It does not divide amplitudes by the sample count. This route adds no apodization, zero filling or phase correction. Other preprocessing, fitting, concentration and map routes are outside this example.

4. Read the tone values, coordinate order and precision together

The fixture uses two exact-bin complex tones, with a scale of two at the selected voxel. The prior independent reference derives the expected bins from complex-exponential orthogonality. Its two nonzero values are:

Shifted binppmExpected complex value
162.7−32 + 96i
405.7160 + 64i

The prior receipt compared all 64 complex spectrum values with that reference. Its maximum absolute discrepancy was 1.2868476258827026e-13. The saved ppm, selected FID and time arrays matched their references exactly in that run. These are retained numerical comparisons for one synthetic example; this guide performs no new FFT or reference matching.

The exported ppm array is ascending, from approximately 0.7 to 8.575 ppm in 0.125 ppm increments. The app’s spectrum figure requests a descending horizontal display. Array order and plot direction are separate: keep every complex value paired with its ppm coordinate, and never reverse or sort only one array.

The viewer summary displays the lower bound as 0.700000, while results.json retains 0.7000000000000002. The maximum-magnitude coordinate is displayed as 5.700000. Display rounding is expected; use the arrays and saved numeric values for further comparisons. These artificial peak coordinates are not metabolite assignments.

5. Retain all seven files from Export Latest

The recorded package sequence used EXPORT LATEST after Run, then OPEN VIEWER. The source’s EXPORT PARENT control can select an existing destination folder; this workflow used a preset parent rather than testing that directory picker. The exporter creates a new mrs_… subdirectory and refuses a missing or symlinked parent. Keep the selected FID, its time array, the complex spectrum and its ppm array together.

EXPORT LATEST produced six listed members and a manifest. The full-volume FID, selected-voxel arrays and compact summary serve different purposes:

FilesRetained content
source_bound_fid.nii.gzAll four voxels’ complex time-domain signals in NIfTI-MRS, with acquisition and spatial metadata. It is not a volume of fitted spectra or metabolite concentrations.
fid_acquisition_fid.npy
fid_acquisition_times_s.npy
The selected voxel’s 64 complex128 FID values and 64 float64 time coordinates in seconds.
spectrum_fft_spectrum.npy
spectrum_fft_ppm.npy
The selected voxel’s 64 complex128 spectrum values and their 64 float64 ppm coordinates.
results.json
manifest.json
Two five-field summary tables and route status; then file identities, source-manifest identity and export limitations. The summary JSON does not replace the four arrays.

The NIfTI-MRS specification places complex time-domain samples in the fourth dimension, stores dwell time in the header and uses a JSON extension for spectroscopy metadata. The format overview explains the spatial and signal dimensions. The saved file here uses NIfTI-1 with extension code 44, frequency 125 MHz and nucleus 1H; the standard also supports NIfTI-2.

The writer converts internal Z, Y, X, sample order to X, Y, Z, sample order. This fixture has equal X and Z sizes, so the numeric shape remains 2 × 1 × 2 × 64 despite that transpose. Equal shapes do not prove equal axis meaning. The existing native readback checked all four exported FIDs; the guide rechecks file identities and small headers without decoding those signals again.

The NIfTI-1 header stores the dwell time as approximately 0.0010000000474974513 seconds because of float32 representation. Preserve units and a suitable precision tolerance. This numeric package contains no viewer CSV, PNG or reloadable session; opening the viewer is not evidence that those separate export actions were tested.

Before reusing an export, match run_id and source_manifest_sha256 in manifest.json to the completed run receipt. The source-manifest digest binds that result to its run; the separate release.json digest identifies the software package. Inspect both five-field tables in results.json and retain all six listed members plus the manifest. A successful file check does not change validated: false or turn the two synthetic tones into biological evidence.

Read complete displayed rows

In the later viewer, select a row in the main table or side table, then choose View full row. With the table focused, Enter also opens the selected row; you can also double-click it. The Full table row window shows each column heading and its complete displayed value in read-only, wrapped text. Select and copy the text you need, and scroll if necessary. Press Escape or choose Close to dismiss it. If no row is selected, select one first. Long result names also have a horizontal scrollbar.

The later 12 November 2026 unsigned candidate contains viewer e3b4baac… in archive a0b478da…, identified exactly in the evidence download. A separate viewer-only check at 1420 × 940 and 1040 × 820 exercised row opening, exact displayed-text copying, Escape and result-name scrolling. Inline cells still have compact widths, and the full-row window preserves display rounding; use the native numeric exports for further comparisons. The earlier ad0f2983… calculation and export receipts remain dated evidence: the rebuilt archive was not given a fresh end-to-end workflow run. This does not establish general accessibility or other operating-system support.

The example contains no noise, scanner acquisition, basis-set fit, metabolite quantification, anatomical interpretation or patient outcome. Source paths and identifiers are withheld in the saved export configuration; this is not a general certification that other inputs and companion files are de-identified. Keep the original signal, metadata and export manifest together.

Worked examples describe particular inputs, methods and recorded results. Check current availability and input requirements before planning an evaluation.

← Back to the learning center