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

DICOM Extract - Pixel Data Extraction 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 <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 Extract - Pixel Data Extraction Utility.

Definition in file main.cpp.

Function Documentation

◆ main()

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

Definition at line 874 of file main.cpp.

874 {
875 options opts;
876
877 if (!parse_arguments(argc, argv, opts)) {
878 std::cout << R"(
879 ____ ____ __ __ _______ _______ ____ _ ____ _____
880 | _ \ / ___| \/ | | ____\ \/ /_ _| _ \ / \ / ___|_ _|
881 | | | | | | |\/| | | _| \ / | | | |_) | / _ \| | | |
882 | |_| | |___| | | | | |___ / \ | | | _ < / ___ \ |___ | |
883 |____/ \____|_| |_| |_____/_/\_\ |_| |_| \_\/_/ \_\____| |_|
884
885 DICOM Pixel Data Extraction Utility
886)" << "\n";
887 print_usage(argv[0]);
888 return 1;
889 }
890
891 // Check input exists
892 if (!std::filesystem::exists(opts.input_path)) {
893 std::cerr << "Error: Input path does not exist: " << opts.input_path.string()
894 << "\n";
895 return 2;
896 }
897
898 // Show banner
899 if (!opts.quiet) {
900 std::cout << R"(
901 ____ ____ __ __ _______ _______ ____ _ ____ _____
902 | _ \ / ___| \/ | | ____\ \/ /_ _| _ \ / \ / ___|_ _|
903 | | | | | | |\/| | | _| \ / | | | |_) | / _ \| | | |
904 | |_| | |___| | | | | |___ / \ | | | _ < / ___ \ |___ | |
905 |____/ \____|_| |_| |_____/_/\_\ |_| |_| \_\/_/ \_\____| |_|
906
907 DICOM Pixel Data Extraction Utility
908)" << "\n";
909 }
910
911 extraction_stats stats;
912 auto start_time = std::chrono::steady_clock::now();
913
914 if (std::filesystem::is_directory(opts.input_path)) {
915 // Process directory
916 if (!opts.info_only) {
917 if (!std::filesystem::exists(opts.output_path)) {
918 std::filesystem::create_directories(opts.output_path);
919 }
920 }
921
922 if (!opts.quiet) {
923 std::cout << "Processing directory: " << opts.input_path.string() << "\n";
924 if (opts.recursive) {
925 std::cout << "Mode: Recursive\n\n";
926 }
927 }
928
929 process_directory(opts.input_path, opts.output_path, opts, stats);
930 } else {
931 // Process single file
932 ++stats.total_files;
933
934 if (extract_file(opts.input_path, opts.output_path, opts)) {
935 ++stats.success_count;
936 if (!opts.quiet && !opts.info_only) {
937 std::cout << "Extraction completed successfully.\n";
938 std::cout << " Output: " << opts.output_path.string() << "\n";
939 }
940 } else {