help@rskworld.in +91 93305 39277
RSK World
  • Home
  • Development
    • Web Development
    • Mobile Apps
    • Software
    • Games
    • Project
  • Technologies
    • Data Science
    • AI Development
    • Cloud Development
    • Blockchain
    • Cyber Security
    • Dev Tools
    • Testing Tools
  • Blog
  • About
  • Contact

Theme Settings

Color Scheme
Display Options
Font Size
100%
Back to Project
RSK World
medical-imaging
RSK World
medical-imaging
Medical Imaging Dataset - X-ray CT Scan MRI + Disease Detection + Computer-Aided Diagnosis + Medical AI
medical-imaging
  • __pycache__
  • data
  • scripts
  • .gitignore475 B
  • CONTRIBUTING.md1.7 KB
  • CT_MRI_LOCATION.md6 KB
  • DATASET_SUMMARY.md4.1 KB
  • DISCLAIMER.md2.1 KB
  • DOWNLOAD_INSTRUCTIONS.md7.5 KB
  • ERROR_CHECK_REPORT.md4.2 KB
  • FINAL_DATASET_SUMMARY.md5.8 KB
  • LICENSE784 B
  • PROJECT_IMAGE_NOTE.md1.2 KB
  • PROJECT_SUMMARY.md3.9 KB
  • QUICK_START.md2.9 KB
  • README.md4.3 KB
  • RELEASE_NOTES.md5 KB
  • create_directories.py1.5 KB
  • download_all_ct_mri.py12.2 KB
  • download_all_datasets.py8.9 KB
  • download_ct_mri_datasets.py10.1 KB
  • download_ct_mri_kaggle.bat1.5 KB
  • download_from_github.py8.1 KB
  • download_helper.py4.4 KB
  • download_kaggle_datasets.bat2.1 KB
  • download_public_datasets.py16.7 KB
  • download_summary.json211 B
  • example_usage.py2.7 KB
  • generate_sample_data.py15.9 KB
  • index.html43.2 KB
  • medical-imaging.zip2.1 MB
  • organize_medmnist.py1.3 KB
  • organize_mri_data.py584 B
  • project_info.json1.4 KB
  • requirements.txt492 B
  • setup.py2 KB
organize_medmnist.pydownload_public_datasets.py
organize_medmnist.py
Raw Download
Find: Go to:
"""
Organize Medical MNIST by Modality
"""
import shutil
from pathlib import Path

source = Path("data/temp/medmnist")
ct_target = Path("data/ct_scan/images")
mri_target = Path("data/mri/images")

ct_target.mkdir(parents=True, exist_ok=True)
mri_target.mkdir(parents=True, exist_ok=True)

# MedMNIST structure may vary, adjust based on actual structure
# This is a template - adjust based on actual dataset structure

image_extensions = ['.png', '.jpg', '.jpeg']
ct_count = 0
mri_count = 0

for ext in image_extensions:
    for img_file in source.rglob(f'*{ext}'):
        if img_file.is_file():
            name_lower = img_file.name.lower()
            # Adjust these conditions based on actual file naming
            if 'ct' in name_lower or 'ctscan' in name_lower:
                dest = ct_target / img_file.name
                if not dest.exists():
                    shutil.copy2(img_file, dest)
                    ct_count += 1
            elif 'mri' in name_lower or 'brain' in name_lower:
                dest = mri_target / img_file.name
                if not dest.exists():
                    shutil.copy2(img_file, dest)
                    mri_count += 1

print(f"Organized {ct_count} CT scan images")
print(f"Organized {mri_count} MRI images")
39 lines•1.3 KB
python
download_public_datasets.py
Raw Download
Find: Go to:
"""
Medical Imaging Dataset - Public Dataset Downloader
====================================================

Project: Medical Imaging Dataset
Website: https://rskworld.in
Contact: help@rskworld.in, support@rskworld.in
Phone: +91 93305 39277
Founder: Molla Samser
Designer & Tester: Rima Khatun

This script helps download publicly available medical imaging datasets
for educational purposes. All datasets are publicly available and free to use.
"""

import os
import json
import requests
from pathlib import Path
from urllib.parse import urlparse
import zipfile
import shutil


