PACS System 0.1.0
PACS DICOM system library
Loading...
Searching...
No Matches
main.cpp
Go to the documentation of this file.
1
16#ifdef KCENON_USE_MODULES
17
18// Import the pacs module (replaces all header includes)
19import kcenon.pacs;
20
21#include <iostream>
22#include <string>
23
24int main(int argc, char* argv[]) {
25 std::cout << "=== PACS System C++20 Module Example ===\n\n";
26
27 // Demonstrate core module usage
28 std::cout << "1. Core Module Demo\n";
29 std::cout << "-------------------\n";
30
31 // Create DICOM tags using module-exported types
32 kcenon::pacs::core::dicom_tag patient_name_tag(0x0010, 0x0010);
33 kcenon::pacs::core::dicom_tag patient_id_tag(0x0010, 0x0020);
34 kcenon::pacs::core::dicom_tag study_uid_tag(0x0020, 0x000D);
35
36 std::cout << "Patient Name Tag: (" << std::hex
37 << patient_name_tag.group() << ","
38 << patient_name_tag.element() << ")\n";
39
40 // Create a DICOM dataset
42 std::cout << "Created empty dataset (size: " << std::dec
43 << dataset.size() << " elements)\n\n";
44
45 // Demonstrate encoding module usage
46 std::cout << "2. Encoding Module Demo\n";
47 std::cout << "-----------------------\n";
48
51
52 std::cout << "Implicit VR LE - Little Endian: "
53 << (implicit_le.is_little_endian() ? "Yes" : "No") << "\n";
54 std::cout << "Explicit VR LE - Implicit VR: "
55 << (explicit_le.is_implicit_vr() ? "Yes" : "No") << "\n\n";
56
57 // If a DICOM file is provided, read and display it
58 if (argc > 1) {
59 std::cout << "3. File Operations Demo\n";
60 std::cout << "-----------------------\n";
61
62 std::string filepath = argv[1];
63 std::cout << "Reading DICOM file: " << filepath << "\n";
64
66 auto result = file.read(filepath);
67
68 if (result) {
69 std::cout << "Successfully read DICOM file\n";
70 std::cout << "Dataset elements: " << file.dataset().size() << "\n";
71 } else {
72 std::cout << "Failed to read DICOM file\n";
73 }
74 }
75
76 std::cout << "\n=== Module Example Complete ===\n";
77 return 0;
78}
79
80#else
81
82#include <iostream>
83
84int main() {
85 std::cout << "C++20 modules are not enabled.\n";
86 std::cout << "Build with -DPACS_BUILD_MODULES=ON to use this example.\n";
87 std::cout << "\nExample:\n";
88 std::cout << " cmake -DPACS_BUILD_MODULES=ON -DPACS_BUILD_EXAMPLES=ON ..\n";
89 std::cout << " cmake --build .\n";
90 return 1;
91}
92
93#endif // KCENON_USE_MODULES
auto size() const noexcept -> size_t
Get the number of elements in the dataset.
auto dataset() const noexcept -> const dicom_dataset &
Get read-only access to the main dataset.
static const transfer_syntax explicit_vr_little_endian
Explicit VR Little Endian (1.2.840.10008.1.2.1)
static const transfer_syntax implicit_vr_little_endian
Implicit VR Little Endian (1.2.840.10008.1.2)
int main()
Definition main.cpp:84