diff --git a/idc_index/index.py b/idc_index/index.py index 0d113bc1..c6d0ea5b 100644 --- a/idc_index/index.py +++ b/idc_index/index.py @@ -153,7 +153,7 @@ def _safe_filter_by_selection( patientId, studyInstanceUID, seriesInstanceUID, - sopInstanceUID=None, + sopInstanceUID, crdc_series_uuid, ): if collection_id is not None: @@ -205,10 +205,10 @@ def _safe_filter_by_selection( if sopInstanceUID is not None: result_df = IDCClient._filter_by_dicom_instance_uid( - result_df, sopInstanceUID + df_index, sopInstanceUID ) return result_df - + if seriesInstanceUID is not None: result_df = IDCClient._filter_by_dicom_series_uid( df_index, seriesInstanceUID @@ -1512,6 +1512,7 @@ def citations_from_selection( patientId=patientId, studyInstanceUID=studyInstanceUID, seriesInstanceUID=seriesInstanceUID, + sopInstanceUID=None, crdc_series_uuid=None, ) @@ -1604,10 +1605,7 @@ def download_from_selection( raise ValueError( "Instance-level access not possible because instance-level index not installed." ) - else: - download_df = self.index - - if crdc_series_uuid is not None: + elif crdc_series_uuid is not None: download_df = pd.concat( [ self.index[ diff --git a/tests/idcindex.py b/tests/idcindex.py index 18c8311a..66b875b9 100644 --- a/tests/idcindex.py +++ b/tests/idcindex.py @@ -15,6 +15,9 @@ # Run tests using the following command from the root of the repository: # python -m unittest -vv tests/idcindex.py +# +# run specific tests with this: +# pytest ./tests/idcindex.py::TestIDCClient.test_download_dicom_instance logging.basicConfig(level=logging.DEBUG)