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

Image to DICOM - Image Conversion Utility. More...

#include "kcenon/pacs/core/dicom_dataset.h"
#include "kcenon/pacs/core/dicom_element.h"
#include "kcenon/pacs/core/dicom_file.h"
#include "kcenon/pacs/core/dicom_tag.h"
#include "kcenon/pacs/core/dicom_tag_constants.h"
#include "kcenon/pacs/encoding/transfer_syntax.h"
#include "kcenon/pacs/encoding/vr_type.h"
#include <algorithm>
#include <chrono>
#include <cstdio>
#include <cstring>
#include <filesystem>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <random>
#include <sstream>
#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

Image to DICOM - Image Conversion Utility.

Definition in file main.cpp.

Function Documentation

◆ main()

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

Definition at line 633 of file main.cpp.

633 {
634 options opts;
635
636 if (!parse_arguments(argc, argv, opts)) {
637 std::cout << R"(
638 ___ __ __ ____ ____ ____ ____ __ __
639 |_ _| \/ |/ ___| |___ \ | _ \ / ___| \/ |
640 | || |\/| | | _ __) | | | | | | | |\/| |
641 | || | | | |_| | / __/ | |_| | |___| | | |
642 |___|_| |_|\____| |_____| |____/ \____|_| |_|
643
644 Image to DICOM Conversion Utility
645)" << "\n";
646 print_usage(argv[0]);
647 return 1;
648 }
649
650 // Check input exists
651 if (!std::filesystem::exists(opts.input_path)) {
652 std::cerr << "Error: Input path does not exist: " << opts.input_path.string()
653 << "\n";
654 return 2;
655 }
656
657 // Show banner
658 if (!opts.quiet) {
659 std::cout << R"(
660 ___ __ __ ____ ____ ____ ____ __ __
661 |_ _| \/ |/ ___| |___ \ | _ \ / ___| \/ |
662 | || |\/| | | _ __) | | | | | | | |\/| |
663 | || | | | |_| | / __/ | |_| | |___| | | |
664 |___|_| |_|\____| |_____| |____/ \____|_| |_|
665
666 Image to DICOM Conversion Utility
667)" << "\n";
668 }
669
670 conversion_stats stats;
671 auto start_time = std::chrono::steady_clock::now();
672
673 if (std::filesystem::is_directory(opts.input_path)) {
674 // Process directory
675 if (!std::filesystem::exists(opts.output_path)) {
676 std::filesystem::create_directories(opts.output_path);
677 }
678
679 if (!opts.quiet) {
680 std::cout << "Processing directory: " << opts.input_path.string() << "\n";
681 if (opts.recursive) {
682 std::cout << "Mode: Recursive\n\n";
683 }
684 }
685
686 process_directory(opts.input_path, opts.output_path, opts, stats);
687 } else {
688 // Process single file
689 ++stats.total_files;
690
691 if (convert_file(opts.input_path, opts.output_path, opts)) {
692 ++stats.success_count;
693 if (!opts.quiet) {
694 std::cout << "Conversion completed successfully.\n";
695 std::cout << " Output: " << opts.output_path.string() << "\n";
696 }