Skip to content

Commit 7030e7d

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 1e68a5a commit 7030e7d

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

monai/transforms/clinical_preprocessing.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ class UnsupportedModalityError(ValueError):
2121
def get_ct_preprocessing_pipeline() -> Compose:
2222
"""
2323
Create a preprocessing pipeline for CT (Computed Tomography) images.
24-
24+
2525
Returns:
2626
Compose: A transform composition for CT preprocessing.
27-
27+
2828
The pipeline consists of:
2929
1. LoadImage - Load DICOM series
3030
2. EnsureChannelFirst - Add channel dimension
3131
3. ScaleIntensityRange - Scale Hounsfield Units (HU) from [-1000, 400] to [0, 1]
32-
32+
3333
Note:
3434
The HU window [-1000, 400] is a common soft tissue window.
3535
"""
@@ -43,15 +43,15 @@ def get_ct_preprocessing_pipeline() -> Compose:
4343
def get_mri_preprocessing_pipeline() -> Compose:
4444
"""
4545
Create a preprocessing pipeline for MRI (Magnetic Resonance Imaging) images.
46-
46+
4747
Returns:
4848
Compose: A transform composition for MRI preprocessing.
49-
49+
5050
The pipeline consists of:
5151
1. LoadImage - Load DICOM series
5252
2. EnsureChannelFirst - Add channel dimension
5353
3. NormalizeIntensity - Normalize non-zero voxels
54-
54+
5555
Note:
5656
Normalization is applied only to non-zero voxels to avoid bias from background.
5757
"""
@@ -81,14 +81,14 @@ def preprocess_dicom_series(path: str, modality: str) -> MetaTensor:
8181
# Validate input type
8282
if not isinstance(modality, str):
8383
raise ModalityTypeError(f"modality must be a string, got {type(modality).__name__}")
84-
84+
8585
# Normalize modality string (strip whitespace, convert to uppercase)
8686
modality_clean = modality.strip().upper()
87-
87+
8888
# Map MRI to MR (treat as synonyms)
8989
if modality_clean == "MRI":
9090
modality_clean = "MR"
91-
91+
9292
# Select appropriate preprocessing pipeline
9393
if modality_clean == "CT":
9494
pipeline = get_ct_preprocessing_pipeline()
@@ -99,15 +99,15 @@ def preprocess_dicom_series(path: str, modality: str) -> MetaTensor:
9999
raise UnsupportedModalityError(
100100
f"Unsupported modality '{modality}'. Supported modalities: {', '.join(supported)}"
101101
)
102-
102+
103103
# Apply preprocessing pipeline
104104
return pipeline(path)
105105

106106

107107
# Export the public API
108108
__all__ = [
109109
"ModalityTypeError",
110-
"UnsupportedModalityError",
110+
"UnsupportedModalityError",
111111
"get_ct_preprocessing_pipeline",
112112
"get_mri_preprocessing_pipeline",
113113
"preprocess_dicom_series",

0 commit comments

Comments
 (0)