E: PatientName (0010,0010) violates VR definition in PatientModule but actual value is correct

The discussion below initially took place here: https://github.com/QIICR/dcmqi/issues/348.

From @mmromero on Tue Aug 07 2018 13:03:44 GMT+0000 (UTC)

Dear developers,

I am trying to create the structure report of a white matter hyper-intensity lesion segmentation with your docker container but no matter the Patient’s Name I always get the same error (see below). The actual value is “N2D_PATIENT”, but also tried with “xxx xxx” with the same result.

I can share the data with you, just let me know if you need it and I upload it.

Thank you very much.
Miguel.

docker run -v /Users/miguel/Workspace/RAPIDS/SR/dcmqi_test:/tmp/dcmqi qiicr/dcmqi itkimage2segimage --inputDICOMDirectory /tmp/dcmqi/input_data --inputMetadata /tmp/dcmqi/wmh_segmentation.json --inputImageList /tmp/dcmqi/output_nifti/18991230_000000nifti2dicom044s001a001.nii.gz --outputDICOM /tmp/dcmqi/wmh_segmentation.dcm
dcmqi repository URL: git@github.com:QIICR/dcmqi.git revision: 72869c3 tag: latest-2-g72869c3
Searching recursively /tmp/dcmqi/input_data for DICOM files
Input image size: [240, 240, 48]
W: PatientName (0010,0010) violates VR definition in PatientModule
W: PatientSex (0010,0040) violates VR definition in PatientModule
W: AccessionNumber (0008,0050) violates VR definition in GeneralStudyModule
W: InstitutionName (0008,0080) violates VR definition in GeneralEquipmentModule
W: PatientAge (0010,1010) violates VR definition in PatientStudyModule
W: PositionReferenceIndicator (0020,1040) absent in FrameOfReferenceModule (type 2)
Directions: 0.997303 -0.0502721 -0.0534678
-0.0229997 -0.905936 0.422789
0.0696929 0.42042 0.904649

Processing input label Image (0x1889550)
  RTTI typeinfo:   itk::Image<short, 3u>
  Reference Count: 3
  Modified Time: 184
  Debug: Off
  Object Name: 
  Observers: 
    none
  Source: (none)
  Source output name: (none)
  Release Data: Off
  Data Released: False
  Global Release Data: Off
  PipelineMTime: 48
  UpdateMTime: 183
  RealTimeStamp: 0 seconds 
  LargestPossibleRegion: 
    Dimension: 3
    Index: [0, 0, 0]
    Size: [240, 240, 48]
  BufferedRegion: 
    Dimension: 3
    Index: [0, 0, 0]
    Size: [240, 240, 48]
  RequestedRegion: 
    Dimension: 3
    Index: [0, 0, 0]
    Size: [240, 240, 48]
  Spacing: [0.958333, 0.958333, 3]
  Origin: [-107.096, 80.3152, -82.9768]
  Direction: 
0.997303 -0.0502721 -0.0534678
-0.0229997 -0.905936 0.422789
0.0696929 0.42042 0.904649

  IndexToPointMatrix: 
0.955749 -0.0481774 -0.160403
-0.0220414 -0.868189 1.26837
0.066789 0.402902 2.71395

  PointToIndexMatrix: 
1.04066 -0.0239997 0.072723
-0.0524578 -0.945325 0.438699
-0.0178226 0.14093 0.30155

  Inverse Direction: 
0.997303 -0.0229997 0.0696929
-0.0502721 -0.905936 0.42042
-0.0534678 0.422789 0.904649

  PixelContainer: 
    ImportImageContainer (0x1884ec0)
      RTTI typeinfo:   itk::ImportImageContainer<unsigned long, short>
      Reference Count: 1
      Modified Time: 180
      Debug: Off
      Object Name: 
      Observers: 
        none
      Pointer: 0x7f569bb8a010
      Container manages memory: true
      Size: 2764800
      Capacity: 2764800

Found 2 label(s)
Skipping label 0
Processing label 1
Total non-empty slices that will be encoded in SEG for label 1 is 48
 (inclusive from 0 to 48)
