Subsegmentation of the Kidney in Experimental MR Images Using Morphology-Based Regions-of-Interest or Multiple-Layer Concentric Objects

Functional renal MRI promises access to a wide range of physiologically relevant parameters such as blood oxygenation, perfusion, tissue microstructure, pH, and sodium concentration. For quantitative comparison of results, representative values must be extracted from the parametric maps obtained with these different MRI techniques. To improve reproducibility of results this should be done based on regions-of-interest (ROIs) that are clearly and objectively defined. Semiautomated subsegmentation of the kidney in magnetic resonance images represents a simple but very valuable approach for the quantitative analysis of imaging parameters in multiple ROIs that are associated with specific anatomic locations. Thereby, it facilitates comparing MR parameters between different kidney regions, as well as tracking changes over time. Here we provide detailed step-by-step instructions for two recently developed subsegmentation techniques that are suitable for kidneys of small rodents: i) the placement of ROIs in cortex, outer and the inner medulla based on typical kidney morphology and ii) the division of the kidney into concentrically oriented layers. This chapter is based upon work from the COST Action PARENCHIMA, a community-driven network funded by the European Cooperation in Science and Technology (COST) program of the European Union, which aims to improve the reproducibility and standardization of renal MRI biomarkers.


Introduction
The potential of magnetic resonance imaging (MRI) for the diagnosis and monitoring of renal disease remains largely untapped. Functional renal MRI promises access to a wide range of (patho)physiologically relevant parameters via techniques such as blood oxygenation sensitive T 2 *-mapping (aka blood oxygenation leveldependent MRI, BOLD), perfusion measurement by arterial spin labeling (ASL), and diffusion weighted imaging (DWI). Insights into microstructural changes can be obtained with DWI and T 1 -mapping, for example to probe for renal fibrosis. Emerging techniques including pH-mapping via chemical exchange saturation transfer (CEST) and sodium ( 23 Na) imaging complement the renal MRI portfolio. For quantitative comparison of results, representative values must be extracted from the parametric maps obtained with any of these MRI techniques. To improve reproducibility of results this should be done based on regions-of-interest (ROIs) that are clearly and objectively defined.
Semiautomated subsegmentation of the kidney in MRI represents a simple but very valuable approach for the quantitative analysis of imaging parameters in multiple ROIs that are associated with specific anatomic locations, for example, the distinct layers: cortex, outer medulla, and inner medulla. Thereby, it facilitates comparing MR parameters between different kidney regions, as well as tracking changes over time. Here we use the term subsegmentation in order to make a clear distinction between segmenting the kidney into smaller subregions and the identification of the kidney organ borders within an image, for which commonly the term segmentation is used.
In this chapter we provide detailed step-by-step instructions for two recently proposed subsegmentation techniques [1,2], which are suitable for kidneys of small rodents: (1) the placement of ROIs in cortex, outer and the inner medulla based on typical kidney morphology (used in [1,[3][4][5][6][7][8]) and (2) the division of the kidney into concentrically oriented layers (used in [2,[9][10][11][12][13]). They work independent of the actual image contrasts or parameter map values and hence are well suited for a wide range of MRI mapping techniques. Both techniques allow for the exclusion of one or several regions in the kidney from the analysis, for example regions that show obvious image artefacts. Changes in kidney size are accommodated for by both techniques, but results should be treated with due caution if the relative sizes of the renal layers are significantly different from naive healthy kidneys or change throughout the experiment.
The first method described here is the Segmentation of Morphology-Based Renal Regions-of-Interest (SOMBRERO) [1]. Quantitative histomorphological data on the dimensions of the renal layers were obtained from a number of freshly excised kidneys of adult male rats, where anatomical structures were identified to be distributed in certain proportions. The percentages referring to the corresponding locations exclude the rather broad (and in case of the cortical-medullary border zone undulating) transition regions among the layers that are prone to partial volume effects. The percentages are adapted to MRI images by determining a standardized location, length, width and angle of the kidney in the image. Subsequently, ROIs at anatomical locations such as the cortex, outer medulla, and inner medulla are returned automatically in form of masks. These masks can then easily be applied to the user's parameter maps.
The strength of this technique is that it creates ROIs whose positions have been carefully chosen to provide representative values for the renal cortex, outer medulla and inner medulla, leaving a generous "buffer zone" at the transition regions between the renal layers. Also, access to five (or three) ROIs in each layer allow assessment of inter-layer and intra-layer variability. Differences between the parameters in the three renal layers can be expressed as ratios, such as T 2 *(cortex)/T 2 *(outer medulla). The transition regions between the renal layers are not accessible with this approach at present, but such a feature could be included without difficulty in the future, even by the user. ROI locations have been defined for rat kidneys in coronal view (with respect to the kidney). However, this method is in principle applicable to mouse and rat kidneys in axial, sagittal, and coronal view. An extension to other orientations or mice would only require some additional careful morphometric measurements to define the relative ROI positions.
The second technique is the multiple-layer concentric objects segmentation (MLCO; for human MRI proposed as 12-layer concentric objects, TLCO) [2,9]. A series of concentrically oriented layers is generated after a manual retracing of the outline of the kidney in the respective MR image. The desired number of concentric objects (COs) can be freely chosen by the user, although most publications have used twelve layers in humans thus far.
This technique was developed for human kidney MRI; although the COs do not refer to specific anatomic locations, they approximately reflect the layered structure of the kidney through their concentric nature. This makes it suited for MRI of rodent kidneys, whose simpler anatomic structure is better represented by the concentric layers than that of the human kidney. While the outermost and innermost COs are straightforward to interpret and are generally considered as a proxy of respectively cortex and medulla, a clear association of the intermediate concentric objects with the renal layers remains challenging, in particular, because the broad transition zones and, thereby, probable partial volume effects are neglected. Differences between the parameters in the three renal layers can only be indirectly expressed by the slope of the curve when plotting the COs' mean values against their position. This technique is applicable to mouse and rat kidneys in axial, sagittal, and coronal view (with respect to the kidney). One of its strengths is its applicability to human kidneys. A direct comparison between human results and those from rodent kidneys would, however, require a carefully calibrated conversion, due to the morphological differences.
Notwithstanding their limitations, both kidney subsegmentation techniques are very valuable semiautomated tools for the quantitative analysis of imaging parameters, specifically for comparing MR parameters between groups, between different kidney regions and monitoring changes over time. Use of these objectively defined ROIs (rather than manually drawn ROIs) should help to improve reproducibility and comparability of results in future studies.
This chapter is part of the book Pohlmann A, Niendorf T (eds) (2020) Preclinical MRI of the Kidney-Methods and Protocols. Springer, New York.

Essential Tools
The SOMBRERO method is provided in Python (3.6) programming language. It has been implemented and tested using the following software, which is available for macOS 10.14.5 (used for development), Windows and Linux operating systems.

Toolboxes
The provided software for SOMBRERO requires the installation of the following packages: numpy, matplotlib, cv2, math, pydicom, os, and pickle. These can be conveniently installed one-by-one through the Anaconda Navigator for Windows. For Linux or MacOS the following line in the terminal will install all them at once: Common MRI imaging planes are sagittal, coronal, and axial slices as displayed in Fig. 1. For the sake of this tutorial we will focus on coronal slices. Other imaging planes are possible for these segmentations as well (see Note 1).

Input Requirements
In this chapter, all input files are assumed to be Dicoms. However, any way to import an image as a matrix to Matlab or NumPy array to Python will work equivalently.

Segmentation of Morphology-Based Renal
Regions-of-Interest (SOMBRERO)

Settings
In order to display interactive plots, make sure your graphics backend is set on "automatic." This can be looked up in Preferences > IPython console > Graphics > Graphics backend.

Loading Images
1. Open the script roirect.py, which is executed cell-by-cell. Running a cell can be done by a button or by pressing CTRL + ENTER.
2. The images are loaded by the line: Fig. 1 Typical MR imaging planes and their resulting kidney shapes. The coronal, axial, and sagittal planes do not correspond to the scanner coordinate system, but instead are defined with respect to the double-oblique spatial orientation of the kidney. "C" stands for crescent and "D" doughnut in the script. Modify 'EnIm1.dcm' to be the path to your dicom file. In this case, the file is located in the same directory as the script. Therefore the filename is sufficient. 2. Drag on the image to draw a new rectangle (Fig. 2a).
3. Use the edge markers to adjust the height and width of the rectangle 4. Shift the rectangle using the central marker. 6. Press ENTER to end the adjustments and proceed.
2. Mark two points marking the end of the kidney on the black diagonal lines.
3. The resulting image should look like Fig. 2c).

Generation of Mask for Imaging Series
1. Execute the next section to transform the morphologic ROIs back to their locations in the original image (Fig. 2d).
2. Execute the next section to generate and visualize the variable roimask, which contains numbered masks for each ROI (Fig. 2e).

Saving Mask
1. Generate a path to the file by connecting the path (path ¼" and filename¼1 will save the file 1.pickle in the current folder).

Multilayer Concentric Objects (MLCO) Segmentation
Given the character of in-house developed programs, the MLCO toolbox allows the user the freedom and obligation to specify all details exactly. This function plots the first image in the image stack. If you would like to display the mean of all images. The file has to be opened and modified. Line 41 has to be modified from imagesc(argIm(:,:,curImNum)); to imagesc(mean(argIm(:,:,:),3)) 7. You can navigate through the images with the up and down arrow of your keyboard.

Defining the Number of Layers
In order to realize the concentric object technique, you have to choose a mask-number, which is the number of masks that will patch the chosen segmented area of you images. We also call this number the "number of layers" and we gave the name nLayers to this number in our script (see Note 2). If you want 9 layers, execute the line nLayers ¼ 9; The number of layers is inevitably limited by the image resolution. For experimental MR, 9 layers are recommended, whereas MR images of human kidneys were usually divided into 12 layers.

Segmenting the Area of Your Choice in the Image
In the following, the segmentation of "C"-shaped kidney slices from MR images will be described. This applies to coronal (Fig. 3) and axial (Fig. 4) slices as shown in Fig. 1

2.
A matlab figure appears displaying the first image stored in myImageList.
3. Navigate through the images with the up and down arrow of your keyboard.
4. Adjust the contrast by pressing on CTRL+D and fix the change by pressing on CTRL+F.
5. By clicking on the picture, you can manually segment the area of your choice (Fig. 3a).
6. Note that pressing the key ESC allows you to reset your selection. You can also zoom in the picture with the available Matlab tools. If any problem appears during this manual segmentation, pressing the key ESC often solves the problem! 7. Double click on the picture to close the polygon. You can still modify the position of its vertices interactively on the picture (Fig. 3a). 9. The contour of your segmentation will now appear in white (Fig. 3b). 10. Click near the white line at two different locations to indicate where the separation between the inner part and the outer part of the contour should occur. (Note: You do not need to press exactly on the white line because the program will choose the location on the white line that is the closest to your click.) (Fig. 3b) 11. The inner and outer part of the contour appear now in blue and red respectively (Fig. 3c).
12. You can now close the figure. The polygon of the outer contour is now stored in the variable myBound_ext and the polygon of the inner contour is now stored in myBound_int.
The same procedure can be applied for axial slices (Fig. 4). We describe in the following how to segment an area that contains a hole. The procedure is very similar to the previous one but the function conObjBound_D has to be used instead of conObj-Bound_C (C for crescent and D for doughnut).

First execute the line
[myBound_ext, myBound_int] ¼ conObjBound_D(myImageList); 2. As previously, segment manually the area of your choice (Fig. 5a) and double-click in the polygon to validate it. The contour of the polygon is now white and you can choose another closed polygon that has to lie inside the first one (Fig. 5b).
3. Once the second area is segmented, double-click inside it such that its polygon also appears in white (Fig. 5c).
4. As previously, you have to indicate which contour is the outer one and which contour is the inner one. For that purpose, click first near the outer contour and then click near the inner one. But the two location you click on must be approximately on the same radial line (as on Fig. 5d) to allow the algorithm to work correctly.
5. Once the two location are chosen, the outer and inner contour appear in red and blue respectively (Fig. 6a). This closes the step of the segmentation.  The last line results for example in Figs. 3d and 4d for the segmentation in the crescent shape and in Fig. 6b) for the segmentation in the doughnut shape.

Basic Script for Applying the Concentric Object Technique
Assuming the location of the images to be in the folder 'C:\Users \conObj\myGRE\', a basic script could look as follows:

Exclusion of Regions
This part describes multiple possibilities, which are optional for modifying the list. The only steps required are the first and the second. 6. Execute myExclusion.show(myImageList); to visualize all the exclusion mask that are in the object myExclusion (Fig. 6c).

Notes
1. The orientation of the kidney was assumed to be coronal throughout this chapter. However, the MLCO method does not refer to specific anatomical locations and can therefore be used in any of the cases displayed in Fig. 1. The SOMBRERO method can potentially be used in other planes as well but would need new percentage values from kidney histology as a reference.
2. For human renal MRI the use of 12 layers was proposed [2]. For rats and mice another number of layers may be more suitable. This also depends on the spatial resolution that can be achieved with that particular MRI technique and available hardware, because it would probably not make much sense to have layers with a width of less than one (noninterpolated) pixel. As a default we recommend to use the proposed number of 12 layers.
PARENCHIMA (renalmri.org) is a community-driven Action in the COST program of the European Union, which unites more than 200 experts in renal MRI from 30 countries with the aim to improve the reproducibility and standardization of renal MRI biomarkers.