Begin typing your search above and press return to search.
Volume: 24 Issue: 6 June 2026 - Supplement - 2

FULL TEXT

ARTICLE

A Custom-Built Intravoxel Incoherent Motion Diffusion Magnetic Resonance Imaging Tool for Renal Transplant Assessment: A Modular Graphical User Interface for Quantitative Biomarker Extraction

Objectives: In this study, we present a custom-developed, Python-based graphical user interface designed to address the limitations of existing software in region of interest manipulation and fitting algorithm flexibility for intravoxel incoherent motion magnetic resonance imaging analysis, specifically for evaluation of renal grafts and donor organs.
Materials and Methods: We developed a modular tool compatible with DICOM-formatted diffusion-weighted magnetic resonance imaging data. The software incorporates multiple fitting models, including monoexponential, biexponential (free and segmented), and Bayesian inference approaches. The software supports versatile region of interest drawing tools (freehand, elliptical, and polygonal) and generates pixel-level parametric maps and baseline-normalized signal decay curves.
Results: The developed software interface successfully allowed voxel-wise and region of interest-based analysis of intravoxel incoherent motion parameters (D, D*, f). The interface also provided visual quality assessment through parametric maps and exported comprehensive data to spreadsheets. Preliminary observations with medical professionals indicated that the software offers superior control over area selection and a more intuitive workflow compared with existing open-source tools.
Conclusions: The proposed software offers a flexible, noninvasive solution for assessing kidney transplant recipients and healthy donors. The DICOM-native compatibility and flexible analysis features of the software make it a suitable tool for prospective clinical trials focused on monitoring graft function and identifying early dysfunction.


Key words : Diffusion-weighted imaging, Graft monitoring, Kidney transplantation, Software

Introduction
Renal transplantation remains the gold standard treatment for end-stage renal disease, offering superior survival rates and quality of life compared with dialysis. However, the long-term success of transplant depends heavily on the early detection of graft dysfunction and the accurate assessment of donor organ quality. Traditional methods for monitoring graft health, such as serum creatinine measurement and renal biopsy, have significant limitations.1 Although biopsy is the definitive standard, biopsy is invasive, carries procedural risks, and cannot be performed frequently.2 Consequently, there is a growing clinical need for noninvasive imaging biomarkers that can reliably differentiate between structural damage and functional perfusion changes in renal tissues.3 Diffusion-weighted magnetic resonance imaging has emerged as a powerful non-invasive technique in this domain.4 Specifically, the intravoxel incoherent motion (IVIM) model allows for the separation of pure molecular diffusion from microvascular perfusion (pseudo-diffusion) without the need for contrast agents.5 This capability makes IVIM particularly promising for evaluating ischemic injury and rejection in kidney allografts, where perfusion parameters are critical indicators of graft health.6 Despite the theoretical advantages of IVIM, its clinical translation has been hindered by the lack of standardized and flexible analysis tools. Although several software packages exist,7,8 many open-source distributions lack the necessary flexibility for precise region of interest (ROI) manipulation, which is crucial for heterogeneous renal parenchyma. Furthermore, most tools do not support multiple fitting algorithms, such as segmented biexponential or Bayesian approaches, within a single interface, thus limiting researchers to a “one-size-fits-all” methodology that may not be appropriate for all clinical datasets. In this study, we present a custom-developed, Python-based graphical user interface (GUI) designed to bridge this gap. This tool offers direct clinical applicability for renal transplantation by enabling comprehensive voxel-wise and ROI-based analysis of IVIM parameters (D, D*, f) from Digital Imaging and Communications in Medicine (DICOM) native data. By integrating versatile ROI drawing tools, multiple fitting models, and intuitive visualization features, we aimed to provide a superior alternative for monitoring graft function and comparing donor organ quality in prospective clinical trials.

