How fatilhan/vtk-medical-core works
Project type and purpose
• This is a native C++ dynamic‐link library (DLL) exposing a simple C‐style API.
• Its purpose is to encapsulate complex VTK‐based medical‐imaging pipelines (DICOM loading, 2D/3D rendering, window/level) behind a thin, language-agnostic facade, so that any GUI (WPF, Qt, Python, etc.) can call it.
File structure
• Top-level:
• CMakeLists.txt, CMakePresets.json – build configuration
• LICENSE, README.md – project metadata
• .gitignore, .gitattributes
• Source directory (OpTomoVTKImaging):
• OpTomoVTKImaging.cpp/.h – DLL entry points, extern "C" API definitions
• Model.cpp/.h – core engine: orchestrates VTK pipelines (loading, rendering, slicing, window/level)
• No frontend in this repo; this project is purely the backend library.
README for additional insights
• Architecture is explicitly described as a “layer” between visualization engine (VTK) and GUI clients.
• Key dependencies: VTK (9.x+), CMake, C++ compiler.
• Highlights a C‐style API boundary (extern "C") for language interoperability.
a. Main components:
• Frontend Application(s) (WPF/C#, Qt/C++, Python, etc.)
• DLL API Layer (extern "C" functions in OpTomoVTKImaging.cpp)
• Core Engine (Model.cpp):
– DICOM Loader
– 3D Volume Renderer
– 2D Slice Generator
– Window/Level Controller
• VTK Library (external dependency)
• Build System (CMake) – shown off to the side (optional)
b. Relationships and interactions:
• Frontend → calls → DLL API Layer
• API Layer → delegates → Core Engine modules
• Core Engine → invokes → VTK pipelines (VTK classes/objects)
• Data flows: File I/O (DICOM) → in-memory volume → processing → rendered output (buffers or callbacks back to frontend)
c. Architectural patterns and design principles:
• Layered (Facade) pattern: API layer hides VTK complexity
• Separation of concerns: API boundary, core logic, external lib
• Language-independent boundary (extern "C")
d. Key technologies & libraries:
• C++17+ (or C++14)
• VTK 9.x
• CMake for cross-platform build (Windows/.dll, Linux/.so, macOS/.dylib)