E: PatientName (0010,0010) violates VR definition in PatientModule
FATAL ERROR: Writing of the SEG dataset failed! Please report the problem to the developers, ideally accompanied by a de-identified dataset allowing to reproduce the problem!
```<br /><br /><i>Copied from original issue: https://github.com/QIICR/dcmqi/issues/348</i>

From @pieper on Tue Aug 07 2018 14:02:38 GMT+0000 (UTC)

Hi @mmromero -

Thanks for the report :+1:

I’d try encoding the PatientName as a PN (person name) VR according to the standard:

ftp://dicom.nema.org/MEDICAL/Dicom/current/output/chtml/part05/sect_6.2.html

If it’s still not working, can you post your wmh_segmentation.json file?

-Steve

From @mmromero on Tue Aug 07 2018 14:08:53 GMT+0000 (UTC)

Dear Steve,

Thank you for the quick answer, I checked the VR PN format but I didn’t see how a name of one word without special characters couldn’t match it. I will check again, just to be sure.

I am running a test of dcmqi, for that I used the following wmh_segmentation.json:

{
  "ContentCreatorName": "Miguel",
  "ClinicalTrialSeriesID": "Session1",
  "ClinicalTrialTimePointID": "1",
  "SeriesDescription": "WMH Segmentation",
  "SeriesNumber": "300",
  "InstanceNumber": "1",
  "BodyPartExamined": "Brain",
  "segmentAttributes": [
    [
      {
        "labelID": 1,
        "SegmentDescription": "WMH",
        "SegmentAlgorithmType": "AUTOMATIC",
        "SegmentAlgorithmName": "IBBM Algorithm",
        "AnatomicRegionSequence": {
          "CodeValue": "T-A0100",
          "CodingSchemeDesignator": "SRT",
          "CodeMeaning": "Brain"
        },
        "SegmentedPropertyCategoryCodeSequence": {
          "CodeValue": "T-D0050",
          "CodingSchemeDesignator": "SRT",
          "CodeMeaning": "Tissue"
        },
        "recommendedDisplayRGBValue": [
          237,
          5,
          5
        ],
        "SegmentedPropertyTypeCodeSequence": {
          "CodeValue": "T-D0050",
          "CodingSchemeDesignator": "SRT",
          "CodeMeaning": "Tissue"
        }
      }
    ]
  ],
  "ContentLabel": "SEGMENTATION",
  "ContentDescription": "Image segmentation",
  "ClinicalTrialCoordinatingCenterName": "dcmqi"
}

Thank you,
Miguel.

From @pieper on Tue Aug 07 2018 14:59:08 GMT+0000 (UTC)

First glance that looks okay - I guess if you post the full dataset to dropbox or similar we could have a closer look (assuming no identifying patient info of course).

From @mmromero on Tue Aug 07 2018 15:38:46 GMT+0000 (UTC)

Sure, you can download it from here: https://gigamove.rz.rwth-aachen.de/d/id/KfEouv7ymsysW9

From @fedorov on Tue Aug 07 2018 15:53:55 GMT+0000 (UTC)

dciodvfy reports a number of errors for that dataset, I wonder if this causes the conversion problem too. Looks like you created that series with ITK, is this correct? If yes, what version did you use?

image

From @mmromero on Tue Aug 07 2018 16:01:22 GMT+0000 (UTC)

Hi @fedorov. I created the dicoms from a nifti file using the nifti2dicom tool as follows:

nifti2dicom_macos_0.4.3-0r1 -i INPUT -o OUTPUT --studyid rapidstest --studyinstanceuid 1.2.826.0.1.3680043.2.1143.9925161747653993333667655489998915347 --patientage 33 --patientsex M --patientweight 85 --patientdob 19841101 --studydate 20180516 --seriesnumber 1 -a 1

The ITK version is 4.8.2.

If you think this is the problem I will populate all the fields with my values instead of using the default ones. The problem is that I only have the niftis for these data and I need to use the dicoms.

Thank you very much.

From @fedorov on Tue Aug 07 2018 16:16:46 GMT+0000 (UTC)

Interesting. I have not seen that tool before, and indeed it is a good question - what tool we could recommend to create a DICOM image series from non-DICOM image … I don’t have a ready answer!

I am not sure it will help if you just not use the default values. It looks like it might be writing trailing characters that are not consistent with the standard, and I do not know how to confirm or fix this. I would need to dig into the standard more to see if I can figure it out. But if the issue is in your converter, I can’t think of an alternative to suggest! … :frowning:

From @pieper on Tue Aug 07 2018 16:48:30 GMT+0000 (UTC)

Of course you can use Slicer to convert your files to dicom - either with a
command line module (that you could script) or with the GUI.

https://www.slicer.org/wiki/Documentation/Nightly/Modules/CreateDICOMSeries

https://www.slicer.org/wiki/Documentation/Nightly/Modules/DICOM#DICOM_export

On Tue, Aug 7, 2018 at 12:16 PM, Andrey Fedorov notifications@github.com
wrote:

Interesting. I have not seen that tool before, and indeed it is a good
question - what tool we could recommend to create DICOM from non-DICOM …
I don’t have a ready answer!

I am not sure it will help if you just not use the default values. It
looks like it might be writing trailing characters that are not consistent
with the standard, and I do not know how to confirm or fix this. I would
need to dig into the standard more to see if I can figure it out. But if
the issue is in your converter, I can’t think of an alternative to suggest!
:frowning:


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/QIICR/dcmqi/issues/348#issuecomment-411114675, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAHsfUlhDpqvyfHDsErRSG6xq8o2ABVAks5uOb1vgaJpZM4VyHiq
.

From @fedorov on Tue Aug 07 2018 16:54:18 GMT+0000 (UTC)

> you can use Slicer to convert your files to dicom

… but that will mean the output will always be CT, and you cannot import metadata from another DICOM object as the tool you mentioned advertises it can do.

From @pieper on Tue Aug 07 2018 17:01:29 GMT+0000 (UTC)

Actually I think if you imported the other data and then put your volume in the subject hiearchy node with the imported data then the exported data dicom files would inherit the study information.

The point about the exported dicom having a CT modality is valid - that’s been a ‘feature’ of the CreateDICOMSeries module since the beginning but if that’s the only objection and there’s no other good tool, then making the modality into a command line argument would be a simple fix.

Perhaps @cpinter or @lassoan have other suggestions?

From @fedorov on Tue Aug 07 2018 17:03:45 GMT+0000 (UTC)

> making the modality into a command line argument would be a simple fix

I don’t think it would be that simple. The tool would need to know what attributes are required by individual IODs, and be able to import those from the input reference instances. I think implementing that in a meaningful way will require a non-trivial effort.

Do we know of any other tool that can take a non-DICOM image and make a DICOM out of it?

From @pieper on Tue Aug 07 2018 17:07:38 GMT+0000 (UTC)

That’s my point - of course it’s complicated to make everything perfect, but if all you need to do is help people in @mmromero’s situation then there may not be any better tool. Plus improving the DICOM export from Slicer, even if imperfect, might still be useful.

Of course the other way to do it is to just write a program that generates the DICOM you wanted - e.g. with dcmtk, pydicom, or other method.

From @fedorov on Tue Aug 07 2018 17:30:24 GMT+0000 (UTC)

Yes, I completely agree. I am just wondering if there is another ready-to-go tool that could help here.

From @pieper on Tue Aug 07 2018 17:46:48 GMT+0000 (UTC)

Depending on how much data there is to convert and how variable it is, one brute force method is to use dcmdump and dump2dcm along with a script that slices up the volumes and does string replaces on the dump file. Not elegant but at least you know that if you start with a valid file of the type you are trying to create you will have the right dicom tags. This is not an elegant approach but it may be easier than learning how to do the same thing in dcmtk.

From @lassoan on Tue Aug 07 2018 18:58:44 GMT+0000 (UTC)

You can specify any modality when you export an image from Slicer. In the DICOM export dialog, change Modality tag in Edit DICOM tags section.

In Data module, create subject and study, drag-and-drop the series (volume node) under the study, and right-click on the series to export it:

image

The DICOM export dialog is opened where several fields can be modified and then exported to DICOM file:

image

You can use dcmodify to change individual tags in a DICOM file, but it is not very convenient, because it is a command-line tool and you also need to write a short script that iterates through all files of a series to change modality of a volume.

From @mmromero on Wed Aug 08 2018 10:38:57 GMT+0000 (UTC)

Thank you @lassoan, exporting dicoms from Slicer works. I managed to generate the segmentation report. Also @pieper and @fedorov, thank you for quick answer and support.

From @pieper on Wed Aug 08 2018 12:14:14 GMT+0000 (UTC)

Thanks @mmromero for reporting and following up!

From @fedorov on Wed Aug 08 2018 15:57:07 GMT+0000 (UTC)

@lassoan thank you for the details!

@mmromero glad the issue is resolved for you, and thank you for pointing us to the other tool you used. I was not aware of it.

If/when I figure out what was the issue with the output it produces, I will see if I can make a PR to fix the issue, since that tool looks more comprehensive than Slicer in customizing the output, and can be used in batch mode, which makes it unique - I don’t know of something comparable. Meanwhile, I took note of the issue in https://github.com/biolab-unige/nifti2dicom/issues/33.

From @lassoan on Wed Aug 08 2018 21:49:08 GMT+0000 (UTC)

You can use all Slicer features in batch mode, without GUI. If you ever need help in figuring out how to access a particular feature then ask on the Slicer forum.

“nifti2dicom” has a very narrow scope - it can only export a single 3D image volume. DICOM storage is much more than this. You may need to export segmentation objects, RT structure sets, registration objects, structured reports, complete studies with references between series, etc. Slicer can all do all this, using an extensible, plugin-based DICOM export infrastructure. It’s far from perfect, but it’s being continuously improved.