Materials and Methods
Standard diffusion-weighted imaging typically uses a monoexponential model to calculate the apparent diffusion coefficient (ADC). However, in highly perfused organs like the renal allograft, the ADC value represents a confounding combination of thermally induced molecular diffusion and microvascular perfusion.9 To differentiate these components, we used the IVIM model. The signal attenuation is described by the bi-exponential equation5 (equation 1):

where S(b) is the signal intensity at a given b-value. This model yields 3 quantitative parameters with distinct pathophysiological significance for renal monitoring9: the true diffusion coefficient (D), the perfusion fraction (f), and the pseudo-diffusion coefficient (D*). The true diffusion coefficient (D) represents pure molecular diffusion in the extravascular space. In renal transplants, a reduction in D is primarily associated with cellular swelling, interstitial fibrosis, and tubular atrophy, serving as a marker for chronic allograft injury.6 The perfusion fraction (f) reflects the fractional volume of blood flowing within the capillary network. This parameter correlates with renal blood flow and is a sensitive indicator of capillary rarefaction or acute vascular rejection.4 The pseudo-diffusion coefficient (D*) is related to the velocity of capillary blood flow. Although inherently noisy, significant alterations in D* may indicate perfusion deficits in the early posttransplant period.4 The extraction of IVIM parameters is an ill-posed inverse problem, where parameter estimation is highly sensitive to the signal-to-noise ratio and the choice of fitting algorithm.10 To ensure reliable quantification across variable clinical conditions, 3 distinct mathematical approaches were evaluated and implemented: monoexponential fitting, segmented fitting, and Bayesian interference. Monoexponential fitting, a standard log-linear regression, is used to calculate conventional ADC maps. This serves as a baseline for comparison with bi-exponential parameters. Segmented fitting, which involves simultaneous estimation of all 3 IVIM parameters, often leads to instability and “black pixel” artifacts due to the coupling of D and D*. The segmented approach mitigates this by exploiting the physiological fact that perfusion effects are negligible at high b-values. The algorithm first estimates D using only b-values >200 s/mm2. Subsequently, f and D* are estimated from the low b-value data while keeping D fixed. This method is generally preferred for clinical datasets as it provides more robust and reproducible parametric maps.11 For datasets with compromised signal-to-noise ratio or limited b-value sampling, a Bayesian interference approach is used. This approach utilizes prior probability distributions to constrain the parameter search space, preventing physiologically unrealistic values and reducing variance in heterogeneous tissue regions.11 Based on the theoretical framework described above, a custom-developed GUI was engineered to create clinical analysis. We built the software by using Python to process DICOM-formatted images directly, preserving the original dynamic range and header information without the need for external file conversion. The software interface was designed to address the anatomical complexity of renal grafts. The software incorporates flexible ROI drawing tools, including freehand, polygonal, and elliptical options, rather than limiting the user to rigid geometric shapes. This flexibility allows the operator to precisely delineate the renal parenchyma (cortex and medulla) while carefully excluding the renal pelvis, large hilar vessels, and perirenal fat, which can extract perfusion metrics. Upon ROI definition, the software performs voxel-wise fitting on a 2-dimensional image slice using the selected algorithm to generate color-coded parametric maps and IVIM parameters. Simultaneously, the software calculates the mean signal decay curve normalized to the b = 0 baseline to allow for visual quality control of the fit. For clinical documentation and statistical validation, the software automatically computes and exports parameters values for all parameters to structured spreadsheet files.

