Utils
            utils
#
    DICOM Utilities.
This module provides utilities for: - Searching and validating DICOM files in directories. - Looking up DICOM tags by keywords with optional hexadecimal formatting. - Checking the existence of DICOM tags. - Finding similar DICOM tags.
Functions:
| Name | Description | 
|---|---|
lookup_tag | 
              
                 Lookup the tag for a given DICOM keyword.  | 
            
similar_tags | 
              
                 Find similar DICOM tags for a given keyword.  | 
            
tag_exists | 
              
                 Boolean check if a DICOM tag exists for a given keyword.  | 
            
            lookup_tag
  
      cached
  
#
lookup_tag(
    keyword: str, hex_format: bool = False
) -> typing.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
              
            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 | 
|---|---|
                  typing.List[str]
             | 
            
               A list of up to   | 
          
Examples:
Find similar tags for a misspelled keyword:
Adjust the number of results and threshold:
Source code in src/imgtools/dicom/utils.py
              
            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: