Skip to content

Commit

Permalink
Update standard to rev2024b
Browse files Browse the repository at this point in the history
- Add new workarounds
- Update tests
  • Loading branch information
russellkan committed Apr 18, 2024
1 parent 7008b61 commit 8670abd
Show file tree
Hide file tree
Showing 22 changed files with 30,479 additions and 27,920 deletions.
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,16 @@ significantly.
### Updating the Standard

To download and parse the most up-to-date web version of the DICOM Standard,
run the following commands:
run the following commands in the `dicom_standard` directory:

$ make clean
$ make updatestandard
$ make

Then copy the output to the `standard/` directory:

$ cp dist/* ../standard/

To download an older version of the DICOM Standard, run

$ make updatestandard VERSION=<version>
Expand Down Expand Up @@ -236,7 +240,7 @@ Certain parts of the DICOM Standard site cause errors when running the parser, o

When we find one of these issues, we add a hard-coded fix in the relevant file and add a comment starting with 'Standard workaround' that describes the issue and links to its location in the Standard. To be aware when these fixes are obsolete, we add a unit test that fails once the issue no longer exists.

Current standard workarounds (as of rev.2023e):
Current standard workarounds (as of rev.2024b):
| *Issue description* | *Workaround location* |
|---|---|
| [Table TID 1004](http://dicom.nema.org/medical/dicom/current/output/chtml/part16/chapter_A.html#sect_TID_1004) has a section URL pattern ("sect_TID_1004") that doesn't exist within the HTML version of the standard | `parse_lib.py` |
Expand All @@ -247,6 +251,9 @@ Current standard workarounds (as of rev.2023e):
| The "Referenced Patient Alias Sequence" attribute is noted to be retired in [Table 6-1](https://dicom.nema.org/medical/dicom/current/output/chtml/part06/chapter_6.html#para_74d743fc-e532-4817-8477-58d1e9a8de57) but is not retired in [Table E.1-1](https://dicom.nema.org/medical/dicom/current/output/html/part15.html#para_26d0b4be-9dae-4b57-ab18-8e524dde7dc1) | `extract_conf_profile_attributes.py` |
| The [Confocal Microscopy Image Functional Group Macros](https://dicom.nema.org/medical/dicom/current/output/chtml/part03/sect_A.90.html#sect_A.90.1.5) section doesn't have a description, causing the "module_type" value to be None when it should be "Multi-frame" | `extract_ciod_func_group_macro_tables.py` |
| The [Confocal Microscopy Tiled Pyramidal Image Functional Group Macros](https://dicom.nema.org/medical/dicom/current/output/chtml/part03/sect_A.90.2.5.html#sect_A.90.2.5) section doesn't have a description, causing the "module_type" value to be None when it should be "Multi-frame" | `extract_ciod_func_group_macro_tables.py` |
| [Table A.89.4-1](https://dicom.nema.org/medical/dicom/current/output/chtml/part03/sect_A.89.4.html#table_A.89.4-1) is missing part of the IOD name ("Photoacoustic" instead of "Photoacoustic Image") in its title | `extract_ciod_func_group_macro_tables.py` |
| The "Confocal Micrsocopy Tiled Pyramidal" IOD Specification in [Table B.5-1](https://dicom.nema.org/medical/dicom/current/output/chtml/part04/sect_B.5.html#table_B.5-1) should include the word "Image" after "Pyramidal" | `extract_sops.py`
| The "Pseudo-color Softcopy Presentation State" IOD Specification in [Table B.5-1](https://dicom.nema.org/medical/dicom/current/output/chtml/part04/sect_B.5.html#table_B.5-1) should have an upper-case "C" in "Color" | `extract_sops.py`

(\*) This issue is not caused by a typo or error in the Standard but rather an exception from the normal format and thus does not have a unit test for a fix.

Expand Down
8 changes: 4 additions & 4 deletions dicom_standard/extract_ciod_func_group_macro_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@

def clean_macro_table_name(table_name: str) -> str:
clean_name = pl.clean_table_name(table_name)
# Standard workaround: Mismatch of 'Photoacoustic Reconstruction Algorithm' name
# Standard workaround: Table A.89.4-1 is missing part of the IOD name ("Photoacoustic" instead of "Photoacoustic Image") in its title
# https://dicom.nema.org/medical/dicom/current/output/chtml/part03/sect_A.89.4.html#table_A.89.4-1
if clean_name == 'Photoacoustic Reconstruction Algorithm Macro Attributes':
clean_name = 'Photoacoustic Reconstruction Algorithm'
if clean_name == 'Photoacoustic':
clean_name = 'Photoacoustic Image'
return clean_name


Expand All @@ -56,7 +56,7 @@ def get_table_with_metadata(table_with_tdiv: Tuple[List[TableDictType], Tag]) ->
# https://dicom.nema.org/medical/dicom/current/output/chtml/part03/sect_A.90.2.5.html#sect_A.90.2.5
# https://dicom.nema.org/medical/dicom/current/output/chtml/part03/sect_A.90.html#para_432a2653-f9c3-474e-829b-3997312e0ecd
# Example valid section: https://dicom.nema.org/medical/dicom/current/output/chtml/part03/sect_A.8.3.5.html
if clean_name == "Confocal Microscopy Image" or clean_name == "Confocal Microscopy Tiled Pyramidal Image":
if clean_name == 'Confocal Microscopy Image' or clean_name == 'Confocal Microscopy Tiled Pyramidal Image':
module_type = 'Multi-frame'
return {
'name': clean_name,
Expand Down
24 changes: 9 additions & 15 deletions dicom_standard/extract_sops.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,19 @@

COLUMN_TITLES = ['name', 'id', 'ciod']
TABLE_IDS = ['table_B.5-1', 'table_I.4-1', 'table_GG.3-1']
IOD_ABBREVIATIONS = {
'Computed Radiography Image': 'CR Image',
'Ultrasound Multi-frame Image': 'US Multi-frame Image',
'Ultrasound Image': 'US Image',
'Multi-frame Single Bit Secondary Capture Image': 'Multi-frame Single Bit SC Image',
'Multi-frame Grayscale Byte Secondary Capture Image': 'Multi-frame Grayscale Byte SC Image',
'Multi-frame Grayscale Word Secondary Capture Image': 'Multi-frame Grayscale Word SC Image',
'Multi-frame True Color Secondary Capture Image': 'Multi-frame True Color SC Image',
'Pseudo-color Softcopy Presentation State': 'Pseudo-Color Softcopy Presentation State',
'Intravascular Optical Coherence Tomography': 'Intravascular Optical Coherence Tomography Image', # Inconsistent name: http://dicom.nema.org/medical/Dicom/current/output/chtml/part03/sect_A.66.html
'Nuclear Medicine Image': 'NM Image',
'Patient Radiation Dose SR': 'Patient Radiation Dose Structured Report',
'Positron Emission Tomography Image': 'PET Image',
}


def generate_ciod_id(name: str) -> str:
cleaned_name = name.split('IOD')[0].strip()
return IOD_ABBREVIATIONS.get(cleaned_name, cleaned_name)
# Standard workaround: Table B.5-1 is missing part of the IOD name ("Confocal Microscopy Tiled Pyramidal" instead of "Confocal Microscopy Tiled Pyramidal Image")
# https://dicom.nema.org/medical/dicom/current/output/chtml/part04/sect_B.5.html#table_B.5-1
if cleaned_name == 'Confocal Microscopy Tiled Pyramidal':
cleaned_name = 'Confocal Microscopy Tiled Pyramidal Image'
# Standard workaround: Table B.5-1 has a miscapitalized word in an IOD Specification
# https://dicom.nema.org/medical/dicom/current/output/chtml/part04/sect_B.5.html#table_B.5-1
if cleaned_name == 'Pseudo-color Softcopy Presentation State':
cleaned_name = 'Pseudo-Color Softcopy Presentation State'
return cleaned_name


def sop_table_to_json(table: List[TableDictType]) -> List[TableDictType]:
Expand Down
5 changes: 0 additions & 5 deletions dicom_standard/parse_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,6 @@ def clean_table_name(name: str) -> str:
_, _, title = re.split('\u00a0', name)
possible_table_suffixes = r'(IOD Modules)|(Module Attributes)|((Functional Group)? Macro Attributes)|(Module Table)|(Functional Group Macros)'
clean_title = re.split(possible_table_suffixes, title)[0]
# Standard workaround: Macro table name 'Photoacoustic Reconstruction Algorithm Attributes',
# which is not following the normal format
# https://dicom.nema.org/medical/dicom/2023c/output/chtml/part03/sect_A.89.4.html#table_A.89.4-1
if clean_title == 'Photoacoustic Reconstruction Algorithm Attributes':
clean_title = 'Photoacoustic Reconstruction Algorithm'
return clean_title.strip()


Expand Down
Loading

0 comments on commit 8670abd

Please sign in to comment.