REST API of Orthanc and DICOM Query/Retrieve

Hi, everyone!

Question: how can I perform a query retrieve that slightly cross the border between consecutive days?

I’ve been looking into query/retrieve as a means of importing image data from any given PACS. Through the Rest API we can perform query/retrieve with no hassle like so:

[valmont@alis-sol 20190115]$ curl -X POST --url http://10.36.143.131:8042/modalities/pacs/query --data ‘{“Level”:“Instance”,“Query”:{“StudyDate”:“20190115-20190115”,“StudyTime”:“0000-0005”}}’
{
“ID” : “dc297964-d437-42f5-9290-cb9a9f3d14f8”,
“Path” : “/queries/dc297964-d437-42f5-9290-cb9a9f3d14f8”
}
[valmont@alis-sol 20190115]$ curl -X GET --url http://10.36.143.131:8042/queries/dc297964-d437-42f5-9290-cb9a9f3d14f8/answers | head
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1643 100 1643 0 0 131k 0 --:–:-- --:–:-- --:–:-- 145k
[
“0”,
“1”,
“2”,
“3”,
“4”,
“5”,
“6”,
“7”,
“8”,
[valmont@alis-sol 20190115]$

With the /answers result we go to the retrieving part, which is straightforward and that is great!

But I’d like to perform queries that entail some “10 minutes ago” worth of data. Because of that, when a new day dawns, my query will look like so:

{“Level”:“Instance”,“Query”:{“StudyDate”:“20190114-20190115”,“StudyTime”:“2355-0005”}}

But this query returns nothing, even though the previous one returns almost 200 results. Is it possible to accomplish this? I suppose the page to look, beyond The Orthanc Book, is this: http://dicom.nema.org/Dicom/2013/output/chtml/part04/sect_C.2.html

Section C.2.2.2.5 describes range matching. It talks of queries that span multiple days, it is true. But it works under the assumption that in the query (sample’d) “StudyTime: A-B”, A is less than or equal to B.

I can try and perform two requests (from 2355 untill 0000 and then 0000 until 0005). But I’d rather not do it unless there’s no other way.

I’d be really grateful for any help you can give.

Thanks!

In other words, I’d like the query to mean, for instance: from May 1st 23:55 until May 2nd 00:05.

I am 99% sure you cannot do that. The search parameters are independent, so basically you are searching for a study that is done on those two days, between 0000 and 0005. You would most likely need to do two queries.

I’ll do that. It’s not that hard to do: given the query “StudyTimeA-StudyTimeB” split it as “StudyTimeA-2359” and “0000-StudyTimeB” (doing something similar to the dates). Might save tons of time.

Thanks!

Hello,

If I were told to find, say, the studies whose datetime is between “2019-01-05 at 9:00pm” and “2019-01-07 at 7:00am”, I would:

(1) Filter the “StudyDate” tag using “20190105-20190107” range (using DICOM/REST), asking also for “StudyTime”. This would return “too many” results.

(2) In my client software, I would apply the exact filter, given my knowledge of the “StudyDate” and “StudyTime” tags for all the matching studies returned by the call above.

HTH,

Sébastien-