# Public Medical Imaging Datasets Information
PUBLIC_DATASETS = {
    "chest_xray": {
        "name": "Chest X-Ray Images (Pneumonia)",
        "description": "Public chest X-ray dataset for pneumonia detection",
        "source": "Kaggle",
        "url": "https://www.kaggle.com/datasets/paultimothymooney/chest-xray-pneumonia",
        "license": "CC BY 4.0",
        "size": "~1.2 GB",
        "images": "~5,863 images",
        "note": "Requires Kaggle account and API key"
    },
    "nih_chest_xray": {
        "name": "NIH Chest X-ray Dataset",
        "description": "Large dataset of chest X-rays from NIH",
        "source": "NIH",
        "url": "https://www.kaggle.com/datasets/nih-chest-xrays/data",
        "license": "Public Domain",
        "size": "~40 GB",
        "images": "~112,120 images",
        "note": "Requires Kaggle account"
    },
    "rsna_pneumonia": {
        "name": "RSNA Pneumonia Detection Challenge",
        "description": "Chest X-rays for pneumonia detection",
        "source": "RSNA/Kaggle",
        "url": "https://www.kaggle.com/c/rsna-pneumonia-detection-challenge",
        "license": "CC BY 4.0",
        "size": "~10 GB",
        "images": "~26,684 images",
        "note": "Competition dataset"
    },
    "brain_mri": {
        "name": "Brain MRI Images for Brain Tumor Detection",
        "description": "Brain MRI images for tumor detection",
        "source": "Kaggle",
        "url": "https://www.kaggle.com/datasets/navoneel/brain-mri-images-for-brain-tumor-detection",
        "license": "CC BY 4.0",
        "size": "~300 MB",
        "images": "~3,000+ images",
        "note": "Requires Kaggle account"
    },
    "covid19_xray": {
        "name": "COVID-19 X-ray Dataset",
        "description": "Chest X-rays for COVID-19 detection",
        "source": "GitHub",
        "url": "https://github.com/ieee8023/covid-chestxray-dataset",
        "license": "MIT",
        "size": "~50 MB",
        "images": "~100+ images",
        "note": "GitHub repository"
    },
    "medical_mnist": {
        "name": "Medical MNIST",
        "description": "Medical imaging dataset with multiple modalities",
        "source": "Kaggle",
        "url": "https://www.kaggle.com/datasets/andrewmvd/medical-mnist",
        "license": "CC BY 4.0",
        "size": "~200 MB",
        "images": "~66,000 images",
        "note": "Requires Kaggle account"
    }
}


def print_available_datasets():
    """Print information about available public datasets."""
    print("=" * 80)
    print("PUBLICLY AVAILABLE MEDICAL IMAGING DATASETS")
    print("=" * 80)
    print()
    print("These datasets are publicly available for educational and research purposes.")
    print("Please check each dataset's license and terms of use before downloading.")
    print()
    
    for key, dataset in PUBLIC_DATASETS.items():
        print(f"Dataset: {dataset['name']}")
        print(f"  Description: {dataset['description']}")
        print(f"  Source: {dataset['source']}")
        print(f"  URL: {dataset['url']}")
        print(f"  License: {dataset['license']}")
        print(f"  Size: {dataset['size']}")
        print(f"  Images: {dataset['images']}")
        print(f"  Note: {dataset['note']}")
        print()


