fo-dicom-samples
fo-dicom-samples copied to clipboard
Write Media issue on DICOM Media Sample
When I trying to make DICOMDIR in DICOM Media example, just tried command like this (patient1, 2 is included in example) cmd line> dicom.media.exe write data\patient1 and then program get exception Content "DicomFile" does not validate VR CS: value exceeds maximum length of 16 characters - with sample DICOM file or trying my own file also get exception Content "DicomFile" does not validate VR CS: value contains invalid character. Only uppercase character, digits, space and underscore alre allowed
I REALLY wants to avoid above 2 exception it is just validate option. So I tried code like this at WriteMedia Method var dicomFile = Dicom.DicomFile.Open(file.FullName); //dicomFile.Dataset.AutoValidate = false; --> Not Using dicomFile.Dataset.NotValidated(); --> Not Working dicomDir.AddFile(dicomFile, string.Format(@"000001{0}", file.Name)); --> Throws Exception above 2
Am I missing something? VR: Code String is too obscure to figure out.
No, you did not miss anything. The validation exceptions should throw when you create new data, but should not throw when processing existing data. I am affraid I have not updated the samples for some time. Please try the code with latest release of fo-dicom from nuget, there have been quite some fixes in validation code.