Published: 30 June 2020

Development environment construction of medical imaging software 3d slicer

Shuhan Jin1
Guoqing Yu2
Jingyu Song3
Jincai Chang4
Jianzhong Cui5
1, 2, 3, 4College of Sciences, North China University of Science and Technology, Tangshan, 063210, China
1, 2, 3, 43D Modeling and Application Innovation Laboratory, North China University of Technology, Tangshan, 063210, China
5Department of Neurosurgery, Tangshan Gongren Hospital, Tangshan, 063000, China
Corresponding Authors:
Jincai Chang, Jianzhong Cui
Views 514
Reads 361
Downloads 1020


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.

Development environment construction of medical imaging software 3d slicer

1. 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.

2. 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.

Fig. 1The Initialization window

The Initialization window

Fig. 2Making sketches

Making sketches

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:



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





2) Initialize the warehouse

gitinit (The command turns this directory into a repository that git can manage)



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 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.

Fig. 3Download the interface

Download the interface

3. Source code compilation and debugging

3.1. 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.

Fig. 4QT installation kit

QT installation kit

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.

3.2. 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.

Fig. 5CMAKE path configuration

CMAKE path configuration

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.

Fig. 6QT5 path added

QT5 path added

Where, Name is the Qt5 configuration to be searched for, Type is PATH, select PATH, and Value PATH selects the corresponding Qt5 PATH under the version of VS.

Click Configure to set VS version and build version (Win32/X64): according to your personal situation.

Fig. 7The source code to compile

The source code to compile

Click “Finish” to configure. Until the prompt is complete.

Fig. 8Compile error modification

Compile error modification

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.

3.3. 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.

Fig. 9The console calls Slicer

The console calls Slicer

Command line cd to E:/Slicersc/ slicer-build, execute slicer. exe--VisualStudio start VS [9]; VS open slicer.sln project file in this directory (note that you now have two slicer.sln files, this time open E:/Slicersc/ slicer-build/slicer. SLN).

Fig. 10Open the slicer.sln

Open the slicer.sln

Then set SlicerApp under app-slicer as the startup item in VS: F5 performs debugging. After debugging, open the Main. CXX can see intSlicerAppMain(intargc,char*argv[]) function, according to their own interests to learn or modify the source code.

The following build environments have been tested and recommended:

1) VS2015 (Visual Studio 14 2015 Win64).

Be sure to enable the installation of common tools for component programming language/Visual C++ / Visual C++ 2015 (this option is not enabled by default in some distributions). In some older VS2015 distributions, you need to install the cumulative service version of Microsoft Visual Studio 2015 Update 3 (KB3165756).

2) Qt 5.10 release.

3) CMAKE version should be 3.13.4 or above.

4. 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.

5. 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.


  • Zeng Wenye, Fang Luping, WanZhengjie International method of 3D Slicer for medical image processing platform. Computer System Application, Vol. 22, Issue 7, 2013, p. 7-11.
  • In the history of the most detailed git tutorial. Aidon – the east elder brother blog,
  • LiuJintao Design and Implementation of Team Code Quality Control System Based on Git Warehouse. Nanjing University, 2019.
  • NicoBruns 3D slicer: universal 3D visualization software. Der Unfallchirurg, Vol. 122, Issue 8, 2019, p. 662-663.
  • Ken Martin, HoffmanBill An open source approach to developing software in a small organization. IEEE Software, Vol. 24, Issue 1, 2007, p. 46-53.
  • Ren Zhengwei, Song Xiaomei, Huang Suzhen Reading and display of DICOM files based on ITK, VTK, Qt. Foreign Electronic Measurement Technology, Vol. 36, Issue 11, 2017, p. 62-66.
  • Nullsoft Scriptable Install System. NSIS Team, 2019.
  • Fedorov A., Beichel R., Kalpathy Cramer J., Finet J., Fillion Robin J.-C., Pujol S., Bauer C., Jennings D., Fennessy F. M., Sonka M., Buatti J., Aylward S. R., Miller J. V., Pieper S., Kikinis R. 3D slicer as an image computing platform for the quantitative imaging network. Magnetic Resonance Imaging, Vol. 30, Issue 9, 2012, p. 1323-1341.
  • MiaoYurun Research and Implementation of QT Based Graphical User Interface. Southeast University, 2015.
  • Kikinis R., Pieper S. D., Vosburgh K. 3D Slicer: a platform for subject-specific image analysis, visualization, and clinical support. Intraoperative Imaging Image-Guided Therapy, Vol. 3, Issue 19, 2014, p. 277-289.

Cited by

About this article

23 December 2019
14 April 2020
30 June 2020
medical imaging software
3D slicer
environment configuration

This work was supported by the National Science Foundation of China (51674121, 61702184), Tangshan Innovation Team Project (18130209B, 18130210B), the Hebei Key Laboratory of Science and Application, Research and practice project of higher education teaching reform in Hebei Province (2017GJJG111) and Ministry of education production university cooperation education project (201802305012).