## 3 Methods of Automatic Renal Localization
### U-Net Assisted Initial Renal Localization  
Procedure generating mask using the technique described in Sections 3.1 and 3.2 requires the correct calculation of the starting search area \(Sm\). In Figure 3, the starting area has been marked as a square. For a different image size, different \(Sm\) size and shape are optimal. The experimental results show that the \(Sm\) is smaller and at the same time kidney is fully contained in \(Sm\), the better results of extended maxima transform we can generate. To meet these assumptions, a procedure of \(Sm\) calculation was implemented using the U-Net neural network. U-Net is a multi-layer network. In this type of network, the input layer consists of the dimensions of the input data [18]. In the learning process, images were cropped to the size of \(256\times 256\), considering the most common location of the kidneys. Input data were then normalized according to rule (2).  
\[x=\frac{x_{in}-x_{min}}{x_{max}-x_{min}} \tag{2}\]  
The diagram of the U-Net model used in the tests is presented in Figure 5.  
Figure 4: Example (**a**) Kidney mask of the \(Ct_{i}\), (**b**) kidney mask of the \(Ct_{i+1}\), (**c**) overlay of both masks (**d**) Result of the \(bitand\) operation. An exemplary search starting search area (\(Sm\)) is marked in green.  
Each layer is shown as a blue block and corresponds to a multi-channel representation of the output image of the previous layer. On the left side of the block, the size of the image representation (height \(\times\) width) is marked. The number of channels is shown above the block. White blocks correspond to the copied image representation from the deeper layer. Arrows indicate operations performed on images. The constructed model consists of the input layer (single-channel image), convolutional layers with the ReLU activation function, filter size \(3\times 3\), sampling layers with a maximum operation with a filter size of \(2\times 2\), layers of inverse weave with a filter size of \(2\times 2\), dropout layers, the operation of copying the output images from deeper layers, a convolution layer with an activation function, with a filter size of \(1\times 1\), the output layer: single-channel grayscale image.  
The output image of the model consists of values in the range \(\langle 0.1\rangle\), so to obtain a binary image, the prediction should be binarized using the threshold \(T\) (3):  
\[y=\left\{\frac{0,\ if\ y_{out}<T}{1,\ if\ y_{out}\geq T}\right. \tag{3}\]  
Finding the optimal value for the cut-off point \(T\) is a very difficult task. There is no single optimal value of \(T\) even for a single CT image. It is impossible to determine the common value of \(T\) for all slices. Many studies use techniques of dynamic determination of \(T\) based on techniques such as ROC analysis, Dice analysis, or based on precision and sensitivity parameters calculation [19; 20; 21]. In our study, the \(T\) threshold was selected to obtain the highest possible sensitivity. The output images obtained by the network are highly redundant. Finally, morphological operations are performed on the image: closing and dilatation with a 10 px disc. The area found this way is treated as the starting area \(Sm\) for the kidney detection algorithm described in Section 3.1.  
Figure 5: Diagram of the U-Net model used in the tests. The blue blocks represent a layer, on the left of each block the image size in each layer is marked. The number of image channels in the layer is placed above the block.