Medical Image Preprocessing: Techniques, Workflows, and Best Practices

Collective Minds Radiology Preprocessing Medical Images

A central reader opens a follow-up brain MRI and the tumor margin looks different from the baseline scan, not because the tumor has changed, but because the scanner, the coil, and the acquisition protocol have. Multiply that across dozens of sites and hundreds of subjects in a multicenter trial, and the same anatomy can produce visibly different pixel intensities before a single diagnostic decision is even made. This is the problem preprocessing solves.

Medical image preprocessing is the set of operations applied to raw imaging data before it reaches a radiologist, an algorithm, or a clinical trial endpoint. It includes tasks such as removing background and non-anatomical regions, correcting noise and artifacts, standardizing intensity and voxel size, and aligning images to a common space, all so that images from different scanners, protocols, and time points can be compared on equal footing. Get preprocessing wrong, and even the best segmentation model or the most experienced reader is working from a biased starting point.

This guide walks through the core preprocessing techniques used across MRI, CT, and other modalities, how to sequence them into a pipeline, the practices that keep results reproducible, and the tools researchers and imaging teams actually use to get there.

Medical image preprocessing techniques and when to use them

Not every technique applies to every image. The list below covers the preprocessing operations that show up most often in medical imaging pipelines, what problem each one solves, and when to reach for it.

1. Background removal and region-of-interest extraction

Background removal, also called region of interest (ROI) segmentation, isolates the anatomy that matters from everything else in the frame, scanner bed, air, non-target organs, so that later steps are not skewed by irrelevant pixels. In brain MRI, this usually means skull stripping: removing the skull, scalp, and other non-brain tissue before segmentation or volumetric analysis. Atlas-based extraction tools, such as ANTs' brain extraction workflow, register the raw scan to a labeled template and use the resulting mask to isolate brain tissue automatically.

Implementation:

import numpy as np
from skimage import morphology

def remove_background(image, mask):
return image * mask

# 'mask' is a binary ROI mask
processed_image = remove_background(image, mask)

Getting ROI extraction right early in the pipeline matters because later steps, like intensity normalization or registration, then work on a smaller and more relevant portion of the image. This step is closely tied to medical image segmentation, which typically consumes the ROI mask as its starting point.

2. Image denoising

Every acquisition introduces some degree of random intensity fluctuation, from thermal noise in MRI receiver coils to quantum mottle in low-dose CT. Denoising reduces that noise while preserving the structural detail a radiologist or a model actually needs to see.

Common methods include Gaussian and median filtering for straightforward noise reduction, wavelet-based denoising for a better balance between smoothing and edge preservation, and deep learning-based denoisers for modality-specific noise patterns, such as speckle in ultrasound. The tradeoff is real: as freeCodeCamp's guide to preprocessing medical images puts it, aggressive denoising can erase the features a diagnosis or a machine learning model actually needs, so filters should be tuned and validated per modality rather than applied with default parameters.

Implementation:

from skimage.restoration import denoise_wavelet

def denoise_image(image):
return denoise_wavelet(image, method='BayesShrink', mode='soft', rescale_sigma=True)

denoised_image = denoise_image(image)

3. Intensity normalization and standardization

Unlike CT, where Hounsfield units give every voxel a physically calibrated meaning, MRI intensities are arbitrary. The same tissue can read as a different gray value on two different scanners, or even on the same scanner a year apart. Intensity normalization rescales pixel or voxel values onto a common scale so that images become comparable across patients, sites, and time points.

Simple approaches clip intensities to a percentile range and rescale to the image's data type range. More robust approaches, such as z-score normalization or the Nyúl method, rely on histogram matching: a standard intensity scale is learned from a reference set of images, and every new scan's histogram is then mapped onto that scale using a piecewise linear transform, an approach detailed in this histogram-based normalization study on brain MRI. WhiteStripe normalization, which anchors the scale to the intensity of normal-appearing white matter, is a common variant for brain MRI specifically.

Implementation:

import numpy as np

def normalize_intensity(image, min_percentile=0.5, max_percentile=99.5):
min_val = np.percentile(image, min_percentile)
max_val = np.percentile(image, max_percentile)
return (image - min_val) / (max_val - min_val)

normalized_image = normalize_intensity(image)

4. Bias field and intensity inhomogeneity correction

MRI has a preprocessing problem that CT does not: intensity inhomogeneity, often called the bias field. Imperfections in coil sensitivity and the magnetic field itself produce a smooth, low-frequency shift in brightness across the image, so the same tissue can appear brighter on one side of the brain than the other, even though nothing about the anatomy has changed. Left uncorrected, this bias field can distort segmentation, throw off intensity normalization, and introduce false variability into any quantitative analysis.

