This example demonstrates how to use pacs_system with C++20 modules. Build with -DPACS_BUILD_MODULES=ON to enable module support.
#ifdef KCENON_USE_MODULES
#include <iostream>
#include <string>
int main(
int argc,
char* argv[]) {
std::cout << "=== PACS System C++20 Module Example ===\n\n";
std::cout << "1. Core Module Demo\n";
std::cout << "-------------------\n";
std::cout << "Patient Name Tag: (" << std::hex
<< patient_name_tag.
group() <<
","
<< patient_name_tag.
element() <<
")\n";
std::cout << "Created empty dataset (size: " << std::dec
<< dataset.
size() <<
" elements)\n\n";
std::cout << "2. Encoding Module Demo\n";
std::cout << "-----------------------\n";
std::cout << "Implicit VR LE - Little Endian: "
<< (implicit_le.is_little_endian() ? "Yes" : "No") << "\n";
std::cout << "Explicit VR LE - Implicit VR: "
<< (explicit_le.is_implicit_vr() ? "Yes" : "No") << "\n\n";
if (argc > 1) {
std::cout << "3. File Operations Demo\n";
std::cout << "-----------------------\n";
std::string filepath = argv[1];
std::cout << "Reading DICOM file: " << filepath << "\n";
auto result = file.read(filepath);
if (result) {
std::cout << "Successfully read DICOM file\n";
std::cout <<
"Dataset elements: " << file.
dataset().size() <<
"\n";
} else {
std::cout << "Failed to read DICOM file\n";
}
}
std::cout << "\n=== Module Example Complete ===\n";
return 0;
}
#else
#include <iostream>
std::cout << "C++20 modules are not enabled.\n";
std::cout << "Build with -DPACS_BUILD_MODULES=ON to use this example.\n";
std::cout << "\nExample:\n";
std::cout << " cmake -DPACS_BUILD_MODULES=ON -DPACS_BUILD_EXAMPLES=ON ..\n";
std::cout << " cmake --build .\n";
return 1;
}
#endif
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.
constexpr auto group() const noexcept -> uint16_t
Get the group number.
constexpr auto element() const noexcept -> uint16_t
Get the element number.
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)