@@ -138,6 +138,10 @@ static void PrintHelp() {
138138 std::cout << " --preserve-illegal Whether or "
139139 " not preserve illegal attributes (eg. group 0003...)."
140140 << std::endl;
141+ std::cout
142+ << " --empty-when-scrub-fails Fallback to "
143+ " emptying any attribute for which scrub operation failed."
144+ << std::endl;
141145 std::cout << " General Options:" << std::endl;
142146 std::cout << " -V --verbose more verbose (warning+error)."
143147 << std::endl;
@@ -171,6 +175,7 @@ int main(int argc, char *argv[]) {
171175 int preserveAllMissingPrivateCreator = 0 ;
172176 int preserveAllGroupLength = 0 ;
173177 int preserveAllIllegal = 0 ;
178+ int emptyWhenScrubFails = 0 ;
174179 std::vector<gdcm::DPath> empty_dpaths;
175180 std::vector<gdcm::DPath> remove_dpaths;
176181 std::vector<gdcm::DPath> scrub_dpaths;
@@ -196,14 +201,15 @@ int main(int argc, char *argv[]) {
196201 {" recursive" , no_argument, nullptr , ' r' },
197202 {" empty" , required_argument, &empty_tag, 1 }, // 3
198203 {" remove" , required_argument, &remove_tag, 1 }, // 4
199- {" scrub" , required_argument, &scrub_tag, 1 }, // 5
204+ {" scrub" , required_argument, &scrub_tag, 1 }, // 5
200205 {" preserve" , required_argument, &preserve_tag, 1 }, // 5
201206 {" continue" , no_argument, nullptr , ' c' },
202207 {" skip-meta" , 0 , &skipmeta, 1 }, // should I document this one ?
203208 {" preserve-missing-private-creator" , 0 ,
204209 &preserveAllMissingPrivateCreator, 1 }, //
205210 {" preserve-group-length" , 0 , &preserveAllGroupLength, 1 }, //
206211 {" preserve-illegal" , 0 , &preserveAllIllegal, 1 }, //
212+ {" empty-when-scrub-fails" , 0 , &emptyWhenScrubFails, 1 }, //
207213
208214 {" verbose" , no_argument, nullptr , ' V' },
209215 {" warning" , no_argument, nullptr , ' W' },
@@ -437,6 +443,7 @@ int main(int argc, char *argv[]) {
437443 cleaner.RemoveAllMissingPrivateCreator (!preserveAllMissingPrivateCreator);
438444 cleaner.RemoveAllGroupLength (!preserveAllGroupLength);
439445 cleaner.RemoveAllIllegal (!preserveAllIllegal);
446+ cleaner.EmptyWhenScrubFails (!!emptyWhenScrubFails);
440447 // Preserve
441448 for (std::vector<gdcm::DPath>::const_iterator it = preserve_dpaths.begin ();
442449 it != preserve_dpaths.end (); ++it) {
0 commit comments