Repository: comic/grand-challenge.org

Issue:
Add Laterality (value CS: L or R) to optional DICOM/MHD fields
**Is your feature request related to a problem? Please describe.**
My current algorithm only works on x-rays of the right hand, and therefore I would like to access the Laterality DICOM tag (0020,0060) so that the input image can be automatically flipped. At the moment, all tags are automatically removed from the uploaded file, except for a set of predefined tags in the code.

https://dicom.innolitics.com/ciods/cr-image/general-series/00200060

**Describe the solution you'd like**
It would be nice if users can submit a list of DICOM tags that they wish to preserve. 

**Describe alternatives you've considered**
- Develop a separate deep learning model that can recognize the laterality and/or orientation of the image.
- Instruct users to upload only x-rays of the right hand. 



Discussion:

Resolving patch:
diff --git a/app/grandchallenge/cases/image_builders/dicom.py b/app/grandchallenge/cases/image_builders/dicom.py
--- a/app/grandchallenge/cases/image_builders/dicom.py
+++ b/app/grandchallenge/cases/image_builders/dicom.py
@@ -27,6 +27,7 @@
 
 OPTIONAL_METADATA_FIELDS = (
     # These fields will be included in the output mha file
+    "Laterality",
     "PatientID",
     "PatientName",
     "PatientBirthDate",
diff --git a/app/grandchallenge/cases/image_builders/metaio_utils.py b/app/grandchallenge/cases/image_builders/metaio_utils.py
--- a/app/grandchallenge/cases/image_builders/metaio_utils.py
+++ b/app/grandchallenge/cases/image_builders/metaio_utils.py
@@ -56,6 +56,7 @@
 STUDYDATE_MATCH_REGEXP: Pattern = re.compile(r"^\d{4}\d{1,2}\d{1,2}$")
 
 ADDITIONAL_HEADERS: Dict[str, Pattern] = {
+    "Laterality": LENGTH_LIMIT_MATCH_REGEXP,
     "PatientID": LENGTH_LIMIT_MATCH_REGEXP,
     "PatientName": LENGTH_LIMIT_MATCH_REGEXP,
     "PatientBirthDate": LENGTH_LIMIT_MATCH_REGEXP,


Test patch:
diff --git a/app/tests/cases_tests/resources/image10x10x10-extra-stuff.mhd b/app/tests/cases_tests/resources/image10x10x10-extra-stuff.mhd
--- a/app/tests/cases_tests/resources/image10x10x10-extra-stuff.mhd
+++ b/app/tests/cases_tests/resources/image10x10x10-extra-stuff.mhd
@@ -30,6 +30,7 @@ PatientName = ☺😄☺☺☺☺☺☺☺☺☺☺☺☺☺☺☺☺☺☺☺
 StudyDate = 20020304
 StudyInstanceUID = 1.2.3.4
 SeriesInstanceUID = 1.2.3.4
+Laterality = L
 
 
 
diff --git a/app/tests/cases_tests/resources/image10x11x12x13-extra-stuff.mhd b/app/tests/cases_tests/resources/image10x11x12x13-extra-stuff.mhd
--- a/app/tests/cases_tests/resources/image10x11x12x13-extra-stuff.mhd
+++ b/app/tests/cases_tests/resources/image10x11x12x13-extra-stuff.mhd
@@ -24,6 +24,7 @@ t1 = 1.2e-6
 PatientBirthDate = 20200101
 PatientAge = 001Y
 PatientSex = M
+Laterality = L
 StudyDescription = super awesome study
 Bogus = nonsense 1234
 WindowCenter = 20
diff --git a/app/tests/cases_tests/resources/image3x4-extra-stuff.mhd b/app/tests/cases_tests/resources/image3x4-extra-stuff.mhd
--- a/app/tests/cases_tests/resources/image3x4-extra-stuff.mhd
+++ b/app/tests/cases_tests/resources/image3x4-extra-stuff.mhd
@@ -25,6 +25,7 @@ SeriesInstanceUID = 1.2.3.4
 PatientBirthDate = 20200101
 PatientAge = 001Y
 PatientSex = M
+Laterality = R
 StudyDescription = super awesome study
 SliceThickness = 2
 WindowCenter = 20.5