diff --git a/CHANGELOG.md b/CHANGELOG.md index e374ef84..6787feb1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ and **Merged pull requests**. Critical items to know are: Referenced versions in headers are tagged on Github, in parentheses are for pypi. ## [vxx](https://github.com/pydicom/deid/tree/master) (master) + - adding stop_before_pixels to read_file in parser (0.2.24) - removing verbosity of debug logger (0.2.23) - changing iteration technique through fields to properly add nested uids [#153](https://github.com/pydicom/deid/issues/153) (0.2.22) - change to return results from detect when recipe does not contain filters [#155](https://github.com/pydicom/deid/issues/155) diff --git a/deid/dicom/header.py b/deid/dicom/header.py index 3d4dd24d..a96bd984 100644 --- a/deid/dicom/header.py +++ b/deid/dicom/header.py @@ -44,7 +44,12 @@ def get_identifiers( - dicom_files, force=True, config=None, strip_sequences=False, remove_private=False + dicom_files, + force=True, + config=None, + strip_sequences=False, + remove_private=False, + stop_before_pixels=False, ): """extract all identifiers from a dicom image. This function returns a lookup by file name, where each value indexed diff --git a/deid/dicom/parser.py b/deid/dicom/parser.py index 25c050fb..16e420ae 100644 --- a/deid/dicom/parser.py +++ b/deid/dicom/parser.py @@ -53,7 +53,9 @@ class DicomParser: file. For each, we store the element and child elements """ - def __init__(self, dicom_file, recipe=None, config=None, force=True): + def __init__( + self, dicom_file, recipe=None, config=None, force=True, stop_before_pixels=False + ): # Lookup for the dicom self.lookup = {} @@ -70,7 +72,7 @@ def __init__(self, dicom_file, recipe=None, config=None, force=True): # Deid can be a recipe or filename if not isinstance(recipe, DeidRecipe): recipe = DeidRecipe(recipe) - self.load(dicom_file, force=force) + self.load(dicom_file, force=force, stop_before_pixels=stop_before_pixels) self.recipe = recipe def __str__(self): @@ -79,7 +81,7 @@ def __str__(self): def __repr__(self): return self.__str__() - def load(self, dicom_file, force=True): + def load(self, dicom_file, force=True, stop_before_pixels=False): """Ensure that the dicom file exists, and use full path. Here we load the file, and save the dicom, dicom_file, and dicom_name. """ @@ -94,7 +96,9 @@ def load(self, dicom_file, force=True): # If we must read the file, the path must exist if not os.path.exists(dicom_file): bot.exit("%s does not exist." % dicom_file) - self.dicom = read_file(dicom_file, force=force) + self.dicom = read_file( + dicom_file, force=force, stop_before_pixels=stop_before_pixels + ) # Set class variables that might be helpful later self.dicom_file = os.path.abspath(self.dicom.filename) diff --git a/deid/version.py b/deid/version.py index aa37e549..8502d7bd 100644 --- a/deid/version.py +++ b/deid/version.py @@ -22,7 +22,7 @@ """ -__version__ = "0.2.23" +__version__ = "0.2.24" AUTHOR = "Vanessa Sochat" AUTHOR_EMAIL = "vsochat@stanford.edu" NAME = "deid"