CystAnalyser: A new software tool for the automatic detection and quantification of cysts in Polycystic Kidney and Liver Disease, and other cystic disorders

The Polycystic Kidney Disease (PKD) is characterized by progressive renal cyst development and other extrarenal manifestation including Polycystic Liver Disease (PLD). Phenotypical characterization of animal models mimicking human diseases are commonly used, in order to, study new molecular mechanisms and identify new therapeutic approaches. The main biomarker of disease progression is total volume of kidney and liver in both human and mouse, which correlates with organ function. For this reason, the estimation of the number and area of the tissue occupied by cysts, is critical for the understanding of physiological mechanisms underlying the disease. In this regard, cystic index is a robust parameter commonly used to quantify the severity of the disease. To date, the vast majority of biomedical researchers use ImageJ as a software tool to estimate the cystic index by quantifying the cystic areas of histological images after thresholding. This tool has imitations of being inaccurate, largely due to incorrectly identifying non-cystic regions. We have developed a new software, named CystAnalyser (register by Universidade de Santiago de Compostela–USC, and Fundación Investigación Sanitaria de Santiago—FIDIS), that combines automatic image processing with a graphical user friendly interface that allows investigators to oversee and easily correct the image processing before quantification. CystAnalyser was able to generate a cystic profile including cystic index, number of cysts and cyst size. In order to test the CystAnalyser software, 795 cystic kidney, and liver histological images were analyzed. Using CystAnalyser there were no differences calculating cystic index automatically versus user input, except in specific circumstances where it was necessary for the user to distinguish between mildly cystic from non-cystic regions. The sensitivity and specificity of the number of cysts detected by the automatic quantification depends on the type of organ and cystic severity, with values 76.84–78.59% and 76.96–89.66% for the kidney and 87.29–93.80% and 63.42–86.07% for the liver. CystAnalyser, in addition, provides a new tool for estimating the number of cysts and a more specific measure of the cystic index than ImageJ. This study proposes CystAnalyser is a new robust and freely downloadable software tool for analyzing the severity of disease by quantifying histological images of cystic organs for routine biomedical research. CystAnalyser can be downloaded from https://citius.usc.es/transferencia/software/cystanalyser (for Windows and Linux) for research purposes.

(PKD) and Polycystic Liver Disease (PLD) fields. CystAnalyser is based on automatic digital analysis, also it provides a Graphical User Interface (GUI) to review the cyst recognition (if the user considers it appropriate) and provides a more reliable result. It is multiplatform software written is C/C++ programming language. That program allows obtaining the Cystic Index, which refers to the cumulative area of cysts within the total area of the kidney or liver, the number of cysts and a profile of cysts according size. CystAnalyser was developed in a scientific collaboration by the research groups: Nephrology Lab of the Instituto de Investigación Sanitaria de Santiago de Compostela (IDIS) 1 and Centro de Investigación en Tecnoloxías da Información (CITIUS) 2 of University of Santiago de Compostela. The present user manual is organized as follows: section 2 describes the installation steps; section 4 describes how to run the Graphical User Interface (GUI) of CystAnalyser. Section 5 describes the configuracion of the work preferences in CystAnalyser. Sections 6, 7 and 8 label File, Edit and View menus, respectively. In Section 9 you can find information about how analyses the results obtained with CystAnalyser. Finally, Section 35 refers to Menu Help.

Installing CystAnalyser in Operating System Windows
The installation process is the common process to install programs. First, do double click on the file setupCystAnalyzer.exe. Then, it is open a window asking us about to allow to install a foreing program setupCystAnalyzer.exe on your computer. After clicking "Yes", the window of Figure 1 is open. If you click "Next", the program go on intalling. The next intallation window is shown in Figure 2 to choose the intallation 1 http://www.idisantiago.es/ 2 http://citius.usc.es/ folder. By default, this directory is CystAnalyzer (we recomend do not change the directory). Afterwards, click the button "Next" to go to the window shown in Figure 3.  Figure 3 asks if you want to create a desktop icon in the desktop. We recomend you activate the check box because it will be faster the access to CystAnalyser. Then, you click on the button "Next" to go to the next window ( Figure 4). It is a window to confirm if you want to install CystAnalyser (clicking with the mouse on button "Install") or cancel the installation (clicking the button "Cancel").
After starting the intallation process, it will pop up a dialog showing the intallation process, as it can be seen in the Figure 5. This process can take a few seconds. If you click on the button "Cancel", the installation process will be cancelled. When the intallation process finished, it will be shown the window of Figure 6. In this window, you click the "Finish" button to finish the installation process. If the check box Lunch CystAnalyser is marked, CystAnalyser will be run. Otherwise, CystAnalyser will not run now, but you can run every time   sudo dpkg -i cystanalyser_1.0_all.deb and the system asks you by the administrator password. You need to add dependencies typing the following command:

