Number of Images When Perfomring a Query

Good Day All,
When performing a REST call against modalities//query is there a way to retrieve the number of images within the returned studies?

The way that I do this is to perform a query at the Instance level (https://api.orthanc-server.com/#tag/Networking/paths/~1modalities~1{id}~1query/post) rather than the study level. You can then get the answers to the query by using https://api.orthanc-server.com/#tag/Networking/paths/~1queries~1{id}~1answers/get. You can then count the number of instances by the number of responses or use the expand parameter to inspect further detail.

James

Hello,

The DICOM standard specifies “Additional Query/Retrieve Attributes” that can be used to that end:
http://dicom.nema.org/medical/dicom/current/output/chtml/part04/sect_C.3.4.html

For instance:

$ curl http://localhost:8042/modalities/sample/query -d ‘{“Level”:“Study”,“Query”:{“NumberOfStudyRelatedInstances”:“”,“NumberOfStudyRelatedSeries”:“”}}’

{
“ID” : “c0efd0e0-4fd0-4f79-a354-f0330ced6d4a”,
“Path” : “/queries/c0efd0e0-4fd0-4f79-a354-f0330ced6d4a”
}

$ curl ‘http://localhost:8042/queries/c0efd0e0-4fd0-4f79-a354-f0330ced6d4a/answers?expand&simplify
[
{
“AccessionNumber” : “XXX”,
“NumberOfStudyRelatedInstances” : “1”,
“NumberOfStudyRelatedSeries” : “1”,
“PatientID” : “XXX”,
“QueryRetrieveLevel” : “STUDY”,
“RetrieveAETitle” : “ORTHANC”,
“SpecificCharacterSet” : “ISO_IR 100”,
“StudyInstanceUID” : “XXX”
},
{
“AccessionNumber” : “XXX”,
“NumberOfStudyRelatedInstances” : “46”,
“NumberOfStudyRelatedSeries” : “2”,
“PatientID” : “XXX”,
“QueryRetrieveLevel” : “STUDY”,
“RetrieveAETitle” : “ORTHANC”,
“SpecificCharacterSet” : “ISO_IR 100”,
“StudyInstanceUID” : “XXX”
}
]

HTH,
Sébastien-

Sorry to dig an old topic, but checking the API I see /studies/{id}/statistics that displays a nice

"CountInstances" : 736,

Getting /studies/{id}/instances and counting the resulting objects I see the same number.

Is the former endpoint safe to count images per studyInstanceUID?

yes !

1 Like