def create_download_instructions():
    """Create a markdown file with download instructions."""
    instructions = """# Download Instructions for Public Medical Imaging Datasets

<!--
    Medical Imaging Dataset - Download Instructions
    ===============================================
    
    Project: Medical Imaging Dataset
    Website: https://rskworld.in
    Contact: help@rskworld.in, support@rskworld.in
    Phone: +91 93305 39277
    Founder: Molla Samser
    Designer & Tester: Rima Khatun
-->

## Important Notes

⚠️ **All datasets are for educational and research purposes only.**
- NOT for actual medical diagnosis or treatment
- Always check the license and terms of use
- Respect patient privacy and data usage guidelines
- Some datasets require registration or API keys

## Available Datasets

### 1. Chest X-Ray Images (Pneumonia)
- **Source**: Kaggle
- **URL**: https://www.kaggle.com/datasets/paultimothymooney/chest-xray-pneumonia
- **Size**: ~1.2 GB
- **Images**: ~5,863 chest X-ray images
- **License**: CC BY 4.0
- **Download**: Requires Kaggle account and API key
- **Instructions**:
  1. Create a Kaggle account at https://www.kaggle.com
  2. Go to Account Settings → API → Create New API Token
  3. Download the kaggle.json file
  4. Install Kaggle API: `pip install kaggle`
  5. Place kaggle.json in ~/.kaggle/ (or C:\\Users\\YourUsername\\.kaggle\\ on Windows)
  6. Run: `kaggle datasets download -d paultimothymooney/chest-xray-pneumonia`
  7. Extract and organize the images

### 2. NIH Chest X-ray Dataset
- **Source**: NIH (National Institutes of Health)
- **URL**: https://www.kaggle.com/datasets/nih-chest-xrays/data
- **Size**: ~40 GB
- **Images**: ~112,120 chest X-ray images
- **License**: Public Domain
- **Download**: Requires Kaggle account
- **Instructions**:
  1. Use Kaggle API: `kaggle datasets download -d nih-chest-xrays/data`
  2. Extract the large dataset
  3. Organize by condition/diagnosis

### 3. Brain MRI Images for Brain Tumor Detection
- **Source**: Kaggle
- **URL**: https://www.kaggle.com/datasets/navoneel/brain-mri-images-for-brain-tumor-detection
- **Size**: ~300 MB
- **Images**: ~3,000+ brain MRI images
- **License**: CC BY 4.0
- **Download**: Requires Kaggle account
- **Instructions**:
  1. Use Kaggle API: `kaggle datasets download -d navoneel/brain-mri-images-for-brain-tumor-detection`
  2. Extract and organize

### 4. COVID-19 X-ray Dataset
- **Source**: GitHub
- **URL**: https://github.com/ieee8023/covid-chestxray-dataset
- **Size**: ~50 MB
- **Images**: ~100+ images
- **License**: MIT
- **Download**: Direct from GitHub
- **Instructions**:
  1. Clone repository: `git clone https://github.com/ieee8023/covid-chestxray-dataset.git`
  2. Or download ZIP from GitHub
  3. Extract images from repository

### 5. Medical MNIST
- **Source**: Kaggle
- **URL**: https://www.kaggle.com/datasets/andrewmvd/medical-mnist
- **Size**: ~200 MB
- **Images**: ~66,000 images across multiple modalities
- **License**: CC BY 4.0
- **Download**: Requires Kaggle account
- **Instructions**:
  1. Use Kaggle API: `kaggle datasets download -d andrewmvd/medical-mnist`
  2. Extract and organize by modality

## Quick Setup Guide

### Install Kaggle API
```bash
pip install kaggle
```

### Setup Kaggle Credentials
1. Go to https://www.kaggle.com/account
2. Scroll to "API" section
3. Click "Create New API Token"
4. Download `kaggle.json`
5. Place it in:
   - **Windows**: `C:\\Users\\YourUsername\\.kaggle\\kaggle.json`
   - **Linux/Mac**: `~/.kaggle/kaggle.json`
6. Set permissions (Linux/Mac): `chmod 600 ~/.kaggle/kaggle.json`

### Download a Dataset
```bash
# Example: Download Chest X-Ray dataset
kaggle datasets download -d paultimothymooney/chest-xray-pneumonia

# Extract
unzip chest-xray-pneumonia.zip -d data/
```

## Organizing Downloaded Data

After downloading, organize the data into the project structure:

```
data/
├── xray/
│   ├── images/
│   └── labels/
├── ct_scan/
│   ├── images/
│   └── labels/
└── mri/
    ├── images/
    └── labels/
```

## Attribution

When using these datasets, please:
- Cite the original dataset sources
- Include license information
- Follow the terms of use
- Give proper attribution to the creators

## Contact

- **Website**: [rskworld.in](https://rskworld.in)
- **Email**: help@rskworld.in, support@rskworld.in
- **Phone**: +91 93305 39277

## Disclaimer

These datasets are provided for educational and research purposes only.
Always consult with medical professionals for actual medical diagnosis.
"""
    
    with open('DOWNLOAD_INSTRUCTIONS.md', 'w', encoding='utf-8') as f:
        f.write(instructions)
    
    print("Download instructions saved to DOWNLOAD_INSTRUCTIONS.md")


