pydicom / deid

best effort anonymization for medical images using python
https://pydicom.github.io/deid/
MIT License
140 stars 43 forks source link

WARNING No specification, loading default base deid.dicom #157

Closed vpapaioannou closed 3 years ago

vpapaioannou commented 3 years ago

I run the following lines of code,


# get some data provided by deid itself
from deid.data import get_dataset
# get files from everywhere using fnmatch
from deid.dicom import get_files, get_identifiers

# load data
# the directory of the data provided by deid itself
base = get_dataset( "dicom-cookies")
# get data within _datasets subdirectory
dicom_files = sorted( list( get_files( "./", pattern = "*[a]*.dcm")))

# get identifiers
ids = get_identifiers( dicom_files)
ids, dicom_files

and I get the warning WARNING No specification, loading default base deid.dicom. I did some investigation, I didn't find the reason. Could you please explain?

Thanks

vsoch commented 3 years ago

If you are just using get_identifiers and not providing a deid recipe (a specification to say actions you want to perform) deid is going to use the default that is provided, here.

https://github.com/pydicom/deid/blob/master/deid/data/deid.dicom

That's what the message is telling you. The warning is a warning only, it does not exit the script or otherwise raise an error.

skarrea commented 3 years ago

Can I pitch in? I was kind of wondering about the same thing - the warning arises from the get_identifiers call. From the definition of the get_identifiers I can't seem to figure out where to specify the recipe:

def get_identifiers(
    dicom_files, force=True, config=None, strip_sequences=False, remove_private=False
):
vsoch commented 3 years ago

Please see https://github.com/pydicom/deid/pull/159 as a suggested solution.

vsoch commented 3 years ago

Fixed with https://github.com/pydicom/deid/pull/159. Thanks!

vpapaioannou commented 3 years ago

When calling get_identifiers there is a config argument. If you don't pass a value for it you get the warning while internally a default recipe is used. If you still want the default recipe to be considered but don't get the warning, pass config = None.