TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/Rubick65/dcemapper/llms.txt
Use this file to discover all available pages before exploring further.
src.processing module computes semi-quantitative parametric maps from 4D DCE-MRI signal data. Starting from raw signal intensities, the pipeline derives three output maps — relative contrast enhancement (RCE), maximum RCE, and time-to-peak — each saved as a NIfTI file in the derivatives folder. All functions operate on numpy.ndarray objects and are designed to work together in sequence.
semi_quantitative(data, img, folders, semi_quantitative_data=None)
Top-level orchestrator for the semi-quantitative pipeline. Calls calculate_reference_value, calculate_rce, get_rce_max_value, and get_ttp_rce_max_value in order, then saves all three resulting maps to disk.
When semi_quantitative_data is None (interactive / GUI mode), the function opens a parameter dialog so the user can set frame_ini_contrast and frame_period visually.
4D signal intensity array of shape
(X, Y, Z, T) as returned by load_nifti.NiBabel image object used to preserve the affine transformation when saving output NIfTI files.
A two-element tuple
(output_folder, nifti_file_path). output_folder is the directory where the three output files will be written; nifti_file_path is the source file path used to derive output filenames.Optional
(frame_ini_contrast, frame_period) tuple that bypasses the interactive prompt. Pass this argument when calling from a script or test. If None, a GUI parameter dialog is shown.tuple — (rce_path, rce_max_path, tto_rce_max_path), each a str with the absolute path of the saved NIfTI file.
| Output file suffix | Content |
|---|---|
_rce_process.nii.gz | 4D relative contrast enhancement map |
_rce_max_process.nii.gz | 3D maximum RCE map |
_tto_rce_max_process.nii.gz | 3D time-to-peak map (normalised to [0, 1]) |
calculate_reference_value(data, frame_ini_contrast)
Computes the pre-contrast baseline signal S₀ by averaging the first frame_ini_contrast time frames for every voxel.
4D signal array of shape
(X, Y, Z, T).Number of pre-contrast frames to average. For example, if contrast agent arrives at frame 10, pass
frame_ini_contrast=10 to average frames 0..9.numpy.ndarray of shape (X, Y, Z) — the voxel-wise S₀ baseline.
calculate_rce(data, reference_value)
Computes the Relative Contrast Enhancement (RCE) at every voxel and time point as:
0. The result is clipped to the range [0, 500] percent.
4D signal array
(X, Y, Z, T), cast internally to float32.3D baseline array
(X, Y, Z) as returned by calculate_reference_value.numpy.ndarray of shape (X, Y, Z, T) with RCE values in percent, clipped to [0, 500].
get_rce_max_value(rce)
Returns the peak RCE at each voxel, collapsed along the temporal axis.
4D RCE array of shape
(X, Y, Z, T) as returned by calculate_rce.numpy.ndarray of shape (X, Y, Z) — maximum RCE value across all time frames.
get_ttp_rce_max_value(rce, frame_period)
Computes the time-to-peak (TTP) — the time elapsed from acquisition start to the frame with maximum RCE — for each voxel. The map is masked by the tissue ROI computed inside calculate_rce and then normalised to [0, 1].
4D RCE array of shape
(X, Y, Z, T).Duration between consecutive frames in seconds (e.g.
12.8). TTP is calculated as argmax(rce, axis=3) × frame_period.numpy.ndarray of shape (X, Y, Z) — time-to-peak in seconds, masked to tissue, normalised to the range [0, 1].
get_ttp_rce_max_value depends on the module-level tissue mask created by the most recent call to calculate_rce. Always call calculate_rce before calling get_ttp_rce_max_value within the same Python session.