def create_kaggle_download_script():
    """Create a script to download datasets using Kaggle API."""
    script_content = """@echo off
REM Medical Imaging Dataset - Kaggle Download Script
REM =================================================
REM 
REM Project: Medical Imaging Dataset
REM Website: https://rskworld.in
REM Contact: help@rskworld.in, support@rskworld.in
REM Phone: +91 93305 39277
REM Founder: Molla Samser
REM Designer & Tester: Rima Khatun
REM
REM This script helps download datasets from Kaggle

echo ========================================
echo Kaggle Dataset Downloader
echo ========================================
echo.

REM Check if kaggle is installed
python -c "import kaggle" 2>nul
if errorlevel 1 (
    echo Installing Kaggle API...
    pip install kaggle
)

echo.
echo Available datasets:
echo 1. Chest X-Ray Images (Pneumonia)
echo 2. NIH Chest X-ray Dataset
echo 3. Brain MRI Images for Brain Tumor Detection
echo 4. Medical MNIST
echo.

set /p choice="Enter dataset number (1-4): "

if "%choice%"=="1" (
    echo Downloading Chest X-Ray Images...
    kaggle datasets download -d paultimothymooney/chest-xray-pneumonia
    echo Extracting...
    python -m zipfile -e chest-xray-pneumonia.zip data/temp/
    echo Dataset downloaded to data/temp/
)

if "%choice%"=="2" (
    echo Downloading NIH Chest X-ray Dataset...
    echo WARNING: This is a large dataset (~40 GB)
    kaggle datasets download -d nih-chest-xrays/data
    echo Extracting...
    python -m zipfile -e data.zip data/temp/
    echo Dataset downloaded to data/temp/
)

if "%choice%"=="3" (
    echo Downloading Brain MRI Images...
    kaggle datasets download -d navoneel/brain-mri-images-for-brain-tumor-detection
    echo Extracting...
    python -m zipfile -e brain-mri-images-for-brain-tumor-detection.zip data/temp/
    echo Dataset downloaded to data/temp/
)

if "%choice%"=="4" (
    echo Downloading Medical MNIST...
    kaggle datasets download -d andrewmvd/medical-mnist
    echo Extracting...
    python -m zipfile -e medical-mnist.zip data/temp/
    echo Dataset downloaded to data/temp/
)

echo.
echo Download complete!
echo Please organize the images into the appropriate directories.
pause
"""
    
    with open('download_kaggle_datasets.bat', 'w') as f:
        f.write(script_content)
    
    print("Kaggle download script created: download_kaggle_datasets.bat")


