Tag Helpers
imgtools.dicom.utils.lookup_tag
cached
lookup_tag(keyword: str, hex_format: bool = False) -> Optional[str]
Lookup the tag for a given DICOM keyword.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
str
|
The DICOM keyword to look up. |
required |
|
bool
|
If True, return the tag in hexadecimal format (default is False). |
False
|
Returns:
Type | Description |
---|---|
str or None
|
The DICOM tag as a string, or None if the keyword is invalid. |
Examples:
Lookup a DICOM tag in decimal format:
Lookup a DICOM tag in hexadecimal format:
Source code in src/imgtools/dicom/utils.py
imgtools.dicom.utils.tag_exists
cached
tag_exists(keyword: str) -> bool
Boolean check if a DICOM tag exists for a given keyword.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
str
|
The DICOM keyword to check. |
required |
Returns:
Type | Description |
---|---|
bool
|
True if the tag exists, False otherwise. |
Examples:
Source code in src/imgtools/dicom/utils.py
imgtools.dicom.utils.similar_tags
cached
Find similar DICOM tags for a given keyword.
Useful for User Interface to suggest similar tags based on a misspelled keyword.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
str
|
The keyword to search for similar tags. |
required |
|
int
|
Maximum number of similar tags to return (default is 3). |
3
|
|
float
|
Minimum similarity ratio (default is 0.6). |
0.6
|
Returns:
Type | Description |
---|---|
List[str]
|
A list of up to |
Examples:
Find similar tags for a misspelled keyword:
Adjust the number of results and threshold: