35 const std::filesystem::path& path) {
38 auto file = dicom_file::create(
42 auto result = file.save(path);
43 if (result.is_err()) {
44 std::cerr <<
"Failed to save " << path <<
": "
45 << result.error().message <<
"\n";
49 std::cout <<
" Created: " << path.filename() <<
" ("
50 << std::filesystem::file_size(path) <<
" bytes)\n";
57bool generate_all(
const std::filesystem::path& output_dir) {
58 std::cout <<
"\nGenerating test DICOM files in: " << output_dir <<
"\n\n";
61 if (!std::filesystem::exists(output_dir)) {
62 std::filesystem::create_directories(output_dir);
68 std::cout <<
"Generating CT image...\n";
70 if (!save_dataset(ct_ds, output_dir /
"ct_minimal.dcm")) {
75 std::cout <<
"Generating MR image...\n";
77 if (!save_dataset(mr_ds, output_dir /
"mr_minimal.dcm")) {
82 std::cout <<
"Generating XA image...\n";
84 if (!save_dataset(xa_ds, output_dir /
"xa_minimal.dcm")) {
93int main(
int argc,
char* argv[]) {
95 ____ ___ ____ ___ __ __ _____ _
96 | _ \|_ _/ ___/ _ \| \/ | |_ _|__ ___| |_
97 | | | || | | | | | | |\/| | | |/ _ \/ __| __|
98 | |_| || | |__| |_| | | | | | | __/\__ \ |_
99 |____/|___\____\___/|_| |_| |_|\___||___/\__|
101 Data Generator for Integration Tests
105 std::filesystem::path output_dir;
108 output_dir = argv[1];
111 output_dir = std::filesystem::path(argv[0]).parent_path() /
".." /
".." /
112 "examples" /
"integration_tests" /
"test_data";
115 if (!generate_all(output_dir)) {
116 std::cerr <<
"\nSome files failed to generate\n";
120 std::cout <<
"\nAll test data files generated successfully!\n";
121 std::cout <<
"\nFiles can be used with binary integration tests:\n";
122 std::cout <<
" ./test_store_retrieve.sh\n";
123 std::cout <<
" store_scu localhost 11112 PACS_SCP " << output_dir /
"ct_minimal.dcm" <<
"\n";
static const transfer_syntax explicit_vr_little_endian
Explicit VR Little Endian (1.2.840.10008.1.2.1)
DICOM Part 10 file handling for reading/writing DICOM files.
core::dicom_dataset generate_mr_dataset(const std::string &study_uid="")
Generate a MR image dataset for testing.
core::dicom_dataset generate_ct_dataset(const std::string &study_uid="", const std::string &series_uid="", const std::string &instance_uid="")
Generate a minimal CT image dataset for testing.
core::dicom_dataset generate_xa_dataset(const std::string &study_uid="")
Generate a XA (X-Ray Angiographic) image dataset for testing.
Common test fixtures and utilities for integration tests.