Development environment construction of medical imaging software 3d slicer

3D Slicer is an open source software platform for medical image informatics, image processing and 3D visualization. Due to different medical functional requirements, a 3D slicer tailored to the doctor's needs is a great choice for people. However, the development of open source software has some difficulties in environment construction and other aspects. In this paper, after repeated attempts, literature review and research, GitHub download, CMAKE compilation and VS generation of the appropriate version were found. It can quickly build a 3D Slicer programming environment, which is of great significance for the subsequent modification and development of 3D Slicer.


Introduction
With the rapid development of the information age, open source software has also developed rapidly. However, it is extremely difficult to build the environment. So far, there is no fixed way to build the running environment of the software smoothly. While many people want to learn from open source software, they cannot. In this paper, 3D slicer [1] software as an example, a detailed discussion from the source code download, to CMAKE compilation, generation, and finally package the file. The method is simple and easy to understand, which provides convenience for the construction of software environment in the future.

Source code download
The source code is usually downloaded from an open source platform. In modern software development, GitHub, as a new open source service platform, has attracted more and more attention. In addition, GitHub is a global developer social network that attracts tens of millions of developers. In order to facilitate users to participate in the development of open source projects, GitHub platform provides Pull Request mechanism (hereinafter referred to as PR) and IssueTrackerSystem for users. The PR mechanism allows any user to participate in the development of any project by simply fork the target project into his or her own code base, complete the changes in his or her own code base, and merge his or her changes into the target code base by initiating a PR request. The IssueTrackerSystem is mainly used to record and track new functional requirements, development tasks and bugs.
In the open source community GitHub, every user can create a new Issue for a project where Issue tracking is enabled, thus allowing other users to indirectly participate in the development of the project. In addition, making open source service platform also has the function of social platform, users can focus on the platform or project you are interested in, then making platform regularly push users to its focus on the latest dynamic or project, by the user more quickly understand the project progress or involved in the project development.
To download open source software on GitHub, you first need to configure Git. Git is the world's most advanced distributed version control system, cloning a project is very fast. Every development can clone a local repository from the master, commit code to the local repository, view logs, create project branches, and so on even without the network.
First, install the software [2]. After the installation is complete, go to "Git" → "GitBash" in the start menu and pop a command line window to indicate successful installation of Git. The initialization window is shown in Fig. 1.  Then you need to set up the machine information, which will be used by all Git repositories on this machine. The code is as follows: $gitconfig--globaluser.name"username" $gitconfig--globaluser.emailemail@example.com The next step is to create the version library. The Repository is the git directory, which holds many things, the most important of which is the staging area called stage (or index), the first branch master that git automatically creates for us, and a pointer to the master called HEAD.
1) Create an empty directory $mkdirmymenu $cdmymenu $pwd /Users/hxk/mymenu 2) Initialize the warehouse gitinit (The command turns this directory into a repository that git can manage) $gitinit InitializedemptyGitrepositoryin/Users/hxk/mymenu/.git/ Then log on to GitHub, find the source code to download, copy the source code address, git command window input gitclone plus source code address, you can download the source code.
Here is a simple example [3]: First in the upper right corner of the https://github.com/github search want source code, find the source, choose Cloneordownload, the diagram Fig. 2.
Copy the download link, then open GitBash, type git clone after $, enter the url you want to download, and then press enter to download. The download process is shown in Fig. 3.

Configuration of environment
After downloading the source code, the source code should be compiled and generated, that is, the software development environment should be configured [4]. The first step is to download and install the software used for compiling, including QT, VS, Git, CMAKE, SVN and NSIS.
Qt [5] is a cross-platform C++ graphical user interface application development framework developed by Qt Company. It can develop both GUI and non-GUI programs, such as consoles and servers. 3D slicer USES QT for overall interface design, so QT is indispensable, if you want to further optimize on the basis of 3D slicer or do some specific development, smooth use of QT is necessary.
In the installation process of QT, installation components need to be selected, among which MSVC version is selected according to the required VS version, and VS version is recommended as VS2015.64bt. Other required components are shown in Fig. 4. The full name of VS is Microsoft Visual Studio. VS is a basically complete set of development tools that includes most of the tools needed for the entire software lifecycle, such as UML, code control, IDE, and so on. In the development of 3D slicer, VS+QT [6] programming method is needed. After the installation of VS, QT plug-ins need to be installed to meet the programming requirements of 3D slicer. Open the Tools in the VS runtime interface, select extensions and updates, and search QT Visual Studio Tools for download and installation.
Git is a free open source distributed version control system that can quickly and efficiently handle all projects from small to large. Git is easy to learn, takes up little space, and is lightning fast. It goes beyond configuration management tools like Subversion, CVS, Perforce, and ClearCase to features like cheap local branches, convenient staging areas, and multiple workflows. CMAKE is a cross-platform installation (compilation) tool that can describe the installation (compilation) of all platforms in simple statements. It can output various make file or project files and can test the C++ features supported by the compiler, similar to UNIX auto make.
SVN, which stands for subversion, is an open source version control system that is effectively managed using a branch management system. In short, it is used to develop the same project with multiple people, realize the Shared resources, and realize the ultimate centralized management. SVN clients need to be downloaded and installed, not downloaded and unzipped. Otherwise, CMAKE cannot find SVN when compiling.
The full name of NSIS is Null Soft Scriptable Install System, which is an open source Windows installation program. It provides installation, uninstallation, system Settings, file decompression and other functions. NSIS describes the behavior and logic of the installer through its scripting language. The NSIS scripting language is designed for applications such as installers.