apt-get install -f
After typing the above command, dependencies will be added to your machine and your Debian package (.deb) file will be installed. Then, you can run CystAnalyser using the following command: ./cystanalyser CystAnalyser can be removed from the computer using the command:  3. View: visibilize or hide the processing panel.

4.
Analysis: provides functionalities to calculate the results, as Cystic Index, number of cysts and a histogram with the profile of cysts according to size (pixels or micrometers) to many images jointly.

5.
Help: the help funcionality is not complete.
The toolbar is a fast access to the main funcionality of CystAnalyser, which contains the following icons (if the mouse is put on the icon, a pup up message shown the funcionality of the icon is open): 1. Reset: (first icon) clear all the objects drawn on the image. 7. Draw with point: (seventh icon) activate the draw of regions (in our case cyst) tool. While this button is pressed, the user draws a cyst marking points with the left button of the mouse and finishs the outline of the cyst when the user click the midle button of the mouse.
8. Draw freehand: (eighth icon) activate the draw freehand regions tool. When this button is pressed, the user can draw a freehand region pressing the left button of mouse and keeping it pressed while you are drawing the region. When you release the mouse button, the region is finished.
9. Select: (nineth icon) when this button is activate, you can select an object drawn on the image. The object is selected clicking into the object with the left button of the mouse. To select more than one object, keep the key Ctrl or key "Control" while selecting objects.  In the following sections, the funcionality of the Graphical User Interface (GUI) of CystAnalyser will be described. Section 5 describes the configuracion of the work preferences in CystAnalyser.

Set preferences
The submenus of the File menu from the menu bar is shown in the Figure 9. As you can see in this Figure, you can set the preferences (submenus preferences), reset the default preferences if the preferences have been set in a previous sesion, and load the preferences from an external XML file.
Selecting the submenu "Preferences" of menu File, the window shown in Figure 10   1. Calibration: it is the number of micrometers per pixel in the image. it allows to set the units to measure the objects (cysts in our case).
2. Diameters: it allows to put the minimum and maximum size of the cysts in the images. These parameters can be set in pixels (if the calibration is not set) or micras (if the calibration is set).
3. Work directories: it allows to set the default directories of the images, XML files and CSV files to use CystAnalyser.
4. Draw preferences: it allows to set the colour and line width preferences to shown the cysts overlapped to the images.
5. Set or change the configuracion: the buttons Ok, Cancel, Save and Save As at the bottom of Figure 10 set, cancel or save the configuration.

Calibration
The top of Figure 10 shown a check box after the label Set Calibration. This check mark assures that the Calibration real value has been added, if it is nonchecked, then the calibration is considered in pixels. After the label Value, and if the check box of calibration is marked, you can set the number of micrometers per pixel in the image (press the "Enter" key after put the value).
The calibration value are fixed by the digitalization process, depending on the magnification used in the microscope and the spatial resolution of the digital camera connected to it. The right panel of Figure 10 shows the left panel after activating the calibration and put its value to 2.1 micras per pixel. As it can be seen comparing both panels in Figure 10, when the check box of calibration is modified, the units and values of diameters change.

Diameters
CystAnalyser provides more versatility allowing the user to choose the minimum and maximum diameters of the cysts to recognize in the images. These parameters can be set after the labels Min. Diameter and Max. Diameter respectively, puting the values of minimum and maximum diameter (in micras if the calibration is active and in pixels if the check box of calibration is not marked). After set the diameters, you must press the "Intro" key to update the value in CystAnalyser.

Work directories
After the labels Images Folder, XML Folder and CSV Folder in Figure 10, there are their correspondent entry to visualize the default directory to store the images, XML files and CSV files respectively. After each entry there is a button with three points. Clicking this button open the file chooser dialog of Figure 11 to choose the work directory for images, XML files and CSV files respectively ( Figure 12 shown the preferences window after modifying the work directories).

Draw preferences
After selecting the work preferences in Figure 12, you can change the colour and line width to draw the cysts overlapped to the image. Clicking with the mouse the blue button after the label FreeHand opens the colour chooser dialog  shown in Figure 13. Selecting a colour in this window and pressing the button "Select", you change the drawing colour to freehand objects (cysts). Clicking in the button after the colour button, a drop-down list is open to select the line width to the freehand object.

Set or change the configuration
The four buttons Ok, Cancel, Save and Save As at the bottom of Figure 10 have the following funcionalities: 1. Clicking the button Ok, you set these preferences to the present work session. 2. Clicking the button Cancel, you cancel the operation of setting the preferences and the preferences will not be set.
3. Clicking the button Save, you set these preferences to the present work session and to another work session in the future.
4. Clicking the button Save As, you set these preferences to the present work session and CystAnalyser allows to store these preferences in a XML file, which can be loaded every time using the submenu "Load preferences" of menu File.

