{"id":19474336,"url":"https://github.com/phernst/ctl","last_synced_at":"2025-07-02T03:35:32.023Z","repository":{"id":171453448,"uuid":"226919252","full_name":"phernst/ctl","owner":"phernst","description":"The Computed Tomography Library (CTL) is a modularized C++ toolkit for simulations of X-ray computed tomography. (Fork)","archived":false,"fork":false,"pushed_at":"2020-05-11T15:58:35.000Z","size":4627,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-25T15:48:49.167Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://gitlab.com/tpfeiffe/ctl","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/phernst.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-12-09T16:41:38.000Z","updated_at":"2020-05-11T15:59:00.000Z","dependencies_parsed_at":null,"dependency_job_id":"9e60a77a-16dc-4764-9a62-faf4e335805a","html_url":"https://github.com/phernst/ctl","commit_stats":null,"previous_names":["phernst/ctl"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/phernst/ctl","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phernst%2Fctl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phernst%2Fctl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phernst%2Fctl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phernst%2Fctl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phernst","download_url":"https://codeload.github.com/phernst/ctl/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phernst%2Fctl/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263070951,"owners_count":23409210,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-10T19:24:30.812Z","updated_at":"2025-07-02T03:35:31.997Z","avatar_url":"https://github.com/phernst.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"CTL - Computed Tomography Library\n=================================\n\n**Current version: 0.3.2**\n\nA C++11 toolkit for CT imaging with minimal dependencies.\n\nThis early release enables to simluate freely customizable cone-beam X-ray\nimaging setups.\nTypical settings like helical CT or C-arm CT with curved or flat panel\ndetector are included as well. Conversion of the geometric information to/from\nprojection matrices allowes to easily collaborate with other tools supporting \nthem.\n\nReference publication:  \nTim Pfeiffer, Robert Frysch, Richard N. K. Bismark, and Georg Rose\n\"CTL: modular open-source C++-library for CT-simulations\",\nProc. SPIE 11072,\n15th International Meeting on Fully Three-Dimensional Image Reconstruction in Radiology and Nuclear Medicine,\n110721L (28 May 2019);\n[doi:10.1117/12.2534517](https://doi.org/10.1117/12.2534517)\n\nFor further details, check\n[the documentation of the code.](https://www.forschungscampus-stimulate.de/ctl/)\n\nMoreover, you may find useful information in the\n[Wiki](https://gitlab.com/tpfeiffe/ctl/wikis/home),\nespecially if you want to contribute to the project as a developer.\n\nIn case you are looking for some Python bindings check out [PyCTL](https://github.com/phernst/pyctl) by Philipp Ernst.\n\nThe following installation guide has been tested with Kubuntu 18.04 LTS.  \nYou may also try a preconfigured Docker image. In this case, you can skip the \nfollowing three steps and go directly to *Use a Docker image*.\n\nInstall compiler and build tools (GCC, make, ...)\n---------------------------------------------------\n\n```console\nsudo apt install build-essential\n```\n\nInstall Qt\n----------\n\nThe [Qt Core module](https://doc.qt.io/qt-5/qtcore-index.html) is the only\nlibrary required for the main module\n\"[CTL core](https://gitlab.com/tpfeiffe/ctl/blob/master/modules/ctl.pri)\" of this\nproject.\n\n1. Qt libraries\n\n    ```console\n    sudo apt install qt5-default\n    ```\n    \n2. Qt3D (optional, for\n[3D GUI widgets](https://gitlab.com/tpfeiffe/ctl/blob/master/modules/submodules/gui_widgets_3d.pri))\n    \n    ```console\n    sudo apt install qt3d5-dev\n    ```\n    If you are on another platform, note that a Qt3D version is needed that \n    requires a Qt version \u003e= 5.9.\n3. QtCharts (optional, for [chart-based widgets](https://gitlab.com/tpfeiffe/ctl/blob/dev_v0.3.2/modules/submodules/gui_widgets_charts.pri))\n    ```console\n    sudo apt install libqt5charts5-dev\n    ```\n\nInstall OpenCL 1.1/1.2\n----------------------\n\nThis is an example how to set up\n[OpenCL](https://github.khronos.org/OpenCL-CLHPP/) for a NVIDIA GPU. OpenCL and\nits C++-API is required for the\n[CTL OCL](https://gitlab.com/tpfeiffe/ctl/blob/master/modules/ctl_ocl.pri)\nmodule.\n\n1. install official NVIDIA driver using Driver Manager\n(tested with driver version 390.48 + GTX1080 Ti) --\u003e reboot\n\n2. install Nvidia OpenCL development package\n\n    ```console\n    sudo apt install nvidia-opencl-dev\n    ```\n    For other vendors\n    ([AMD](https://linuxconfig.org/install-opencl-for-the-amdgpu-open-source-drivers-on-debian-and-ubuntu),\n    [Intel](https://software.intel.com/en-us/intel-opencl/download),\n    ...),  you need to search for an appropriate\n    package that provides you an OpenCL driver.\n    \n3. install clinfo (optional, for checking available OpenCL devices)\n\n    ```console\n    sudo apt install clinfo\n    ```\n    Then, you can just type\n    ```console\n    clinfo\n    ```\n    in order to get a summary of your OpenCL devices.\n    You can make sure that the device you intend to use appears in the list.\n\n4. install OpenCL headers (might be already there)\n\n    ```console\n    sudo apt install opencl-headers\n    ```\n\nNo matter what kind of OpenCL device you want to use, you should end up with a \n*libOpenCL.so* (usually symbolic link) in the library folder\n(/usr/lib/) that points to a valid ICD loader. The ICD loader should have been\ninstalled with your vendor driver. If this has not happend you will not be able\nto link against it (linker error when using `LIBS += -lOpenCL` in your qmake\nproject file). Then, you can install an ICD loader by your own, e.g. the package\n*mesa-opencl-icd*.\n\nIt might happen on some Debian platforms, that the *CL/cl.hpp* header is missing\neven when you have installed the 'opencl-headers' package. In this case, you can\nmanually download the header file from the\n[khronos group](https://www.khronos.org/registry/OpenCL/api/2.1/cl.hpp).\n\nUse a Docker image\n------------------\n\nInstead of installing the above libraries, you may also start directly by using\na Docker image.\nThere are two prepared Docker images that you can use as a development/testing\nenvironment:\n * `frysch/ubuntu:ocl-nvidia` for Nvidia GPUs\n * `frysch/ubuntu:ocl-intel` for Intel CPUs\n\n### Run a GUI example inside Docker\nGive Docker the rights to access the X-Server:\n```console\nxhost +local:docker\n```\nRun Docker in interactive mode (`-it`) and shared X11 socket (\n`-e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix` - required only for \nshowing GUIs):\n```console\ndocker run -it -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix frysch/ubuntu:ocl-intel bash\n```\nInside the Docker container run\n```console\ngit clone https://gitlab.com/tpfeiffe/ctl.git\ncd ctl/examples/simTool/\nqmake \u0026\u0026 make -j 4\n./bin/SimulationTool\n```\nin order to compile and run the GUI example \"SimulationTool\".\n\n\nFor further details about the Docker images, see\n[this Wiki page](https://gitlab.com/tpfeiffe/ctl/wikis/Docker-Images).\n\n\nDevelop your own C++ apps or modules\n====================================\n\nUse modules that you need\n-------------------------\n\nThe CTL provides several modules. According to your needs, you can select only a\nsubset of modules. Each module has a corresponding .pri file that you can\ninclude into your qmake project (.pro file) using the syntax\n`include(example_module.pri)` (see also the *examples* or *testing* folder).\n\nThe following modules are available:\n * ctl.pri: the core library and file IO\n * ctl_ocl.pri: OpenCL routines and OpenCL environment\n * ctl_qtgui.pri: widgets for visualization purposes\n * ctl_nlopt.pri: NLopt-dependent submodules; currently, Grangeat-based 2D/3D registration\n\n\nCompile a project\n-----------------\n\n```console\ncd /path/to/source/where/the/.pro/file/lives\nmkdir build\ncd build\nqmake ..\nmake\n```\n\nTeaser: Making projections\n--------------------------\n\nThe following example code uses a predefined C-arm system and a predefined\ntrajectory (a trajectory is a specific acquisition protocol) in order to\nproject a volume, which is read from a file. This serves to show how the CTL\nmay work out of the box. However, CT systems or acquisition protocols (or even\npreparations of single views) can be freely configured. Moreover, certain\nprojector extensions can \"decorate\" the used forward projector in order to\ninclude further geometric/physical/measuring effects.\n\n```cpp\n#include \"ctl.h\"\n#include \"ctl_ocl.h\"\n#include \u003cQCoreApplication\u003e\n#include \u003ciostream\u003e\n\nint main(int argc, char* argv[])\n{\n    QCoreApplication a(argc, argv);\n\n    try\n    {\n        // IO object (reads/writes basic types) with a certain IO type\n        // as a template argument - here for NRRD files\n        CTL::io::BaseTypeIO\u003cCTL::io::NrrdFileIO\u003e io;\n\n        // load volume\n        auto volume = io.readVolume\u003cfloat\u003e(\"path/to/volume.nrrd\");\n\n        // use of a predefined system from \"acquisition/systemblueprints.h\"\n        auto system = CTL::CTSystemBuilder::createFromBlueprint(CTL::blueprints::GenericCarmCT());\n\n        // create an acquisition setup\n        uint nbViews = 100;\n        CTL::AcquisitionSetup myCarmSetup(system, nbViews);\n        // add a predefined trajectory to the setup from \"acquisition/trajectories.h\"\n        double angleSpan = 200.0_deg; // floating-point literal _deg in \"mat/deg.h\" converts to rad\n        double sourceToIsocenter = 750.0; // mm is the standard unit for length dimensions\n        myCarmSetup.applyPreparationProtocol(CTL::protocols::WobbleTrajectory(angleSpan,\n                                                                              sourceToIsocenter));\n        if(!myCarmSetup.isValid())\n            return -1;\n\n        // configure a projector and project volume\n        CTL::OCL::RayCasterProjector myProjector;       // the projector (uses its default settings)\n        myProjector.configure(myCarmSetup);             // configure projector\n        auto projections = myProjector.project(volume); // project\n\n        // save projections\n        io.write(projections, \"path/to/projections.nrrd\");\n    }\n    catch(const std::exception\u0026 e)\n    {\n        std::cerr \u003c\u003c \"exception caught:\\n\" \u003c\u003c e.what() \u003c\u003c std::endl;\n        return -1;\n    }\n\n    std::cout \u003c\u003c \"end of program\" \u003c\u003c std::endl;\n    return 0;\n}\n\n/*\n * NOTE: the project file (.pro) needs to include the following modules to be\n * able to compile this example program:\n *\n *  include(path/to/ctl.pri)\n *  include(path/to/ctl_ocl.pri)\n */\n ```\n A corresponding qmake project for this example can be found in\n [examples/readme-example](https://gitlab.com/tpfeiffe/ctl/tree/master/examples/readme-example).\n\n--------------\n\nStatistics on the master branch:\n\n![](https://tokei.rs/b1/GitLab/tpfeiffe/ctl?category=code)\n![](https://tokei.rs/b1/GitLab/tpfeiffe/ctl?category=comments)\n![](https://tokei.rs/b1/GitLab/tpfeiffe/ctl?category=files)\n\nFor more details click [this link](https://rf.p7.de/apps/cms_pico/pico/ctlstat/).\n\n--------------\n\nIf you have any problems or questions regarding the CTL, please contact us:  \n\u003csw4g.production@gmail.com\u003e.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphernst%2Fctl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphernst%2Fctl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphernst%2Fctl/lists"}