Source code compilation
After the above software is prepared, the source code is compiled [8]. Use CMAKE GUI to generate VS project files, open the interface of CMAKE GUI, and set the relevant path: Where is the source code: sets the path to the Slicer source code just downloaded; Where to build the binaries: sets where to build the project and code store. Click "Add Entry" to increase the path of Qt5. For specific path, please refer to the path of Qt5 installation is shown in Fig. 5.    During compilation, various problems may occur, such as the missing: Patch_EXECUTABLE shown in the figure above, which is because the file named Patch_EXECUTABLE has not been found by CMAKE. After exploration, it is found that Patch_EXECUTABLE is a file in GIT and its path can be found. Add the path corresponding to Patch_EXECUTABLE in CMAKE. There may be other minor problems. According to the problem of red, change the corresponding path and continue Configure. Wait until Configure is complete to proceed to the next step.
Click Generate, and Slicer project file will be generated. Click Open Project or directly open slicer.sln in the directory of E:\Slicersc\ slicer-build. Right click All build to build, start the long build, note, this build must connect to the Internet, the process will download the relevant source code for compilation.

Source code debugging
After the complete compilation, use the shortcut key win +R on the desktop to enter the running window, enter CMD and click ok to open the administrator command window, and enter the following command according to the location of the generated code, as shown in Fig. 9.  2) Qt 5.10 release.
3) CMAKE version should be 3.13.4 or above.

The software package
Select release [10] when VS is generated, and then generate it. Find slicer. SLN file under slicer-build folder and open it.
If it is not adjusted to the release mode, the package will fail. When adjusting the mode, you can operate on the basis of the original file, which can save a lot of build time. However, you cannot adjust the installation interface.
Files such as the package can be found under slicer-build \_CPack_Packages\win-amd64\NSIS. The folder contains installation package and installation package unzipped files, which can be operated as needed. Advanced installer is an excellent package builder that can unpack files into advanced installer to optimize the installation interface or perform some software encryption.
When the package is complete, the software needs to be further encrypted for its security. Super Dog is an excellent hardware encryption software. The encryption of Super Dog is completed by two USB flash disks, one child and one father. The father is the permission conferring end, which can give the child the permission to use various software. For example, the number of times you use the software, time, etc.
The encrypted software can only be used normally in the case of the child flash disk with certain permissions. This encryption function is implemented by adding some Super Dog statements to the open source software. The function of these statements is to check whether the USB flash disk exists at the critical moment when the software is on and running, or to enter an encrypted password into the USB flash disk, and then read the password at the next time. If the USB flash disk does not exist, or cannot enter password, cannot read password, read password error, and so on, then terminate the software operation, so as to achieve the purpose of protecting the software.

Conclusions
Following the above process to build the environment, we can avoid detours and waste a lot of unnecessary time. Provide convenience for the secondary development of slicer. It is only when the tools the doctor uses are more appropriate that he exerts all his abilities. And the second development of the medical imaging software 3D slicer meets the needs of doctors in related fields. As is known to all, the most basic and difficult step of secondary development is environmental construction. Many people spend time and energy and cannot find their way. The author is also through long-term practice, many times, to find a convenient understanding, easy to operate the road. Recalling the hardships of construction, I hope that this article can help people with the same needs avoid detours and make some contribution to the secondary development of slicer. It can be built completely in accordance with the above process, which can quickly build the operating environment of 3D slicer and facilitate its secondary development. This is a relatively quick and simple method found in the continuous research, and it has practical significance.
Medical imaging software 3D slider secondary development of the more successful cases are: 1) Radiopharmaceutical Imaging and Dosimetry: RPTDose, a 3D Slicer-based application that streamlines and integrates quantitative imaging analysis and dose estimation techniques to guide and optimize the use of radiopharmaceutical therapy agents in clinical trials.
2) Xoran Technologies: Image-guided Platform for Deep Brain Stimulation Surgery. Now and in the future, there will be more other secondary development software that is more suitable for doctors, so a simple and efficient environmental approach is necessary as a basis for secondary development.
Jincai Chang received his Ph.D. degree in 2008 from Dalian University of technology, now he is Professor in North China University of Science and technology. His main research interests include theories and methods in mathematical modelling and scientific computation, numerical approximation and computational geometry, etc. In this paper Jincai Chang provide financial support and project management.
Jianzhong Cui received his Ph.D. degree from Hebei Medical University. Now he is currently the vice President and director of neurosurgery of Tangshan Workers' Hospital. His research interests include precise surgical diagnosis and treatment of cerebrovascular diseases and intracranial tumors, etc. In this paper Jianzhong Cui provide resources and supervise.