PACS System 0.1.0
PACS DICOM system library
Loading...
Searching...
No Matches
main.cpp File Reference

DICOM Conversion - Transfer Syntax Conversion Utility. More...

#include "kcenon/pacs/core/dicom_file.h"
#include "kcenon/pacs/core/dicom_tag_constants.h"
#include "kcenon/pacs/encoding/compression/codec_factory.h"
#include "kcenon/pacs/encoding/compression/compression_codec.h"
#include "kcenon/pacs/encoding/transfer_syntax.h"
#include <algorithm>
#include <chrono>
#include <filesystem>
#include <iomanip>
#include <iostream>
#include <string>
#include <vector>
Include dependency graph for main.cpp:

Go to the source code of this file.

Functions

int main (int argc, char *argv[])
 

Detailed Description

DICOM Conversion - Transfer Syntax Conversion Utility.

Definition in file main.cpp.

Function Documentation

◆ main()

int main ( int argc,
char * argv[] )

Definition at line 463 of file main.cpp.

463 {
464 options opts;
465
466 if (!parse_arguments(argc, argv, opts)) {
467 std::cout << R"(
468 ____ ____ __ __ ____ ___ _ ___ __
469 | _ \ / ___| \/ | / ___/ _ \| \ | \ \ / /
470 | | | | | | |\/| | | | | | | | \| |\ \ / /
471 | |_| | |___| | | | | |__| |_| | |\ | \ V /
472 |____/ \____|_| |_| \____\___/|_| \_| \_/
473
474 DICOM Transfer Syntax Converter
475)" << "\n";
476 print_usage(argv[0]);
477 return 1;
478 }
479
480 if (opts.list_syntaxes) {
481 list_supported_syntaxes();
482 return 0;
483 }
484
485 // Show banner in verbose mode
486 if (!opts.quiet) {
487 std::cout << R"(
488 ____ ____ __ __ ____ ___ _ ___ __
489 | _ \ / ___| \/ | / ___/ _ \| \ | \ \ / /
490 | | | | | | |\/| | | | | | | | \| |\ \ / /
491 | |_| | |___| | | | | |__| |_| | |\ | \ V /
492 |____/ \____|_| |_| \____\___/|_| \_| \_/
493
494 DICOM Transfer Syntax Converter
495)" << "\n";
496 }
497
498 // Check input exists
499 if (!std::filesystem::exists(opts.input_path)) {
500 std::cerr << "Error: Input path does not exist: " << opts.input_path.string() << "\n";
501 return 2;
502 }
503
504 auto target_ts = kcenon::pacs::encoding::transfer_syntax(opts.target_transfer_syntax);
505 if (!opts.quiet) {
506 std::cout << "Target Transfer Syntax: " << target_ts.name() << "\n";
507 std::cout << " UID: " << target_ts.uid() << "\n\n";
508 }
509
510 conversion_stats stats;
511 auto start_time = std::chrono::steady_clock::now();
512
513 if (std::filesystem::is_directory(opts.input_path)) {
514 // Process directory
515 if (!std::filesystem::exists(opts.output_path)) {
516 std::filesystem::create_directories(opts.output_path);
517 }
518
519 if (!opts.quiet) {
520 std::cout << "Processing directory: " << opts.input_path.string() << "\n";
521 if (opts.recursive) {
522 std::cout << "Mode: Recursive\n\n";
523 }
524 }
525
526 process_directory(opts.input_path, opts.output_path, opts, stats);
527 } else {
528 // Process single file
529 ++stats.total_files;
530
531 if (convert_file(opts.input_path, opts.output_path, opts)) {
532 ++stats.success_count;
533 } else {
534 ++stats.error_count;
535 }
Represents a DICOM Transfer Syntax.