Results
We developed the GUI using Python and the PyQt5 library. We chose PyQt5 because it handles the window events efficiently. The main window size was set to 1600 × 1000 pixels. This resolution is large enough to show medical images clearly on standard monitors. The software structure has 2 main parts. We used a “QTabWidget” to separate these parts into tabs (the DICOM Loader and the Diffusion Viewer). For showing the images and plots, we used the “Matplotlib” library with the “FigureCanvasQTAgg” backend. This allows the plots to work inside the “PyQt” window. The first tab, “DICOMLoaderTab,” handles the file input. We used the “os.walk” function to search through folders recursively. To make sure that the files are correct, the code checks the metadata using the “pydicom” library before loading the pixel data. The software organizes the files into a dictionary format (self.patients_dict) and groups the data in 3 levels: patient name, series description, and individual file paths. The interface also has a preview function. When the user clicks on a series name in the list, the software reads the first file and shows it on a small canvas. This helps the user to check whether the image is the correct one before sending it to the analysis tab (Figure 1). The data transfer happens via the “send_to_diffusion_tab” function. In the “DiffusionViewerTab,” the software takes the sorted file lists, creates a data structure for analysis, and organizes the images by b-values and slice positions. For navigation, we placed 2 sliders in the interface. One slider changes the b-value, and the other slider changes the slice position. This allows the user to see how the signal changes with diffusion weighting at the same anatomical location (Figure 2). For defining the ROI, we used the widgets from “matplotlib.” We implemented 3 types of ROI tools: ellipse (for circular shapes), lasso or freehand (for drawing irregular shapes by hand), and polygon (for shapes with straight lines). The code uses a logic to combine masks. If the user draws multiple shapes, the software uses a logical “OR” operation to combine them. This is useful for selecting multiple areas at the same time. We implemented 4 different mathematical models to calculate the diffusion parameters. The user can run these models on the selected ROI. The ADC is calculated using a linear fit. The software takes the natural logarithm of the signal. We included a checkbox called “exclude b = 0.” If the user checks this, the code removes the b = 0 data points to reduce T2 shine-through effects. For the IVIM model, we used the “curve_fit” function from “scipy.optimize.” The model (Figure 3) fits equation 1 (above). We also implemented a segmented fitting method to improve stability. This method works in 2 steps. First, only high b-values (b > 200) are used to find the diffusion coefficient D. Second, D remains fixed and f and D* are calculated by using all b-values. This method is useful when the data have noise because the number of free parameters is reduced in the first step. The software includes a Bayesian approach using the PyMC library. This is different from the least-squares method. The approach defines prior distributions for f, D, and D* and uses Markov Chain-Monte Carlo (MCMC) sampling10 (NUTS sampler) to find the posterior distributions. The code runs 500 samples to estimate the mean values of the parameters. The software can generate parametric maps for the whole image or the ROI. The function loops through the pixels (x, y) and applies the selected model (ADC, IVIM, or segmented) to the signal of each pixel. The resulting maps are displayed on top of the original image using the “Jet” colormap (Figure 4). The user can enter “Min” and “Max” values to adjust the color scale. This helps to visualize the contrast in different tissues. Finally, the results can be exported. The “export_results_to_excel” function opens a dialog for the patient’s name. All the calculated parameters (ADC, free f, segment f, Bayes f, etc) are saved into a data frame, which is transferred to an Excel file with a timestamp. This allows for easy data collection for statistical analyses.

