Description
Overview
Hello.
Please be aware that I am new to DICOM.
I am running into a problem with an application that receives a MWM worklist retrieval request (C-FIND) from a modality and returns a dataset with the requested tag.
(0010,0010) VR=PN VM=1 In Patient's Name, the byte data encoded with ISO 2022 IR87 for "莉" (JIS X 0208 2nd level Kanji), which is part of the name, contains "=", so when validating the dataset DicomValidation causes an error.
VR=PN allows up to two component delimiters "=", but because the byte data of the name contains "=", it reads as three "=", which causes an error if there are too many components in the VR=PN validation.
Currently, we are temporarily coping by removing DicomValidation and are able to communicate with the modality for now.
I referred to DICOM PS3.5 6.2, which is not a violation of the DICOM standard, so it seems normal to be able to send data without error with DicomValidation.
I don't want to remove DicomValidation to avoid other problems, but do you have any suggestions for a fundamental solution?
Expected behavior
DicomValidationException is not thrown.
Actual behavior
The method throws an DicomValidationException.
fo-dicom/FO-DICOM.Core/DicomValidation.cs
Line 495 in f13ce2e
Actual error content
Individual names will be withheld.
例外がスローされました: 'FellowOakDicom.DicomValidationException' (fo-dicom.core.dll の中)
例外がスローされました: 'FellowOakDicom.DicomValidationException' (System.Private.CoreLib.dll の中)
例外がスローされました: 'FellowOakDicom.DicomValidationException' (System.Private.CoreLib.dll の中)
例外がスローされました: 'FellowOakDicom.DicomValidationException' (System.Private.CoreLib.dll の中)
| 18:13:14.020 | EROR | 07:__ | 26728:MyDicomApp | Exception processing P-Data-TF PDU | FellowOakDicom.Network | | L | MyDicomApp | 1.1.1.0 | PC | PC\user | 32270544 B|
FellowOakDicom.DicomValidationException: Content "****************=***********�$Bh=**�(B=***************************" does not validate VR PN: value contains too many groups
at FellowOakDicom.DicomValidation.ValidatePN(String content)
at System.Collections.Generic.List`1.ForEach(Action`1 action)
at FellowOakDicom.DicomElement.Validate()
at FellowOakDicom.DicomDataset.DoAdd(DicomItem item, Boolean allowUpdate)
at FellowOakDicom.DicomDataset.DoAdd[T](DicomVR vr, DicomTag tag, IList`1 values, Boolean allowUpdate)
at FellowOakDicom.DicomDataset.DoAdd[T](DicomTag tag, IList`1 values, Boolean allowUpdate)
at FellowOakDicom.DicomDataset.AddOrUpdate[T](DicomTag tag, T[] values)
at MyDicomApp.Services.MyDicomService.AddIfExistsInRequest[T](DicomDataset result, DicomDataset request, DicomTag tag, T value) in C:\Users\user\Documents\GitHub\MyDicomApp\MyDicomApp\Services\MyDicomService.cs:line 477
at MyDicomApp.Services.MyDicomService.FilterWorklistItems(DicomDataset request, List`1 worklistItems)+MoveNext() in C:\Users\user\Documents\GitHub\MyDicomApp\MyDicomApp\Services\MyDicomService.cs:line 358
at MyDicomApp.Services.MyDicomService.OnCFindRequestAsync(DicomCFindRequest request)+MoveNext() in C:\Users\user\Documents\GitHub\MyDicomApp\MyDicomApp\Services\MyDicomService.cs:line 123
at MyDicomApp.Services.MyDicomService.OnCFindRequestAsync(DicomCFindRequest request)+System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult()
at FellowOakDicom.Network.DicomService.PerformDimseAsync(DicomMessage dimse)
at FellowOakDicom.Network.DicomService.PerformDimseAsync(DicomMessage dimse)
at FellowOakDicom.Network.DicomService.ProcessPDataTFAsync(PDataTF pdu)
例外がスローされました: 'FellowOakDicom.DicomValidationException' (fo-dicom.core.dll の中)
例外がスローされました: 'FellowOakDicom.DicomValidationException' (System.Private.CoreLib.dll の中)
例外がスローされました: 'FellowOakDicom.DicomValidationException' (System.Private.CoreLib.dll の中)
| 18:13:14.301 | EROR | 07:__ | 26728:MyDicomApp | Exception processing PDU | FellowOakDicom.Network | | L | MyDicomApp | 1.1.1.0 | PC | PC\user | 32715848 B|
FellowOakDicom.DicomValidationException: Content "****************=***********�$Bh=**�(B=***************************" does not validate VR PN: value contains too many groups
at FellowOakDicom.DicomValidation.ValidatePN(String content)
at System.Collections.Generic.List`1.ForEach(Action`1 action)
at FellowOakDicom.DicomElement.Validate()
at FellowOakDicom.DicomDataset.DoAdd(DicomItem item, Boolean allowUpdate)
at FellowOakDicom.DicomDataset.DoAdd[T](DicomVR vr, DicomTag tag, IList`1 values, Boolean allowUpdate)
at FellowOakDicom.DicomDataset.DoAdd[T](DicomTag tag, IList`1 values, Boolean allowUpdate)
at FellowOakDicom.DicomDataset.AddOrUpdate[T](DicomTag tag, T[] values)
at MyDicomApp.Services.MyDicomService.AddIfExistsInRequest[T](DicomDataset result, DicomDataset request, DicomTag tag, T value) in C:\Users\user\Documents\GitHub\MyDicomApp\MyDicomApp\Services\MyDicomService.cs:line 477
at MyDicomApp.Services.MyDicomService.FilterWorklistItems(DicomDataset request, List`1 worklistItems)+MoveNext() in C:\Users\user\Documents\GitHub\MyDicomApp\MyDicomApp\Services\MyDicomService.cs:line 358
at MyDicomApp.Services.MyDicomService.OnCFindRequestAsync(DicomCFindRequest request)+MoveNext() in C:\Users\user\Documents\GitHub\MyDicomApp\MyDicomApp\Services\MyDicomService.cs:line 123
at MyDicomApp.Services.MyDicomService.OnCFindRequestAsync(DicomCFindRequest request)+System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult()
at FellowOakDicom.Network.DicomService.PerformDimseAsync(DicomMessage dimse)
at FellowOakDicom.Network.DicomService.PerformDimseAsync(DicomMessage dimse)
at FellowOakDicom.Network.DicomService.ProcessPDataTFAsync(PDataTF pdu)
at FellowOakDicom.Network.DicomService.ProcessPDataTFAsync(PDataTF pdu)
at FellowOakDicom.Network.DicomService.ListenAndProcessPDUAsync()
Byte data of patient name from Wireshark.
00a0 32 20 49 52 20 38 37 20 10 00 10 00 42 00 00 00 // 10~
00b0 4e 49 53 48 49 4b 41 57 41 5e 52 49 53 41 54 4f
00c0 3d 1b 24 42 40 3e 40 6e 1b 28 42 5e 1b 24 42 68
00d0 3d 4e 24 1b 28 42 3d 1b 24 42 25 4b 25 37 25 2b
00e0 25 6f 1b 28 42 5e 1b 24 42 25 6a 25 35 25 48 1b
00f0 28 42
Steps to reproduce the behavior
Part of the process is shown in accordance with this issue.
// Format patientName to romaji=kanji=kana
using FellowOakDicom;
var encoding1 = DicomEncoding.GetEncoding("ISO 2022 IR 6");
var encoding = DicomEncoding.GetEncoding("ISO 2022 IR 87");
var nameByte = encoding1.GetBytes("ROMAJI^NAME=").ToList();
nameByte.AddRange(encoding2.GetBytes("KANJI^NAME")); // 莉 to h=
nameByte.AddRange(encoding2.GetBytes("KANA^NAME"));
PatientName = DicomEncoding.GetEncoding("ISO 2022 IR 6").GetString(nameByte.ToArray());
// Add patient name to dataset
DicomDataset resultDataset;
resultDataset.AddOrUpdate(DicomTag.SpecificCharacterSet, "\\ISO 2022 IR 87");
resultDataset.AddOrUpdate(DicomTag.PatientName, patientName); // MyDicomService.cs:line 477
reference data
In byte data, "莉" is 68 3D and "=" is 3D.
fo-dicom version and OS/platform
Fellow Oak DICOM version: 5.1.1
OS: Windows 10 64bit
Platform: .NET 6