File menu
The File menu is within the menu bar (see Figure 9). The items available within this menu are: Open Image, Open Image and XML, Open XML, Save XML, Export CSV, Preferences, Reset preferences, Load Preferences and Exit. The Exit menu or the X button in the top-right side of window quit CystAnalyser. CystAnalyser work with three types of files: image files, XML (eXtensible Markup Language) and CSV (Comma-Separated Values) files. The image formats supported are the most frequently used like GIF, TIF, PNG, BMP, PPM, JPG, etc. There is one XML file per image, which saves the contours of the cysts, in order to allow that this analysis can be loaded into the program in other intant of time. The CVS file exports the statistical information of the quantitave analysis of the image. The Open Image submenu or the second button of the toolbar opens the file chooser dialog of Figure 14. The directory open is the one set in the configuration of the preferences (see the section 5). Choose the path to the image and click the button Open in the bottom of the window to load the image in CystAnalyser. Take care that the image path is not biggest than 256 characters or the image path contains rare symbols, because Cystanalyser could not work correctly. Figure 15 shows an image loaded in CystAnalyser with the cysts outline overlapped. When an image is loaded, the lateral panel is open and in the  bottom of the main window appear a state bar with the name of image file and its size. If the image was analysed in other intant and the XML file was stored, you can load this XML file and overlapp to the image selecting the submenu Open XML. This operation opens a file chooser dialog to choose the XML file (see the Figure 16) and overlapp the cysts contours to the image, as can be seen in Figure 15. The user must select the right XML file for each image, CystAnalyser does not check if this XML file corresponds to a specific image file.
The above process can be done in one step with the submenu Open Image and XML, which open a file chooser dialog, as in Figure 14, to choose the image to load and CystAnalyser checks in the XML path set in the preferences if there  is a XML file with the same name and extension xml. In this case, CystAnalyser opens this XML file and overlapps its content over the image loaded.
Once the cysts contours have been drawn on the image (automatically or manually), the submenu Export CSV opens the file chooser dialog of Figure 17. You set a file name (by default it is used the name of image with the extension CSV) and the program stores the statistical analysis of the image in that file and the CSV directory selected in the preferences. The information stored in the CSV file are: image path, number of cysts, calibration used, the diameter and area of all cysts (by default in pixels and in micras if the calibration is active), the cystic index and, finally, the profile of the cysts in the image (number of cysts in each size interval). The information of the CSV file can be loaded in a spreadsheet as LibreOffice Calc 3 , as it can be seen in Figure 18. 7 Edit menu Figure 19 shows the content of Edit menu, which is in the menu bar. The items available within this menu are also available in the toolbar (see section 4). They are: Undo (fiveth icon in the toolbar), Redo (sixth icon in the toolbar), Fit Image (third icon in the toolbar) and Original Size (fourth icon in the toolbar).  Figure 20). Keeping this zoom, you can move to another part of the image by two methods: 1) pressing simultaneously the right buttons of the mouse and move the mouse to displace the visible area; and 2) press the left mouse button on the blue square in the icon image of the lateral panel and move it. Both the visible area in the window image and the icon image of lateral panel are synchronized. As can be seen, the overlays of the image are zoomed with the image.   do the following steps: 1) click on the Rule button (the button remains activated); 2) draw a line on the image window pressing the left mouse button and when you move the mouse, with the left mouse button pressed, the line is drawing; and 3) when you release the left mouse button, the Rule button will become desactivated and the length of the line is put in the entry widget (this value does not appear if the minimum diameter is superior than maximum diameter or the maximum diameter is lower than the minimum one).

View menu or lateral panel
3. Type of image (fiveth and sixth lines): the sixth line contains two radio buttons with the labels Liver and Kidney to select the type of image you are processing. This fact is due to the automatic cyst recognition algorithm is specific of the type of image used. Click on a radio button to select one type of image. The type of image selected does not change until the user modifies it.
4. Automatic Cyst Recognition (seventh line): this line only has a Run button to automatically process the image (with the preferences set) and show on the image window the cysts recognized by the computer overlapped on the image. Figure 22 shows the result of automatically processing a typical histological image of cystic kidney.

