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 !
Still on this matter I am now facing multi frame Instances,
is there an endpoint to count the number of frames and could this additional info be added to the /statistics
endpoint?
Hello,
The /statistics
endpoint is there to provide high-level information about the database, but counting the number of frames would require looping over all the DICOM instances.
If this feature is useful to you, you could overwrite the /statistics
endpoint by a plugin (e.g. in Python) that would call /instances/{id}/frames
to retrieve the number of frames in each instance of your database.
As an example, here is how to get the number of frames in one multi-frame instance on our demo server:
$ curl https://orthanc.uclouvain.be/demo/instances/6a75616c-e39d96cb-e752cdd5-4f65d1b1-dee0451e/file
Regards,
SĂ©bastien-