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

DICOM Info - File Summary Utility. More...

#include "kcenon/pacs/core/dicom_file.h"
#include "kcenon/pacs/core/dicom_tag_constants.h"
#include "kcenon/pacs/encoding/transfer_syntax.h"
#include <algorithm>
#include <filesystem>
#include <iomanip>
#include <iostream>
#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

DICOM Info - File Summary Utility.

Definition in file main.cpp.

Function Documentation

◆ main()

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

Definition at line 682 of file main.cpp.

682 {
683 options opts;
684
685 if (!parse_arguments(argc, argv, opts)) {
686 std::cout << R"(
687 ____ ____ __ __ ___ _ _ _____ ___
688 | _ \ / ___| \/ | |_ _| \ | | ___/ _ \
689 | | | | | | |\/| | | || \| | |_ | | | |
690 | |_| | |___| | | | | || |\ | _|| |_| |
691 |____/ \____|_| |_| |___|_| \_|_| \___/
692
693 DICOM File Summary Utility
694)" << "\n";
695 print_usage(argv[0]);
696 return 1;
697 }
698
699 // Collect all files to process
700 std::vector<std::filesystem::path> all_files;
701 for (const auto& path : opts.paths) {
702 if (!std::filesystem::exists(path)) {
703 std::cerr << "Error: Path does not exist: " << path.string() << "\n";
704 return 2;
705 }
706
707 if (std::filesystem::is_directory(path)) {
708 auto dir_files = collect_files(path, opts.recursive);
709 all_files.insert(all_files.end(), dir_files.begin(), dir_files.end());
710 } else {
711 all_files.push_back(path);
712 }
713 }
714
715 if (all_files.empty()) {
716 std::cerr << "Error: No DICOM files found\n";
717 return 2;
718 }
719
720 // Print banner for text format (non-quiet)
721 if (opts.format == output_format::text && !opts.quiet) {
722 std::cout << R"(
723 ____ ____ __ __ ___ _ _ _____ ___
724 | _ \ / ___| \/ | |_ _| \ | | ___/ _ \
725 | | | | | | |\/| | | || \| | |_ | | | |
726 | |_| | |___| | | | | || |\ | _|| |_| |
727 |____/ \____|_| |_| |___|_| \_|_| \___/
728
729 DICOM File Summary Utility
730)" << "\n";
731
732 if (all_files.size() > 1) {
733 std::cout << "Processing " << all_files.size() << " files...\n\n";
734 }
735 }
736
737 // JSON array wrapper
738 if (opts.format == output_format::json && all_files.size() > 1) {
739 std::cout << "[\n";
740 }
741
742 int exit_code = 0;
743 for (size_t i = 0; i < all_files.size(); ++i) {
744 bool is_last = (i == all_files.size() - 1);
745 if (process_file(all_files[i], opts, is_last) != 0) {