7 #include <fwGdcmIO/helper/DicomAnonymizer.hpp> 9 #include <boost/filesystem/operations.hpp> 10 #include <boost/filesystem/path.hpp> 11 #include <boost/program_options.hpp> 32 int main(
int argc,
char** argv)
35 ::boost::program_options::options_description desc(
"Allowed options");
37 (
"help,h",
"produce help message")
38 (
"input,i", ::boost::program_options::value< std::string >(),
"set input folder")
39 (
"output,o", ::boost::program_options::value< std::string >(),
"set output folder")
43 ::boost::program_options::variables_map vm;
44 ::boost::program_options::store(boost::program_options::parse_command_line(argc, argv, desc), vm);
45 ::boost::program_options::notify(vm);
49 std::cout << desc << std::endl;
52 else if(!vm.count(
"input"))
54 std::cout <<
"You must specify an input file." << std::endl << std::endl;
55 std::cout << desc << std::endl;
58 else if(!vm.count(
"output"))
60 std::cout <<
"You must specify an output file." << std::endl << std::endl;
61 std::cout << desc << std::endl;
64 else if(vm[
"input"].as< std::string >() == vm[
"output"].as< std::string >())
66 std::cout <<
"The output folder can not be the input folder." << std::endl;
71 ::boost::filesystem::path input(vm[
"input"].as< std::string >());
72 ::boost::filesystem::path output(vm[
"output"].as< std::string >());
74 if(!::boost::filesystem::exists(input) || !::boost::filesystem::is_directory(input))
76 std::cout <<
"The specified input folder " << input <<
" is not a directory." <<
"\n";
79 else if(::boost::filesystem::exists(output))
81 std::cout <<
"The specified output folder " << output <<
" already exists." <<
"\n";
This class contains helpers to anonymize dicom files on filesystem. Anonymization is performed accord...
static FWGDCMIO_API void copyDirectory(const ::boost::filesystem::path &input, const ::boost::filesystem::path &output)
Copy a directory recursively.
FWGDCMIO_API void anonymize(const ::boost::filesystem::path &dirPath)
Anonymize a folder containing Dicom files.