Discussion
The development of the presented GUI addresses a specific gap in the analysis of diffusion-weighted imaging: the accessibility of advanced fitting algorithms within a clinically friendly framework. Although basic ADC maps are standard on commercial workstations, advanced IVIM models, particularly Bayesian approaches, often remain restricted to command-line scripts or code-heavy environments like MATLAB or Python. This software consolidates these methods into a single, compact, and executable interface. A primary advantage of this implementation is the simultaneous provision of multiple fitting strategies. The IVIM signal is notoriously sensitive to noise, and the standard bi-exponential fit often produces pixels with values hitting the boundary constraints (0 or 1), commonly referred to as “black pixels.” By integrating the segmented fit (asymptotic approach) and Bayesian inference alongside the standard fit, the tool allows the user to perform methodological triangulation. For example, a researcher can immediately verify whether the stability gained from the segmented method aligns with the probabilistic estimates from the Bayesian model. The inclusion of the PyMC library for MCMC sampling is particularly important here. Bayesian estimation provides a distribution of likely values rather than a single point estimate, offering robustness against local minima. Typically, setting up a Bayesian pipeline requires substantial programming expertise; this GUI abstracts that complexity, making high-level probabilistic modeling available via a single button click. The practical utility of the software is further enhanced by its flexible ROI capabilities. Biological structures, especially tumors, are rarely perfectly circular. The implementation of 3 distinct selection modes (ellipse, polygon, and freehand [lasso]) allows for precise delineation of heterogeneous lesions. Of note, the software’s underlying logic allows for the aggregation of multiple, disjointed ROIs. The use of a bitwise “OR” operation on the binary masks means a user can select multifocal disease sites (eg, metastatic deposits in the liver) and analyze them as a single collective volume. This feature is often absent in basic open-source viewers, typically restricting analysis to a single contiguous shape. Workflow efficiency was a central design priority. The direct integration of the DICOM Loader eliminates the need for external file converters (such as dcm2nii), which are common barriers in research settings. The preview functionality in the loader tab prevents the time-consuming loading of incorrect or corrupted sequences. Furthermore, the automated export function addresses a common bottleneck in data collection. By saving all computed parameters (ADC, f, D, D*) from all active models into a time-stamped Excel file, the system reduces the risk of manual transcription errors and streamlines the transition from image analysis to statistical evaluation. The current implementation has limitations. The Bayesian MCMC approach, while robust, is computationally intensive. Although the interface remains responsive, the processing time for pixel-wise Bayesian mapping on large matrices can be substantial compared with the instantaneous linear ADC calculation. Future iterations could optimize this by implementing parallel processing or GPU acceleration for the MCMC sampling. In addition, the viewer currently operates on a slice-by-slice basis. Although this method is sufficient for ROI-based quantification, a volumetric (3-dimensional) rendering module would improve the assessment of spatially complex anatomical structures. In summary, this tool serves as a bridge between raw code and clinical application. The tool provides a “sandbox” environment where researchers can test the variability of IVIM parameters across different mathematical models without leaving the interface, ultimately supporting more reproducible quantitative imaging studies.

Conclusions
We have successfully developed a compact graphical interface that consolidates multiple diffusion analysis methods ranging from standard ADC mapping to advanced Bayesian inference into a unified, practical workflow. This capability is particularly important for clinical applications such as renal transplantation, where the precise separation of perfusion and diffusion components is crucial for early assessment of allograft dysfunction and rejection. This tool offers a robust alternative to rigid commercial software, enabling researchers to perform comparative analysis using non-linear least squares, segmented, and probabilistic fitting algorithms on the same dataset. A current limitation of the prototype is the dependency on vendor-specific private tags for b-value extraction, which is currently optimized for Siemens systems (Tag 0x0019, 100C). Consequently, a primary focus for future work is the generalization of the DICOM parsing module to support diverse vendor formats (eg, GE, Philips) by integrating a broader range of public and private diffusion tags. By maintaining an open-source Python architecture, the software provides a flexible foundation for the medical physics community to extend compatibility and implement novel quantification techniques without the constraints of proprietary systems.



Volume : 24
Issue : 6
Pages : 93 - 99
DOI : 10.6002/ect.MESOT2025.O27


PDF VIEW [438] KB.
FULL PDF VIEW

From the 1Biomedical Engineering Department, Başkent University, Ankara, Türkiye, the 2Radiology Department, Başkent University, Ankara, Türkiye, and the 3General Surgery Department, Başkent University, Ankara, Türkiye
Acknowledgements: The authors have not received any funding or grants in support of the presented research or for the preparation of this work and have no declarations of potential conflicts of interest..
Corresponding author: Atakan Işık, Başkent University Engineering Faculty Building/ Biomedical Engineering Deparment/Section B/ Room B-310
E-mail: atakani@baskent.edu.tr