def create_python_download_helper():
    """Create a Python helper script for downloading datasets."""
    helper_script = """#!/usr/bin/env python3
\"\"\"
Medical Imaging Dataset - Download Helper
==========================================

Project: Medical Imaging Dataset
Website: https://rskworld.in
Contact: help@rskworld.in, support@rskworld.in
Phone: +91 93305 39277
Founder: Molla Samser
Designer & Tester: Rima Khatun

Helper script to download and organize public medical imaging datasets.
\"\"\"

import os
import sys
import zipfile
import shutil
from pathlib import Path


def check_kaggle_installed():
    \"\"\"Check if Kaggle API is installed.\"\"\"
    try:
        import kaggle
        return True
    except ImportError:
        print("Kaggle API not found. Installing...")
        os.system("pip install kaggle")
        try:
            import kaggle
            return True
        except ImportError:
            print("Failed to install Kaggle API. Please install manually:")
            print("  pip install kaggle")
            return False


def download_kaggle_dataset(dataset_name, output_dir="data/temp"):
    \"\"\"Download a dataset from Kaggle.\"\"\"
    if not check_kaggle_installed():
        return False
    
    try:
        from kaggle.api.kaggle_api_extended import KaggleApi
        api = KaggleApi()
        api.authenticate()
        
        print(f"Downloading {dataset_name}...")
        api.dataset_download_files(dataset_name, path=output_dir, unzip=True)
        print(f"Downloaded to {output_dir}")
        return True
    except Exception as e:
        print(f"Error downloading dataset: {e}")
        print("Make sure you have:")
        print("1. Kaggle account")
        print("2. API token in ~/.kaggle/kaggle.json (or C:\\\\Users\\\\YourUsername\\\\.kaggle\\\\kaggle.json)")
        return False


def organize_chest_xray_data(source_dir, target_dir="data/xray"):
    \"\"\"Organize chest X-ray data into project structure.\"\"\"
    source = Path(source_dir)
    target_images = Path(target_dir) / "images"
    target_labels = Path(target_dir) / "labels"
    
    target_images.mkdir(parents=True, exist_ok=True)
    target_labels.mkdir(parents=True, exist_ok=True)
    
    # Find all image files
    image_extensions = ['.png', '.jpg', '.jpeg', '.dcm']
    image_count = 0
    
    for ext in image_extensions:
        for img_file in source.rglob(f'*{ext}'):
            if img_file.is_file():
                # Copy to images directory
                dest = target_images / img_file.name
                shutil.copy2(img_file, dest)
                image_count += 1
                
                # Create a basic label file
                label_file = target_labels / f"{img_file.stem}.json"
                if not label_file.exists():
                    label_data = {
                        "diagnosis": "Unknown",
                        "source": "Public Dataset",
                        "modality": "X-ray",
                        "body_part": "Chest",
                        "annotations": {
                            "findings": ["From public dataset"],
                            "recommendations": ["Educational use only"]
                        }
                    }
                    import json
                    with open(label_file, 'w') as f:
                        json.dump(label_data, f, indent=4)
    
    print(f"Organized {image_count} images to {target_dir}")
    return image_count


def main():
    \"\"\"Main function.\"\"\"
    print("=" * 60)
    print("Medical Imaging Dataset - Download Helper")
    print("=" * 60)
    print()
    print("Available datasets:")
    print("1. Chest X-Ray Images (Pneumonia)")
    print("2. Brain MRI Images for Brain Tumor Detection")
    print("3. Medical MNIST")
    print()
    
    choice = input("Enter dataset number (1-3) or 'q' to quit: ").strip()
    
    datasets = {
        "1": ("paultimothymooney/chest-xray-pneumonia", "xray"),
        "2": ("navoneel/brain-mri-images-for-brain-tumor-detection", "mri"),
        "3": ("andrewmvd/medical-mnist", "mixed")
    }
    
    if choice in datasets:
        dataset_name, data_type = datasets[choice]
        if download_kaggle_dataset(dataset_name):
            print("\\nDownload complete!")
            print("Please organize the data manually or use the organize functions.")
    elif choice.lower() == 'q':
        print("Exiting...")
    else:
        print("Invalid choice.")


if __name__ == '__main__':
    main()
"""
    
    with open('download_helper.py', 'w', encoding='utf-8') as f:
        f.write(helper_script)
    
    print("Python download helper created: download_helper.py")


if __name__ == '__main__':
    print("=" * 80)
    print("Medical Imaging Dataset - Public Dataset Information")
    print("=" * 80)
    print()
    
    print_available_datasets()
    create_download_instructions()
    create_kaggle_download_script()
    create_python_download_helper()
    
    print()
    print("=" * 80)
    print("Files created:")
    print("  - DOWNLOAD_INSTRUCTIONS.md (detailed download guide)")
    print("  - download_kaggle_datasets.bat (Windows batch script)")
    print("  - download_helper.py (Python helper script)")
    print("=" * 80)
    print()
    print("Next steps:")
    print("1. Read DOWNLOAD_INSTRUCTIONS.md for detailed instructions")
    print("2. Set up Kaggle API credentials if needed")
    print("3. Use the download scripts to get public datasets")
    print("4. Organize the downloaded data into the project structure")

522 lines•16.7 KB
python

About RSK World

Founded by Molla Samser, with Designer & Tester Rima Khatun, RSK World is your one-stop destination for free programming resources, source code, and development tools.

Founder: Molla Samser
Designer & Tester: Rima Khatun

Development

  • Game Development
  • Web Development
  • Mobile Development
  • AI Development
  • Development Tools

Legal

  • Terms & Conditions
  • Privacy Policy
  • Disclaimer

Contact Info

Nutanhat, Mongolkote
Purba Burdwan, West Bengal
India, 713147

+91 93305 39277

hello@rskworld.in
support@rskworld.in

© 2026 RSK World. All rights reserved.

Content used for educational purposes only. View Disclaimer