Bug 136 - C-Find request fails when found DICOM file does not have certain tags
Summary: C-Find request fails when found DICOM file does not have certain tags
Status: RESOLVED FIXED
Alias: None
Product: Orthanc
Classification: Unclassified
Component: Orthanc Core (show other bugs)
Version: unspecified
Hardware: All All
: --- normal
Assignee: Sébastien Jodogne
URL:
Depends on:
Blocks:
 
Reported: 2020-06-29 15:15 CEST by Sébastien Jodogne
Modified: 2020-06-29 15:25 CEST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sébastien Jodogne 2020-06-29 15:15:23 CEST
[BitBucket user: Harald Köstinger]
[BitBucket date: 2019-03-11.15:59:15]

Hello,

I did the following:
I uploaded a custom DICOM file of SOP class "Raw Data Storage". When I now try to find it via a C-Find request, I get issues related to the attributes Rows/Columns.

My C-Find request for a DICOM web implementation just includes these fields in the C-Find request. (see http://dicom.nema.org/medical/dicom/current/output/chtml/part18/sect_6.7.html#table_6.7.1-2b)

I would expect Orthanc to not try to extract these values, if the tags are not present in the file and the file is not of SOP class Image or the like, which does not have these attributes after all.

Here are the logs:
```
#!java
I0311 16:46:14.686466 OrthancFindRequestHandler.cpp:596] DICOM C-Find request at level: Instance
I0311 16:46:14.702098 OrthancFindRequestHandler.cpp:602]   (0008,0005)  SpecificCharacterSet = ISO_IR 100
I0311 16:46:14.702098 OrthancFindRequestHandler.cpp:602]   (0008,0016)  SOPClassUID =
I0311 16:46:14.717719 OrthancFindRequestHandler.cpp:602]   (0008,0018)  SOPInstanceUID =
I0311 16:46:14.717719 OrthancFindRequestHandler.cpp:602]   (0008,0020)  StudyDate =
I0311 16:46:14.717719 OrthancFindRequestHandler.cpp:602]   (0008,0030)  StudyTime =
I0311 16:46:14.733347 OrthancFindRequestHandler.cpp:602]   (0008,0050)  AccessionNumber =
I0311 16:46:14.733347 OrthancFindRequestHandler.cpp:602]   (0008,0052)  QueryRetrieveLevel = IMAGE
I0311 16:46:14.748973 OrthancFindRequestHandler.cpp:602]   (0008,0056)  InstanceAvailability =
I0311 16:46:14.748973 OrthancFindRequestHandler.cpp:602]   (0008,0060)  Modality =
I0311 16:46:14.748973 OrthancFindRequestHandler.cpp:602]   (0008,0061)  ModalitiesInStudy =
I0311 16:46:14.764595 OrthancFindRequestHandler.cpp:602]   (0008,0090)  ReferringPhysicianName =
I0311 16:46:14.764595 OrthancFindRequestHandler.cpp:602]   (0008,0201)  TimezoneOffsetFromUTC =
I0311 16:46:14.780221 OrthancFindRequestHandler.cpp:602]   (0008,103e)  SeriesDescription =
I0311 16:46:14.780221 OrthancFindRequestHandler.cpp:602]   (0010,0010)  PatientName =
I0311 16:46:14.795844 OrthancFindRequestHandler.cpp:602]   (0010,0020)  PatientID =
I0311 16:46:14.795844 OrthancFindRequestHandler.cpp:602]   (0010,0030)  PatientBirthDate =
I0311 16:46:14.795844 OrthancFindRequestHandler.cpp:602]   (0010,0040)  PatientSex =
I0311 16:46:14.811473 OrthancFindRequestHandler.cpp:602]   (0020,000d)  StudyInstanceUID = 4.5.6
I0311 16:46:14.811473 OrthancFindRequestHandler.cpp:602]   (0020,000e)  SeriesInstanceUID =
I0311 16:46:14.827099 OrthancFindRequestHandler.cpp:602]   (0020,0010)  StudyID =
I0311 16:46:14.827099 OrthancFindRequestHandler.cpp:602]   (0020,0011)  SeriesNumber =
I0311 16:46:14.842727 OrthancFindRequestHandler.cpp:602]   (0020,0013)  InstanceNumber =
I0311 16:46:14.842727 OrthancFindRequestHandler.cpp:602]   (0020,1206)  NumberOfStudyRelatedSeries =
I0311 16:46:14.858350 OrthancFindRequestHandler.cpp:602]   (0020,1208)  NumberOfStudyRelatedInstances =
I0311 16:46:14.858350 OrthancFindRequestHandler.cpp:602]   (0020,1209)  NumberOfSeriesRelatedInstances =
I0311 16:46:14.873977 OrthancFindRequestHandler.cpp:602]   (0028,0008)  NumberOfFrames =
I0311 16:46:14.873977 OrthancFindRequestHandler.cpp:602]   (0040,0244)  PerformedProcedureStepStartDate =
I0311 16:46:14.889601 OrthancFindRequestHandler.cpp:602]   (0040,0245)  PerformedProcedureStepStartTime =
I0311 16:46:14.889601 OrthancFindRequestHandler.cpp:611]   (0040,0275)  RequestAttributesSequence : sequence tag whose content will be copied
I0311 16:46:14.905225 ServerContext.cpp:845] Number of candidate resources after fast DB filtering on main DICOM tags: 1
E0311 16:46:14.920850 OrthancException.h:85] Bad file format: While creating a DICOM instance, tag (0028,0010) has out-of-range value: ""
E0311 16:46:14.936481 FindScp.cpp:297] C-FIND request handler has failed: Bad file format
```

I would need to include these tags into the query, as I do not know, which instances do match on the server. For those matching, I would like to have the rows and columns in the result, but for the others, I don't mind the value.

Is this a bug in Orthanc or am I misinterpreting something here?
Shouldn't the PACS just skip these values, if not present?

Kind regards,
Harald
Comment 1 Sébastien Jodogne 2020-06-29 15:25:09 CEST
[BitBucket user: Sébastien Jodogne]
[BitBucket date: 2019-03-12.08:15:25]

The following changeset should solve this issue: https://hg.orthanc-server.com/orthanc/changeset/9b0e67161600a3c83d47f1d592ab9b80385fe5b2

This changeset was part of Orthanc 1.5.5, so please make sure you use the latest version of Orthanc before submitting new problem to this bug tracker: bug 137
Comment 2 Sébastien Jodogne 2020-06-29 15:25:12 CEST
[BitBucket user: Harald Köstinger]
[BitBucket date: 2019-03-12.09:45:28]

This changeset does not fix that problem. Still have the same issues with new version 1.5.6 of Orthanc core. Also #137 still is present.
Comment 3 Sébastien Jodogne 2020-06-29 15:25:14 CEST
[BitBucket user: Sébastien Jodogne]
[BitBucket date: 2019-03-12.10:05:06]

Please provide a sample DICOM file and command-line instructions so that we can reproduce your issue.
Comment 4 Sébastien Jodogne 2020-06-29 15:25:16 CEST
[BitBucket user: Harald Köstinger]
[BitBucket date: 2019-03-12.14:14:27]

As it seems, the issue is not directly related to the DICOM file itself. Nevertheless, you can use the same file as provided for #137 for testing.

The issue seems to be related to the SQ of the "Requested Attributes Sequence" value.

Orthanc gives the following output on this. It already says, that the sequence is not supported. However, it should not fail because of this I would say.

```
#!python

W0312 15:08:28.232247 FindScp.cpp:268] Orthanc only supports sequence matching on worklists, ignoring C-FIND SCU constraint on tag (0040,0275) RequestAttributesSequence
I0312 15:08:28.247869 OrthancFindRequestHandler.cpp:596] DICOM C-Find request at level: Instance
I0312 15:08:28.247869 OrthancFindRequestHandler.cpp:602]   (0008,0005)  SpecificCharacterSet = ISO_IR 100
I0312 15:08:28.247869 OrthancFindRequestHandler.cpp:602]   (0008,0016)  SOPClassUID =
I0312 15:08:28.263504 OrthancFindRequestHandler.cpp:602]   (0008,0018)  SOPInstanceUID =
I0312 15:08:28.263504 OrthancFindRequestHandler.cpp:602]   (0008,0020)  StudyDate =
I0312 15:08:28.279126 OrthancFindRequestHandler.cpp:602]   (0008,0030)  StudyTime =
I0312 15:08:28.279126 OrthancFindRequestHandler.cpp:602]   (0008,0050)  AccessionNumber =
I0312 15:08:28.279126 OrthancFindRequestHandler.cpp:602]   (0008,0052)  QueryRetrieveLevel = IMAGE
I0312 15:08:28.279126 OrthancFindRequestHandler.cpp:602]   (0008,0056)  InstanceAvailability =
I0312 15:08:28.294751 OrthancFindRequestHandler.cpp:602]   (0008,0060)  Modality =
I0312 15:08:28.294751 OrthancFindRequestHandler.cpp:602]   (0008,0061)  ModalitiesInStudy =
I0312 15:08:28.294751 OrthancFindRequestHandler.cpp:602]   (0008,0090)  ReferringPhysicianName =
I0312 15:08:28.310380 OrthancFindRequestHandler.cpp:602]   (0008,0201)  TimezoneOffsetFromUTC =
I0312 15:08:28.310380 OrthancFindRequestHandler.cpp:602]   (0008,103e)  SeriesDescription =
I0312 15:08:28.310380 OrthancFindRequestHandler.cpp:602]   (0010,0010)  PatientName =
I0312 15:08:28.310380 OrthancFindRequestHandler.cpp:602]   (0010,0020)  PatientID =
I0312 15:08:28.310380 OrthancFindRequestHandler.cpp:602]   (0010,0030)  PatientBirthDate =
I0312 15:08:28.326004 OrthancFindRequestHandler.cpp:602]   (0010,0040)  PatientSex =
I0312 15:08:28.326004 OrthancFindRequestHandler.cpp:602]   (0020,000d)  StudyInstanceUID = 4.5.6
I0312 15:08:28.341630 OrthancFindRequestHandler.cpp:602]   (0020,000e)  SeriesInstanceUID =
I0312 15:08:28.341630 OrthancFindRequestHandler.cpp:602]   (0020,0010)  StudyID =
I0312 15:08:28.341630 OrthancFindRequestHandler.cpp:602]   (0020,0011)  SeriesNumber =
I0312 15:08:28.357257 OrthancFindRequestHandler.cpp:602]   (0020,0013)  InstanceNumber =
I0312 15:08:28.357257 OrthancFindRequestHandler.cpp:602]   (0020,1206)  NumberOfStudyRelatedSeries =
I0312 15:08:28.357257 OrthancFindRequestHandler.cpp:602]   (0020,1208)  NumberOfStudyRelatedInstances =
I0312 15:08:28.372876 OrthancFindRequestHandler.cpp:602]   (0020,1209)  NumberOfSeriesRelatedInstances =
I0312 15:08:28.372876 OrthancFindRequestHandler.cpp:602]   (0028,0008)  NumberOfFrames =
I0312 15:08:28.372876 OrthancFindRequestHandler.cpp:602]   (0040,0244)  PerformedProcedureStepStartDate =
I0312 15:08:28.388508 OrthancFindRequestHandler.cpp:602]   (0040,0245)  PerformedProcedureStepStartTime =
I0312 15:08:28.388508 OrthancFindRequestHandler.cpp:611]   (0040,0275)  RequestAttributesSequence : sequence tag whose content will be copied
I0312 15:08:28.388508 ServerContext.cpp:845] Number of candidate resources after fast DB filtering on main DICOM tags: 1
I0312 15:08:28.404127 FilesystemStorage.cpp:155] Reading attachment "48b5dab9-38b0-4087-80c9-e8b0e2b2b617" of "JSON summary of DICOM" content type
E0312 15:08:28.404127 OrthancException.h:85] Bad file format: While creating a DICOM instance, tag (0028,0010) has out-of-range value: ""
E0312 15:08:28.419758 FindScp.cpp:297] C-FIND request handler has failed: Bad file format
I0312 15:08:28.513515 CommandDispatcher.cpp:917] DUL Peer Requested Release
I0312 15:08:28.513515 CommandDispatcher.cpp:924] Association Release
```

I tried to do the C-FIND now using a fo-dicom client and the dcmtk 3.6.4 findscu client. Both fail when I do include the sequence.
(Note: this is a query as I would fire to get all the attributes required by a QIDO-RS find call on instances level)

```
#!python

findscu vmdta01 4242 -S -k 0010,0020="1.2.3" -aet INNOFORCE88 -aec ORTHANC -v +sr -k 0008,0005="ISO_IR 100" -k 0008,0016 -k 0008,0018 -k 0008,0020 -k 0008,0030 -k 0008,0050 -k 0008,0052="IMAGE" -k 0008,0056 -k 0008,0060 -k 0008,0061 -k 0008,0090 -k 0008,0201 -k 0008,103e -k 0010,0010 -k 0010,0020 -k 0010,0030 -k 0010,0040 -k 0020,000d="4.5.6" -k 0020,000e -k 0020,0010 -k 0020,0011 -k 0020,0013 -k 0020,1206 -k 0020,1208 -k 0020,1209 -k 0028,0008 -k 0028,0010 -k 0028,0011 -k 0028,0100 -k 0040,0244 -k 0040,0245 -k "(0040,0275)[0].(0040,0009)" -k "(0040,0275)[0].(0040,1001)"
I: Requesting Association
I: Association Accepted (Max Send PDV: 16372)
I: Sending Find Request (MsgID 1)
I: Request Identifiers:
I:
I: # Dicom-Data-Set
I: # Used TransferSyntax: Little Endian Explicit
I: (0008,0005) CS [ISO_IR 100]                             #  10, 1 SpecificCharacterSet
I: (0008,0016) UI (no value available)                     #   0, 0 SOPClassUID
I: (0008,0018) UI (no value available)                     #   0, 0 SOPInstanceUID
I: (0008,0020) DA (no value available)                     #   0, 0 StudyDate
I: (0008,0030) TM (no value available)                     #   0, 0 StudyTime
I: (0008,0050) SH (no value available)                     #   0, 0 AccessionNumber
I: (0008,0052) CS [IMAGE]                                  #   6, 1 QueryRetrieveLevel
I: (0008,0056) CS (no value available)                     #   0, 0 InstanceAvailability
I: (0008,0060) CS (no value available)                     #   0, 0 Modality
I: (0008,0061) CS (no value available)                     #   0, 0 ModalitiesInStudy
I: (0008,0090) PN (no value available)                     #   0, 0 ReferringPhysicianName
I: (0008,0201) SH (no value available)                     #   0, 0 TimezoneOffsetFromUTC
I: (0008,103e) LO (no value available)                     #   0, 0 SeriesDescription
I: (0010,0010) PN (no value available)                     #   0, 0 PatientName
I: (0010,0020) LO (no value available)                     #   0, 0 PatientID
I: (0010,0030) DA (no value available)                     #   0, 0 PatientBirthDate
I: (0010,0040) CS (no value available)                     #   0, 0 PatientSex
I: (0020,000d) UI [4.5.6]                                  #   6, 1 StudyInstanceUID
I: (0020,000e) UI (no value available)                     #   0, 0 SeriesInstanceUID
I: (0020,0010) SH (no value available)                     #   0, 0 StudyID
I: (0020,0011) IS (no value available)                     #   0, 0 SeriesNumber
I: (0020,0013) IS (no value available)                     #   0, 0 InstanceNumber
I: (0020,1206) IS (no value available)                     #   0, 0 NumberOfStudyRelatedSeries
I: (0020,1208) IS (no value available)                     #   0, 0 NumberOfStudyRelatedInstances
I: (0020,1209) IS (no value available)                     #   0, 0 NumberOfSeriesRelatedInstances
I: (0028,0008) IS (no value available)                     #   0, 0 NumberOfFrames
I: (0028,0010) US (no value available)                     #   0, 0 Rows
I: (0028,0011) US (no value available)                     #   0, 0 Columns
I: (0028,0100) US (no value available)                     #   0, 0 BitsAllocated
I: (0040,0244) DA (no value available)                     #   0, 0 PerformedProcedureStepStartDate
I: (0040,0245) TM (no value available)                     #   0, 0 PerformedProcedureStepStartTime
I: (0040,0275) SQ (Sequence with explicit length #=1)      #   0, 1 RequestAttributesSequence
I:   (fffe,e000) na (Item with explicit length #=2)          #   0, 1 Item
I:     (0040,0009) SH (no value available)                     #   0, 0 ScheduledProcedureStepID
I:     (0040,1001) SH (no value available)                     #   0, 0 RequestedProcedureID
I:   (fffe,e00d) na (ItemDelimitationItem for re-encoding)   #   0, 0 ItemDelimitationItem
I: (fffe,e0dd) na (SequenceDelimitationItem for re-encod.) #   0, 0 SequenceDelimitationItem
I:
I: Received Final Find Response (Failed: UnableToProcess)
I: Releasing Association
```

When I skip the SQ 0040,0275 with its items, then I get a response.

Cheers, Harald
Comment 5 Sébastien Jodogne 2020-06-29 15:25:18 CEST
[BitBucket user: Sébastien Jodogne]
[BitBucket date: 2019-04-05.11:36:19]

Fix issue #136 (C-Find request fails when found DICOM file does not have certain tags)

→ https://hg.orthanc-server.com/orthanc/changeset/63f59ad9381a