The N4ITK algorithm, an improvement on the earlier N3 method, is the standard approach: it fits a smooth B-spline model to the bias field using a hierarchical, multi-resolution optimization scheme, then divides it out of the image. A study on background parenchymal enhancement in breast MRI found that removing this bias is a critical preprocessing step for spatially consistent image interpretation. Because bias field correction changes the very values that normalization depends on, it should run before intensity normalization, not after, a sequencing detail that is easy to miss and easy to get wrong.

Implementation:

import SimpleITK as sitk

def correct_bias_field(image):
mask = sitk.OtsuThreshold(image, 0, 1, 200)
corrector = sitk.N4BiasFieldCorrectionImageFilter()
return corrector.Execute(image, mask)

corrected_image = correct_bias_field(mri_image)

5. Resampling and resizing

Resampling changes the pixel or voxel size of an image without altering what it represents spatially, standardizing resolution across a dataset collected on different scanners or protocols, a goal MathWorks' overview of medical image preprocessing describes as reducing acquisition artifacts while standardizing images across a dataset. A 3D volume acquired with 1.2mm slices needs to be resampled to a common isotropic voxel size, such as 1mm cubed, before it can be reliably compared, registered, or fed into a model with a fixed input size. For 2D images, resizing with an appropriate interpolation order and anti-aliasing preserves image quality; for 3D volumes, the same principle applies to voxel spacing.

Implementation:

from skimage.transform import resize

def resample_image(image, target_shape):
return resize(image, target_shape, order=3, mode='reflect', anti_aliasing=True)

resampled_image = resample_image(image, (256, 256, 128))

6. Image registration and spatial normalization

Registration aligns two or more images to a shared coordinate system, whether that means comparing a follow-up scan to a baseline in the same patient, fusing a PET scan with a CT for anatomical context, or mapping a subject's anatomy onto a standard template for population-level analysis. The alignment can be rigid (rotation and translation only), affine, or fully deformable, depending on how much the anatomy is expected to differ between the images being aligned.

Tools such as ANTs' antsRegistration use multiscale, mutual-information-based nonlinear registration to handle spatial normalization to standard spaces, a step fMRIPrep's preprocessing workflows apply as standard practice in neuroimaging pipelines to make results comparable across subjects and studies.

Implementation:

from skimage.registration import optical_flow_tvl1

def register_images(fixed_image, moving_image):
v, u = optical_flow_tvl1(fixed_image, moving_image)
return v, u

displacement_field = register_images(fixed_image, moving_image)

7. Artifact detection and correction

Not every distortion in a medical image comes from noise or intensity scaling, some come from the acquisition itself. Motion artifacts appear as blurring or ghosting when a patient moves during a scan. Susceptibility artifacts distort MRI near metal implants or air-tissue boundaries. Metal artifacts in CT show up as streaking radiating from dense objects like surgical hardware or dental fillings. Each of these needs to be identified before, not after, quantitative analysis, or the artifact itself can be mistaken for a clinical finding.

Detection typically combines automated quality control metrics, such as measuring signal dropout or edge sharpness, with visual review by a trained reader. Correction is artifact-specific: retrospective motion correction realigns frames after the fact, metal artifact reduction algorithms interpolate across the affected region in CT, and some MRI protocols avoid the problem at the source by adjusting the pulse sequence.

8. Contrast enhancement and intensity adjustment

Even a well-normalized, artifact-free image can hide diagnostically relevant detail if the contrast is poor. Contrast Limited Adaptive Histogram Equalization (CLAHE) redistributes intensity values within local regions of the image, boosting local contrast without over-amplifying noise the way global histogram equalization can. For CT, windowing serves a similar purpose: because Hounsfield units are already physically calibrated, adjusting the window level and width lets a reader emphasize bone, soft tissue, or lung detail from the same underlying scan without any change to the acquired data.

Implementation:

from skimage.exposure import equalize_adapthist

def enhance_contrast(image):
return equalize_adapthist(image, clip_limit=0.03)

enhanced_image = enhance_contrast(image)

How to build a medical image preprocessing pipeline

Individually, each of these techniques is well understood. The harder problem is sequencing them correctly, because preprocessing order is not universal. It depends on the imaging modality and the analysis that follows, and getting the order wrong can quietly invalidate the steps that come after it.

Before any of this starts, confirming the scanner, protocol, and acquisition parameters through DICOM metadata extraction tells you which modality-specific pipeline actually applies.

For brain MRI headed into a segmentation or volumetric pipeline, a typical order looks like this: correct the bias field first, since intensity inhomogeneity will otherwise be baked into every later intensity-based step; extract the region of interest, commonly skull stripping, so background voxels do not skew the next steps; normalize and standardize intensity across the dataset now that the bias field is gone; resample to a common voxel size; and register to a template or to a prior time point last, once the image intensities and resolution are stable.

CT pipelines look different because Hounsfield units are already calibrated at acquisition, so bias field correction and MRI-style intensity normalization are not needed. Instead, windowing, denoising, and artifact correction, particularly for metal artifacts, tend to dominate. Multi-modal pipelines, such as PET-CT or MRI-CT fusion, add registration as an early requirement rather than a late one, since every other step needs to operate on spatially aligned data.

The takeaway is not to memorize one sequence, but to understand what each transformation assumes about the image that comes before it, and to build research-ready imaging data rather than reordering steps out of habit.

Best practices for reliable medical image preprocessing

A preprocessing pipeline that works once on a handful of test images is not the same as one that holds up across a multicenter trial or a production model. A few practices separate the two:

  • Understand the data first. Know the acquisition protocol, scanner variability, and modality-specific quirks, arbitrary MRI intensities, calibrated CT Hounsfield units, ultrasound speckle, before choosing a technique.
  • Preserve the original data. Always keep the raw, unprocessed images. Preprocessing should be a reproducible transform, never a destructive edit.
  • Document every step and parameter. An audit trail of preprocessing decisions is not optional in a regulated clinical trial context, it is what makes a result defensible on review.
  • Validate the output. Spot-check preprocessed images against the originals throughout the pipeline, not just at the end.
  • Apply the same pipeline consistently across the full dataset. Inconsistent preprocessing introduces the same kind of variability the process is meant to eliminate.
  • Tailor preprocessing to the downstream analysis. A pipeline built for segmentation is not automatically the right one for radiomics or for training a deep learning model.
  • Plan for missing or corrupted data. Define upfront how the pipeline handles incomplete series, failed acquisitions, or unreadable files, rather than discovering the gap mid-analysis.

Medical image preprocessing tools and software

The right tool usually depends on the modality, the programming environment, and whether the pipeline needs to plug into a larger clinical trial imaging workflow.

Tool Type Best for
MATLAB Medical Imaging Toolbox Commercial, GUI and scripting End-to-end preprocessing across modalities with built-in visualization
SimpleITK Open source, Python / C++ / R Bias field correction, filtering, and registration via the ITK engine
NiBabel Open source, Python Reading and writing neuroimaging file formats, including NIfTI and DICOM
ANTs Open source, command line and Python State-of-the-art deformable registration and brain extraction
FSL Open source, command line and GUI Brain imaging analysis, tissue segmentation, and motion correction
SPM Open source, MATLAB-based Statistical parametric mapping for functional and structural brain MRI
TorchIO Open source, Python (PyTorch) Preprocessing and augmentation pipelines for deep learning on 3D volumes

Preparing medical images for reliable analysis

Preprocessing rarely gets the attention that segmentation models or reader adjudication does, but it is the step that determines whether everything downstream is comparing like with like. A bias field left uncorrected, an inconsistent resampling grid, or a normalization step run in the wrong order does not just add noise, it can quietly change a study's conclusions.

Building a preprocessing pipeline that holds up across scanners, sites, and time points is exactly the kind of problem imaging core labs and central reading teams solve every day, using imaging data for clinical research that has been standardized before a single reader looks at it, and AI-ready medical imaging datasets that hold up under model training and validation.

If you are evaluating how to standardize preprocessing across a multicenter imaging program, talk to the Collective Minds team about how imaging core lab workflows handle it at scale.

Frequently asked questions

What is medical image preprocessing?

Medical image preprocessing is the set of operations, such as denoising, normalization, registration, and resampling, applied to raw medical images before they are used for diagnosis, research, or machine learning. It corrects for scanner and acquisition differences so images from different sources can be compared and analyzed reliably.

What are the most common image preprocessing techniques?

The most widely used techniques are background removal and ROI extraction, denoising, intensity normalization, resampling, image registration, and contrast enhancement. Which techniques apply, and in what order, depends on the imaging modality and the analysis that follows.

What preprocessing steps are commonly used for MRI images?

MRI preprocessing typically includes bias field correction to remove intensity inhomogeneity, intensity normalization or standardization since MRI intensities are not physically calibrated, skull stripping for brain imaging, resampling to a common voxel size, and registration to a template or prior scan. Because MRI intensities are arbitrary, correcting the bias field before normalizing intensity is especially important.

What is the difference between medical image processing and preprocessing?

Preprocessing prepares raw images for use, correcting noise, artifacts, and inconsistencies so the data is clean and standardized. Image processing is the broader field that includes preprocessing along with downstream tasks like segmentation, feature extraction, classification, and diagnosis. Preprocessing is a subset of image processing, not a separate discipline.

Pär Kragsterman, CTO and Co-Founder of Collective Minds

 

Reviewed by: Pilar Flores Gastellu on August 28, 2026

See it in action

Book a demo and see how you can securely share medical imaging data, collaborate across institutions, streamline research and clinical workflows.
ipad