Skip to content

Commit da33152

Browse files
committed
Do not empty Code Meaning
This would be a clear violation of Type 1 rule. Thanks to Jörg Riesmeier: * https://groups.google.com/g/dicomforum/c/WNHFU1smNJI/m/1_OwtL_1AAAJ
1 parent 0c7b33d commit da33152

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

Applications/Cxx/gdcmclean.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ static void PrintHelp() {
126126
<< std::endl;
127127
std::cout << " %s DICOM keyword/path(s) to scrub"
128128
<< std::endl;
129-
std::cout << " --code_meaning %s,%s,%s DICOM code meaning(s) to empty"
129+
std::cout << " --code_meaning %s,%s,%s DICOM code meaning(s) to alter"
130130
<< std::endl;
131131
std::cout << " --preserve %s DICOM path(s) to preserve"
132132
<< std::endl;

Source/MediaStorageAndFileFormat/gdcmCleaner.cxx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1318,9 +1318,15 @@ bool Cleaner::impl::ProcessDataSet(Subject &subject, File &file, DataSet &ds,
13181318
}
13191319
subject.InvokeEvent(ae);
13201320
} else if (action == Cleaner::impl::CODE_MEANING) {
1321-
// CodeMeaning is a public tag, we must empty (and not remove) for compatibility with IOD
1321+
// Cannot simply 'empty' public data element in this case:
1322+
// Code Meaning (0008, 0104) 1 Text that conveys the meaning of the Coded Entry.
1323+
// https://dicom.nema.org/medical/dicom/current/output/chtml/part03/sect_8.8.html#table_8.8-1a
1324+
// Action Code 'Z' states:
1325+
// replace with a zero length value, or a non - zero length value that may be a dummy value and consistent with the VR
13221326
DataElement clean(de.GetTag());
13231327
clean.SetVR(de.GetVR());
1328+
static const char clean_str[] = "ALTERED CODE MEANING"; // len=20
1329+
clean.SetByteValue(clean_str, strlen( clean_str));
13241330
ds.Replace(clean);
13251331
subject.InvokeEvent(ae);
13261332
} else {

0 commit comments

Comments
 (0)