5.
Supervised post-processing: in this block, there are some tools to help the user to supervise the recognition results of the automatic algorithms. These tools are detailled in the section 8.1.
6. Visualization of results: this block includes the following funcionality: 1) press the button Show Table to  8.1 Graphical tools to supervise the cyst recognition.
Once the image was automatically processed using the button Run (after the label Automatic cyst recognition of the lateral panel), the block of funcionality labeled as Supervised post-processing in the lateral panel allows to review the automatic cyst recognition in a friendly and graphical way. The funcionalities are: 1. Removed inner cyst: remove the cysts, which fall into a cyst manually drawn. This operation is done when the user clicks the button Run after the label Remove inner cyst. Figure 23 show an example of this operation: the upper panel show the status before the user clicks that button and the lower panel shows the results of this action. Figure 23: Remove inner cyst tool of the lateral panel to remove the cysts, which fall into manually drawn cysts.
2. Add smaller cyst: to automatically recognize the smallest cysts in the image. When you click the button Run after the label Add smaller cyst, CystAnalyser provides the smallest cysts. Figure 24 shows an example of this tool: the upper panel shows the state before using this tool and the lower panel shows the results, in which some of the smallest cysts were added. This operation can be undo and redo using the Undo and Redo buttons after the label Add smaller cyst.
3. Select cyst: this label encloses operations to be applyed on one or some selected cysts. The operations, you can apply, are: 1) split one selected cysts into two cysts (button Split); 2) merge some selected cysts into one cyst (button Merge); and 3) complete one selected cyst with an arc (button Complete). To select one cyst, activate the button Select (nineth button) in the tool bar and click with the left button of the mouse into the cyst, you want to select. To select more than one cyst, repeat the process keeping the Control key pressed. To do the split operation, you must select the cyst, press the button Split (this button will be activated), draw an arc on the image splitting the selected cyst, and, when you finished the drawing of the arc, the Split button will be desactivated and the selected cyst will be divided into two cysts. Figure 25 shows two images, representing the state before and after the split operation.
To do the merge operation, you must select the set of cysts you want to merge and click the button Merge in the lateral panel. After that, the merged cysts will not be visible and it will appear the new cyst. Figure  26 shows two images representing the state before and after the merge operation.
To do the complete operation, you must select the cyst, which is incomplete in the image, and click the button Complete in the lateral panel. This button will be activated while the user is drawing an arc on the image to complete the truth outline of the selected cyst. When the user release the left button of the mouse, the selected cyst will be completed using the arc and the Complete button will be desactivated. The three images of the Figure 27 show this process.

Visualization of results.
Pressing the button Show Table of the lateral panel open a table at the bottom of window (see Figure 28) to show the diameter and the area of the cysts overlapped in the image window. The window image and this table are sincronized. So, if you select a cyst on the image (the objects in the image window can be selected using the nineth icon of tool bar), the row of the table containing its diameter and area will be activated, as it can be seen in the lower panel of Figure 28. In the same way, if you select a row in the table, its corresponding cyst in the image window will be appear as selected, as it can be seen in the  upper panel of Figure 28. The information shown in this table can be exported to a CSV file, as it has been described in the section 6.
9 Menu Analysis Figure 29 shows the content of Analysis menu, which is in the menu bar. The only item available is XML File, which opens the pop up window of figure  30. Manay times the biomedical researchers want to acumulate the quantitative results of various images together. For this purpose, you must do the following steps: 1) process individually each image; 2) save the recognition results (outline of the cysts of each image) in a XML file; and 3) run the submenu XML File of menu Analysis to calculate the jointly quantitative results. The first line of window of figure 30, labelled as XML Folder, allows to choose the directory of the XML files (by default, it is the XML directory set in the preferences, but it can be changed clicking the three points button). The second line, labelled as Select XML File, have the button Click to select files.  Clicking this button, the file chooser dialog of figure 31 is open to choose the XML files used to compute the statistics results. As all file chooser dialogs, a file is selected if you click on the file name with the left button mouse. To choose consecutive files, you click the first file and, keeping the key Alt pressed, you click the last one. To choose various files, you click files names keeping the key Ctrl pressed. Once the XML files were chosen, click the Select button in the bottom of the window. The files selected will be appeared in the Figure 30   To complete the parameters used in the joined analysis of Figure 32 (lines under the label Configuration to calculate results) , you can select the calibration and histogram step. As in the preferences configuration (section 5), you can choose to activate or not activate the calibration marking the check box after the label Set Calibration. If calibration is activated, you can set its value in the entry widget after the label Value. The histogram funcionality allows to create cysts profiles, i. e. count the number of cysts in each range of diameters. So, for histogram, you can set to calculate or not calculate the histogram marking the check box after the label Histogram. If the histogram calculation is set, the step used can be set in the entry widget after the label Step. The value of this step will be considered in pixels, if the calibration is not activated, and in micrometers if the calibration is activated.
After filling all the information in the window of Figure 33, you can choose the following operations: 1) cancel this operation pressing the Close button in the bottom; or 2) press the Export CSV to store the joined statistical results

Menu Help
The Help menu is within the menu bar (see Figure 35) with the submenus User Manual and About Us. The submenu About Us pop-ups a window with a decription of CystAnalyser and informations about thanks and licence (see Figure 36).