Dicom reader
            dicom_reader
#
    Functions:
| Name | Description | 
|---|---|
load_dicom | 
              
                 Load a DICOM file and return the parsed FileDataset object.  | 
            
path_from_pathlike | 
              
                 Return the string representation if file_object is path-like,  | 
            
            load_dicom
#
load_dicom(
    dicom_input: imgtools.dicom.dicom_reader.DicomInput,
    force: bool = True,
    stop_before_pixels: bool = True,
    **kwargs: typing.Any
) -> pydicom.dataset.FileDataset
Load a DICOM file and return the parsed FileDataset object.
This function supports various input types including file paths, byte streams,
and file-like objects. It uses the pydicom.dcmread function to read the DICOM file.
Notes
- If 
dicom_inputis already aFileDataset, it is returned as is. - If 
dicom_inputis a file path or file-like object, it is read usingpydicom.dcmread. - If 
dicom_inputis a byte stream, it is wrapped in aBytesIOobject and then read. - An 
InvalidDicomErroris raised if the input type is unsupported. 
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
                               | 
            
                  pydicom.dataset.FileDataset | str | pathlib.Path | bytes | typing.BinaryIO
             | 
            
               Input DICOM file as a   | 
            required | 
                               | 
            
                  bool
             | 
            
               Whether to allow reading DICOM files missing the File Meta Information header, by default True.  | 
            
                  True
             | 
          
                               | 
            
                  bool
             | 
            
               Whether to stop reading the DICOM file before loading pixel data, by default True.  | 
            
                  True
             | 
          
                               | 
            
                  typing.Any
             | 
            
               Additional keyword arguments to pass to   | 
            
                  {}
             | 
          
Returns:
| Type | Description | 
|---|---|
                  pydicom.dataset.FileDataset
             | 
            
               Parsed DICOM dataset.  | 
          
Source code in src/imgtools/dicom/dicom_reader.py
              
            path_from_pathlike
#
path_from_pathlike(
    file_object: str | pathlib.Path | typing.BinaryIO,
) -> str | typing.BinaryIO
Return the string representation if file_object is path-like, otherwise return the object itself.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
                               | 
            
                  str | pathlib.Path | typing.BinaryIO
             | 
            
               File path or file-like object.  | 
            required | 
Returns:
| Type | Description | 
|---|---|
                  str | typing.BinaryIO
             | 
            
               String representation of the path or the original file-like object.  |