Skip to content

krish69212/iqm-ct

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NIQE-CT: Image Quality Metrics for Computed Tomography

NIQE-CT is a Python library designed to measure the quality of Computed Tomography (CT) scans automatically. It converts raw medical images (DICOM) into objective quality scores, helping researchers and clinicians understand how clear and reliable their images are without needing a human to rate every single one.


1. Project Overview

Imagine looking at two photos: one is crisp and clear, while the other is grainy and out of focus. You can easily tell which one is "better." In medicine, however, this distinction is critical—doctors need to know if a CT scan is sharp enough to spot a tiny anatomical detail or if "image noise" might be hiding a clinical finding.

Traditionally, measuring image quality was subjective (based on a person's opinion) or required a "perfect" scan to use as a baseline for comparison.

NIQE-CT solves this by using "blind" (referenceless) metrics. Much like how you can tell a photo is blurry without needing to see the original "perfect" version, this software uses advanced math to analyze a scan and judge its quality on its own. It automatically detects defects like noise, motion blur, and streaks.


2. Key Metrics

We use three primary metrics to analyze image quality from different angles. For a deeper dive into the math and specific steps for each, check out our Detailed Metrics Guide.

Metric Why it matters
NIQE Measures how much a scan deviates from the patterns found in high-quality clinical images. Lower is better.
BRISQUE Uses spatial patterns to identify specific artifacts like motion blur, streaks, or rings.
MDC Measures the smallest difference in tissue density that can be detected through the image noise.

3. How the Workflow Works

The pipeline processes data in five clear stages, designed to be as accurate and consistent as possible:

1. Data Ingestion (Loading the Data)

The system crawls through your folders to find DICOM files (the standard file format for medical images). It extracts the pixels and important metadata, like the physical size of each pixel (Pixel Spacing), so that measurements are accurate to the real world.

2. Normalization (Leveling the Playing Field)

Different scanners can produce images with different brightness levels. We use Robust Statistics (Median and IQR) to center and scale the data. This ensures that a scan from one machine can be fairly compared to a scan from another. We also use "anatomy masking" to ignore the empty air around a patient and focus only on the body.

3. Feature Extraction (Analyzing Patterns)

The software looks for specific textures and statistical patterns in the image. It uses a process called MSCN transformation, which mimics how the human eye perceives contrast. It looks at the image at multiple scales (zoom levels) to catch both tiny noise grains and large-scale artifacts.

4. Algorithmic Scoring (Calculating the Grade)

  • NIQE: Calculates a "statistical distance" (Mahalanobis distance) between your scan and a model of "clean" scans. The further away your scan is from the clean model, the worse the score.
  • BRISQUE: Takes all the extracted patterns and feeds them into a Support Vector Regressor (a type of machine learning model) that has been trained to predict quality based on human-labeled data.
  • MDC: Randomly samples hundreds of small regions in a uniform area (like a water phantom) to see how much the density varies. This tells us the "noise floor" of the scanner.

5. Reporting (Sharing the Results)

The final results are saved into a single CSV file (like an Excel spreadsheet) and summary graphs are created so you can easily spot trends or outliers in your data.


4. Project Structure

NIQE-CT/
├── scripts/                      # Entry Points (Run the software from here)
│   └── run_batch.py              # The main script to process a batch of scans
│
├── src/                          # Source Code (The "brain" of the project)
│   ├── ct_iqm/                   # Core Package
│   │   ├── metrics/              # The math behind NIQE, BRISQUE, and MDC
│   │   ├── data_loader.py        # Logic for loading images and finding the body
│   │   └── training.py           # Tools for "teaching" the models what high quality looks like
│   └── imagequalityct/           # Utility Library for managing DICOM files
│
├── models/                       # Stores the trained models required for evaluation.
├── data/                         # Data Management (Put your scans here)
│   ├── test_scans/               # Scans you want to evaluate
│   ├── training_scans/           # High-quality scans used for learning
│   └── brisque_scoring/          # CSV of folder_path & scores for training the BRISQUE model
│
├── outputs/                      # Results & Visualization (Check here for your scores)
└── requirements.txt              # List of Python software libraries needed to run the project

5. Setup & Usage

1. Install Dependencies

You'll need Python 3.8+. Run this command to install the required libraries:

pip install -r requirements.txt

2. Run an Evaluation

Put your scans in data/test_scans/ and run the main script:

python scripts/run_batch.py

The script will walk you through the process, ask a few questions, and then generate your quality report in the outputs/ folder.

Note on BRISQUE Scoring: Unlike NIQE, which is automatic, BRISQUE needs to be "taught" what a good scan looks like. If you want to use the BRISQUE metric, make sure you have only one CSV file in data/brisque_scoring/ that lists the folder paths and their quality scores.

CSV Structure:

  • folder_path: The location of the scan on your computer.
  • score: A number that tells the computer how good that scan is.

Example CSV:

folder_path,score
C:/Data/training_scans/Patient_001,5.0
C:/Data/training_scans/Patient_002,2.5
C:/Data/training_scans/Patient_003,4.0

6. Important Assumptions

  • Body Masking: The metrics only work on the patient or phantom. If you try to analyze empty space, the results won't make sense!
  • Pixel Spacing: To calculate MDC (Contrast), the system needs to know the physical size of the pixels. This is usually in the DICOM file, but if it's missing, you'll need to provide a fallback value.
  • Consistency: Because we use robust normalization, you can compare scans across different reconstruction types and dose levels reliably.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors