Skip to content

How to set the UID that contains trailing null character. #1686

Answered by mrbean-bremen
shaq23 asked this question in Q&A
Discussion options

You must be logged in to vote

Yes - as the message says: "components must not have leading zeros", but they have in this case. Admittedly, this kind of DICOM standard violation happens often enough, and if you are just copying tags from elsewhere (opposed to creating your owns) it is probably best to switch off validation to avoid this:

dicomDataset.ValidateItems = false;  // switches off validation for all following added items
var valueData = "1.2.840.20231121121212.0001";
DicomItem dicomItem = new DicomUniqueIdentifier(DicomTag.StudyInstanceUID, (string[])valueData);
dicomDataset.Add(dicomItem);
...

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@shaq23
Comment options

@mrbean-bremen
Comment options

Answer selected by shaq23
@shaq23
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants