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

DICOM Anonymize - De-identification Utility. More...

#include "kcenon/pacs/core/dicom_dictionary.h"
#include "kcenon/pacs/core/dicom_file.h"
#include "kcenon/pacs/core/dicom_tag_constants.h"
#include "kcenon/pacs/encoding/transfer_syntax.h"
#include "kcenon/pacs/encoding/vr_type.h"
#include "kcenon/pacs/security/anonymization_profile.h"
#include "kcenon/pacs/security/anonymizer.h"
#include "kcenon/pacs/security/uid_mapping.h"
#include <algorithm>
#include <chrono>
#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 Anonymize - De-identification Utility.

Definition in file main.cpp.

Function Documentation

◆ main()

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

Definition at line 715 of file main.cpp.

715 {
716 std::cout << R"(
717 ____ ____ __ __ _ _ _ ___ _ ___ ____ __ ___ ________
718 | _ \ / ___| \/ | / \ | \ | |/ _ \| \ | \ \ / / \/ |_ _|__ / __|
719 | | | | | | |\/| | / _ \ | \| | | | | \| |\ V /| |\/| || | / /| _|
720 | |_| | |___| | | | / ___ \| |\ | |_| | |\ | | | | | | || | / /_| |__
721 |____/ \____|_| |_| /_/ \_\_| \_|\___/|_| \_| |_| |_| |_|___/____|____|
722
723 DICOM De-identification Utility (PS3.15 Compliant)
724)" << "\n";
725
726 options opts;
727
728 if (!parse_arguments(argc, argv, opts)) {
729 print_usage(argv[0]);
730 return 1;
731 }
732
733 // Load existing UID mapping if specified
735 if (!opts.mapping_file.empty()) {
736 if (!load_mapping(opts.mapping_file, mapping)) {
737 return 2;
738 }
739 if (opts.verbose && !mapping.empty()) {
740 std::cout << "Loaded " << mapping.size()
741 << " existing UID mappings\n";
742 }
743 }
744
745 // Show profile info
746 if (opts.verbose) {
747 std::cout << "Anonymization profile: " << to_string(opts.profile)
748 << "\n";
749 }
750
751 // Process files
752 process_stats stats;
753 process_inputs(opts, stats, mapping);
754
755 // Save UID mapping if specified
756 if (!opts.mapping_file.empty() && !mapping.empty() && !opts.dry_run) {
757 if (!save_mapping(opts.mapping_file, mapping)) {
758 std::cerr << "Warning: Failed to save UID mapping file\n";
759 } else if (opts.verbose) {
760 std::cout << "Saved " << mapping.size() << " UID mappings to "
761 << opts.mapping_file.string() << "\n";
762 }
763 }
764
765 // Print summary
766 print_summary(stats);
767
768 if (stats.failed > 0) {
769 return 2;
auto empty() const -> bool
Check if the mapping is empty.
auto size() const -> std::size_t
Get the number of mappings.

References kcenon::pacs::security::uid_mapping::empty(), and kcenon::pacs::security::uid_mapping::size().

Here is the call graph for this function: