44from .resources import Resources
55from ..tags import Tags
66from ..exceptions import *
7- from ..study import StudyInfo , Study
7+ from ..study import Study
8+ from ..instance import Instance
89from ..helpers import to_dicom_date , to_dicom_time
910from ..downloaded_instance import DownloadedInstance
1011from ..labels_constraint import LabelsConstraint
@@ -25,6 +26,23 @@ def get_instances_ids(self, orthanc_id: str) -> List[str]:
2526
2627 return instances_ids
2728
29+ def get_instances (self , orthanc_id : str ) -> List [Instance ]:
30+ instances = []
31+
32+ instances_info = self ._api_client .post (
33+ f"tools/find" ,
34+ json = {
35+ "Level" : "Instance" ,
36+ "Query" : {},
37+ "ResponseContent" : ["MainDicomTags" , "Metadata" , "Parent" , "Labels" ],
38+ "ParentStudy" : orthanc_id
39+ }).json ()
40+
41+ for instance_info in instances_info :
42+ instances .append (Instance .from_json (self ._api_client , instance_info ))
43+
44+ return instances
45+
2846 def get_series_ids (self , orthanc_id : str ) -> List [str ]:
2947 study_info = self ._api_client .get_json (f"{ self ._url_segment } /{ orthanc_id } " )
3048 return study_info ["Series" ]
@@ -58,11 +76,11 @@ def lookup(self, dicom_id: str) -> str:
5876 def find (self ,
5977 query : object ,
6078 case_sensitive : bool = True ,
61- labels : [str ] = [],
79+ labels : List [str ] = [],
6280 labels_constraint : LabelsConstraint = LabelsConstraint .ANY ,
6381 limit : int = 0 ,
6482 since : int = 0 ,
65- order_by : [dict ] = []
83+ order_by : List [dict ] = []
6684 ) -> List [Study ]:
6785 """
6886 find a study in Orthanc based on the query and the labels
0 commit comments