Title:
SSC-NRNet: Statistical, Structural, and Composite Noise Reduction in MRI with Adaptive Skip Compression in a cGAN-Based Model
Title:
SSC-NRNet: Statistical, Structural, and Composite Noise Reduction in MRI with Adaptive Skip Compression in a cGAN-Based Model
Authors:
Muhammed Davud, ORCID: 0000-0002-6864-2339, muhammed.davud@istinye.edu.tr
Faruk Bulut (ORCID: 0000-0003-2960-8725, faruk.bulut@essex.ac.uk
The source codes in Python developed and used in this study are publicly available and can be freely downloaded from the repository link here.
This public accessibility has been ensured to promote openness, transparency, and reproducibility in research. By sharing the implementation details, we aim to enable other researchers to replicate the experiments, validate the findings, and further develop or adapt the proposed methods for their own investigations. The codebase includes all the essential scripts, modules, and configurations necessary to reproduce the main results presented in this study.
To successfully run the code, a sequence of specific steps must be followed. These steps include the installation of required software dependencies, configuration of the environment, and correct placement of the input datasets. Following the defined procedure ensures that the data preprocessing, parameter initialization, and model execution stages are performed exactly as described in the methodology section of the paper. Detailed instructions are provided within the repository’s documentation to guide users through the entire process, from setup to output generation.
The datasets employed in this research are publicly accessible and can be downloaded directly from their original source websites.
The overall procedures followed throughout this research are presented to provide a comprehensive understanding of the experimental design, implementation, and analysis framework adopted in this study.
Any questions, requests for clarification, or additional information related to this study may be directed to the authors via email.
------------------------------------------------
Step 1: Create Training and Testing Dataset Split
------------------------------------------------
Purpose:
This script splits the original MRI dataset into training and testing sets based on a specified ratio.
File: 01_create_dataset_split.ipynb
Description:
- Takes all images from the original dataset folder.
- Copies a fraction of images (specified by 'ratio') to the testing folder.
- Copies the remaining images to the training folder.
- Ensures both destination directories exist before copying.
Required Directory Structure:
- Original images: ./Dataset/MRI/00 Full_images_dataset/
- Training images output: ./Dataset/MRI/train/
- Testing images output: ./Dataset/MRI/test/
Parameters:
- source_directory: Path to the original images.
- destination_train_directory: Path to save the training images.
- destination_test_directory: Path to save the testing images.
- ratio: Fraction of images to allocate to the test dataset (e.g., 0.1 for 10%).
How to Run:
1. Place all original MRI images in the folder './Dataset/MRI/00 Full_images_dataset/'.
2. Open the notebook '01_create_dataset_split.ipynb'.
3. Adjust the parameters if needed (source_directory, destination directories, ratio).
4. Run all cells to create the training and testing datasets.
Output:
- The training images will be saved in './Dataset/MRI/train/'.
- The testing images will be saved in './Dataset/MRI/test/'.
- The notebook will print the number of files copied to each folder.
Notes:
- The split is randomized, so running the script multiple times may result in different images in the training/testing sets.
--------------------------------------------------------------------
Step 3–11: Apply Noise to Images
--------------------------------
Purpose:
These scripts generate various types of noisy MRI images.
They can be applied individually or sequentially to create complex noise combinations.
Files:
- 02_add_gaussian_noise.ipynb
- 02_add_geo_noise.ipynb
- 02_add_motion_noise.ipynb
- 02_add_rayleigh_noise.ipynb
- 02_add_RFInh_noise.ipynb
- 02_add_rician_noise.ipynb
- 02_add_salt_and_pepper_noise.ipynb
- 02_add_speckle_noise.ipynb
Description:
- Each script reads images from a source folder (train or test).
- Resizes images to 512x512 if needed.
- Applies the corresponding noise type:
- Gaussian Noise
- Geometric Noise
- Motion
- Rayleigh Noise
- RF Inhomogeneity Noise
- Rician Noise
- Salt and Pepper Noise
- Speckle Noise
- Concatenates the noisy image (left) with the original image (right).
- Saves the output in a folder named according to the noise type and parameter value (e.g., train_Gaussian_10, test_Rician_50).
Parameters:
aa1: Source directory of original images.
aa2: Destination directory for the noisy images.
Noise-specific parameter (e.g., strength, ratio, delta_x/delta_y) defined in each script.
How to Run:
1. Place the original MRI images in the appropriate folder:
- Training: ./Dataset/MRI/00 train/
- Testing: ./Dataset/MRI/00 test/
2. Run the script for the desired noise type and parameter values.
3. The output images will be saved in the destination folder with a descriptive name.
4. Repeat for other noise types as needed.
Creating Complex Noise:
- To generate images with multiple noise types, run these scripts sequentially on the output of each other.
- Example:
1. Apply geometric distortion: ./Dataset/MRI/train → ./Dataset/MRI/train_Geo_5
2. Apply Gaussian noise: ./Dataset/MRI/train_Geo_5 → ./Dataset/MRI/train_Geo5_Gaussian_10
3. Continue with motion, Rician, or other noise scripts in sequence.
Output:
- Noisy images concatenated with original images for visual comparison.
- Folder structure clearly indicates noise type and parameter value.
- Console prints each processed image and a final completion message.
--------------------------------------------------------------------
Step 12: Train Pix2Pix GAN Model (Traditional)
----------------------------------------------
Purpose:
This script trains a traditional Pix2Pix GAN model for MRI image denoising.
It does not include Adaptive Skip Compression (ASC).
It can be trained on any of the previously generated noisy datasets.
File: 03_train_pix2pix_denoise.ipynb
Description:
- Reads images from a specified training dataset folder.
- Preprocesses images: resize, normalize, random jitter, and crop.
- Builds the generator and discriminator networks.
- Trains the model using standard GAN + L1 loss.
- Saves intermediate results, metrics, and model weights.
Required Directory Structure:
- Training images: ./Dataset/MRI/train_<NoiseType>/
- Testing images: ./Dataset/MRI/test_<NoiseType>/
- Output folder: ./Dataset/MRI/train_<NoiseType>_Output/
Parameters:
- path: Root path of the dataset (e.g., './Dataset/MRI').
- img_type: Image file extension (e.g., 'png', 'jpg').
- steps: Number of training steps (iterations).
- img_s_x, img_s_y, img_s_z: Image dimensions (height, width, channels).
- lr: Learning rate for Adam optimizer.
- beta1, beta2: Adam optimizer parameters.
- lambda_: Weight for L1 loss in generator loss function.
- train_dataset_path1: Name of the training dataset folder (e.g., 'train_Geo_09').
How to Run:
1. Ensure the noisy datasets are created (Step 3–11).
2. Set the parameters according to your dataset and GPU resources.
3. Run the script. The training progress will display:
- Loss values (generator and discriminator)
- Step-wise generated images
- Metrics (SSIM, PSNR, MSE, MAE, RMSE) are saved automatically.
4. The trained model weights are saved in:
./Dataset/MRI/<dataset>_Output/model_pix2pix.h5
Output:
- Model weights for Pix2Pix GAN.
Notes:
- This script is for traditional Pix2Pix GAN training.
- You can train on any noisy dataset (Gaussian, Rician, Speckle, Motion, etc.) or even sequentially combined noisy datasets.
--------------------------------------------------------------------
Step 13: Train Pix2Pix GAN Model with Adaptive Skip Compression (ASC)
----------------------------------------------
Purpose:
This script trains a Pix2Pix GAN model for MRI denoising using Adaptive Skip Compression (ASC).
File:
04_train_pix2pix_denoise_ASC.ipynb
Description:
- Reads images from a specified training dataset folder.
- Preprocesses images: resize, normalize, random jitter, and crop.
- Builds the generator with ASC blocks and a standard discriminator.
- Trains the model using standard GAN + L1 loss.
- Saves intermediate results, metrics, and model weights.
Required Directory Structure:
- Training images: ./Dataset/MRI/train_<NoiseType>/
- Testing images: ./Dataset/MRI/test_<NoiseType>/
- Output folder: ./Dataset/MRI/train_<NoiseType>_Output/
Parameters:
- path: Root path of the dataset (e.g., './Dataset/MRI').
- img_type: Image file extension (e.g., 'png', 'jpg').
- steps: Number of training steps (iterations).
- img_s_x, img_s_y, img_s_z: Image dimensions (height, width, channels).
- lr: Learning rate for Adam optimizer.
- beta1, beta2: Adam optimizer parameters.
- lambda_: Weight for L1 loss in generator loss function.
- train_dataset_path1: Name of the training dataset folder (e.g., 'train_Geo_09').
How to Run:
1. Ensure the noisy datasets are created (Step 3–11).
2. Set the parameters according to your dataset and GPU resources.
3. Run the script. The training progress will display:
- Loss values (generator and discriminator)
- Step-wise generated images
- Metrics (SSIM, PSNR, MSE, MAE, RMSE) are saved automatically.
4. The trained model weights are saved in:
./Dataset/MRI/<dataset>_Output/model_pix2pix.h5
Output:
- Model weights for ASC-enhanced Pix2Pix GAN.
Notes:
- ASC blocks are applied to skip connections between encoder and decoder layers.
- Can be trained on any noisy dataset (Gaussian, Rician, Speckle, Motion, etc.) or sequentially combined noise.