ulfsynth 0.1.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ulfsynth-0.1.3/LICENSE +21 -0
- ulfsynth-0.1.3/MANIFEST.in +10 -0
- ulfsynth-0.1.3/PKG-INFO +228 -0
- ulfsynth-0.1.3/README.md +172 -0
- ulfsynth-0.1.3/assets/method.png +0 -0
- ulfsynth-0.1.3/assets/results.png +0 -0
- ulfsynth-0.1.3/pyproject.toml +48 -0
- ulfsynth-0.1.3/setup.cfg +4 -0
- ulfsynth-0.1.3/setup.py +22 -0
- ulfsynth-0.1.3/ulfsynth/__init__.py +10 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/LICENSE +201 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/README.md +57 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/__init__.py +0 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/batch_running/__init__.py +0 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/batch_running/benchmarking/__init__.py +0 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/batch_running/benchmarking/generate_benchmarking_commands.py +41 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/batch_running/benchmarking/summarize_benchmark_results.py +70 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/batch_running/collect_results_custom_Decathlon.py +112 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/batch_running/collect_results_custom_Decathlon_2d.py +18 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/batch_running/generate_lsf_runs_customDecathlon.py +84 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/batch_running/release_trainings/__init__.py +0 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/batch_running/release_trainings/nnunetv2_v1/__init__.py +0 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/batch_running/release_trainings/nnunetv2_v1/collect_results.py +113 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/batch_running/release_trainings/nnunetv2_v1/generate_lsf_commands.py +93 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/configuration.py +10 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/dataset_conversion/Dataset027_ACDC.py +114 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/dataset_conversion/Dataset073_Fluo_C3DH_A549_SIM.py +85 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/dataset_conversion/Dataset114_MNMs.py +198 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/dataset_conversion/Dataset115_EMIDEC.py +61 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/dataset_conversion/Dataset120_RoadSegmentation.py +87 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/dataset_conversion/Dataset137_BraTS21.py +98 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/dataset_conversion/Dataset218_Amos2022_task1.py +70 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/dataset_conversion/Dataset219_Amos2022_task2.py +65 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/dataset_conversion/Dataset220_KiTS2023.py +50 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/dataset_conversion/Dataset221_AutoPETII_2023.py +70 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/dataset_conversion/Dataset223_AMOS2022postChallenge.py +59 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/dataset_conversion/Dataset988_dummyDataset4.py +32 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/dataset_conversion/__init__.py +0 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/dataset_conversion/convert_MSD_dataset.py +132 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/dataset_conversion/convert_raw_dataset_from_old_nnunet_format.py +53 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/dataset_conversion/datasets_for_integration_tests/Dataset996_IntegrationTest_Hippocampus_regions_ignore.py +75 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/dataset_conversion/datasets_for_integration_tests/Dataset997_IntegrationTest_Hippocampus_regions.py +37 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/dataset_conversion/datasets_for_integration_tests/Dataset998_IntegrationTest_Hippocampus_ignore.py +33 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/dataset_conversion/datasets_for_integration_tests/Dataset999_IntegrationTest_Hippocampus.py +27 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/dataset_conversion/datasets_for_integration_tests/__init__.py +0 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/dataset_conversion/generate_dataset_json.py +103 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/ensembling/__init__.py +0 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/ensembling/ensemble.py +207 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/evaluation/__init__.py +0 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/evaluation/accumulate_cv_results.py +58 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/evaluation/evaluate_predictions.py +264 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/evaluation/find_best_configuration.py +333 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/experiment_planning/__init__.py +0 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/experiment_planning/dataset_fingerprint/__init__.py +0 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/experiment_planning/dataset_fingerprint/fingerprint_extractor.py +209 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/experiment_planning/experiment_planners/__init__.py +0 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/experiment_planning/experiment_planners/default_experiment_planner.py +593 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/experiment_planning/experiment_planners/network_topology.py +108 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/experiment_planning/experiment_planners/resampling/__init__.py +0 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/experiment_planning/experiment_planners/resampling/planners_no_resampling.py +54 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/experiment_planning/experiment_planners/resampling/resample_with_torch.py +181 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/experiment_planning/experiment_planners/resencUNet_planner.py +235 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/experiment_planning/experiment_planners/residual_unets/__init__.py +0 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/experiment_planning/experiment_planners/residual_unets/residual_encoder_unet_planners.py +314 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/experiment_planning/experiment_planners/residual_unets/residual_unet_planners.py +335 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/experiment_planning/plan_and_preprocess_api.py +150 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/experiment_planning/plan_and_preprocess_entrypoints.py +200 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/experiment_planning/plans_for_pretraining/__init__.py +0 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/experiment_planning/plans_for_pretraining/move_plans_between_datasets.py +82 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/experiment_planning/verify_dataset_integrity.py +230 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/imageio/__init__.py +0 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/imageio/base_reader_writer.py +107 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/imageio/natural_image_reader_writer.py +73 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/imageio/nibabel_reader_writer.py +204 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/imageio/reader_writer_registry.py +79 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/imageio/simpleitk_reader_writer.py +133 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/imageio/tif_reader_writer.py +100 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/inference/__init__.py +0 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/inference/data_iterators.py +318 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/inference/examples.py +102 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/inference/export_prediction.py +196 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/inference/predict_from_raw_data.py +1060 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/inference/predict_from_raw_data.py.backup +1060 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/inference/sliding_window_prediction.py +67 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/model_sharing/__init__.py +0 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/model_sharing/entry_points.py +61 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/model_sharing/model_download.py +47 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/model_sharing/model_export.py +124 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/model_sharing/model_import.py +8 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/paths.py +39 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/postprocessing/__init__.py +0 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/postprocessing/remove_connected_components.py +362 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/preprocessing/__init__.py +0 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/preprocessing/cropping/__init__.py +0 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/preprocessing/cropping/cropping.py +53 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/preprocessing/normalization/__init__.py +0 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/preprocessing/normalization/default_normalization_schemes.py +157 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/preprocessing/normalization/map_channel_name_to_normalization.py +28 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/preprocessing/normalization/readme.md +5 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/preprocessing/preprocessors/__init__.py +0 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/preprocessing/preprocessors/default_preprocessor.py +296 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/preprocessing/resampling/__init__.py +0 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/preprocessing/resampling/default_resampling.py +203 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/preprocessing/resampling/no_resampling.py +13 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/preprocessing/resampling/resample_torch.py +173 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/preprocessing/resampling/utils.py +15 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/run/__init__.py +0 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/run/load_pretrained_weights.py +66 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/run/run_training.py +370 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/tests/__init__.py +0 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/tests/integration_tests/__init__.py +0 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/tests/integration_tests/add_lowres_and_cascade.py +33 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/tests/integration_tests/cleanup_integration_test.py +19 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/tests/integration_tests/run_integration_test_bestconfig_inference.py +75 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/training/__init__.py +0 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/training/data_augmentation/__init__.py +0 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/training/data_augmentation/compute_initial_patch_size.py +24 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/training/data_augmentation/custom_transforms/__init__.py +0 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/training/data_augmentation/custom_transforms/cascade_transforms.py +136 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/training/data_augmentation/custom_transforms/deep_supervision_donwsampling.py +55 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/training/data_augmentation/custom_transforms/limited_length_multithreaded_augmenter.py +10 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/training/data_augmentation/custom_transforms/manipulating_data_dict.py +10 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/training/data_augmentation/custom_transforms/masking.py +22 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/training/data_augmentation/custom_transforms/region_based_training.py +38 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/training/data_augmentation/custom_transforms/transforms_for_dummy_2d.py +45 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/training/dataloading/__init__.py +0 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/training/dataloading/base_data_loader.py +139 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/training/dataloading/data_loader_2d.py +171 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/training/dataloading/data_loader_3d.py +129 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/training/dataloading/nnunet_dataset.py +167 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/training/dataloading/utils.py +128 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/training/logging/__init__.py +0 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/training/logging/nnunet_logger.py +106 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/training/loss/AFP.py +211 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/training/loss/__init__.py +0 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/training/loss/compound_losses.py +150 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/training/loss/deep_supervision.py +30 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/training/loss/dice.py +192 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/training/loss/kspace.py +413 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/training/loss/mae.py +8 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/training/loss/mednet.py +229 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/training/loss/mse.py +8 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/training/loss/perceptual.py +527 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/training/loss/plain_conv_encoder.py +116 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/training/loss/robust_ce_loss.py +32 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/training/loss/segairway.py +154 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/training/loss/unet.py +163 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/training/loss/unet_decoder.py +137 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/training/lr_scheduler/__init__.py +0 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/training/lr_scheduler/polylr.py +20 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/training/nnUNetTrainer/__init__.py +0 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/training/nnUNetTrainer/nnUNetTrainer.py +1305 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/training/nnUNetTrainer/nnUNetTrainerMRCT_kspace.py +247 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/training/nnUNetTrainer/nnUNetTrainer_Ablations.py +261 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/training/nnUNetTrainer/variants/__init__.py +0 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/training/nnUNetTrainer/variants/benchmarking/__init__.py +0 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/training/nnUNetTrainer/variants/benchmarking/nnUNetTrainerBenchmark_5epochs.py +65 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/training/nnUNetTrainer/variants/benchmarking/nnUNetTrainerBenchmark_5epochs_noDataLoading.py +65 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/training/nnUNetTrainer/variants/data_augmentation/__init__.py +0 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/training/nnUNetTrainer/variants/data_augmentation/nnUNetTrainerDA5.py +419 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/training/nnUNetTrainer/variants/data_augmentation/nnUNetTrainerDAOrd0.py +157 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/training/nnUNetTrainer/variants/data_augmentation/nnUNetTrainerNoDA.py +40 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/training/nnUNetTrainer/variants/data_augmentation/nnUNetTrainerNoMirroring.py +28 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/training/nnUNetTrainer/variants/loss/__init__.py +0 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/training/nnUNetTrainer/variants/loss/nnUNetTrainerCELoss.py +41 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/training/nnUNetTrainer/variants/loss/nnUNetTrainerDiceLoss.py +60 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/training/nnUNetTrainer/variants/loss/nnUNetTrainerTopkLoss.py +76 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/training/nnUNetTrainer/variants/lr_schedule/__init__.py +0 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/training/nnUNetTrainer/variants/lr_schedule/nnUNetTrainerCosAnneal.py +13 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/training/nnUNetTrainer/variants/network_architecture/__init__.py +0 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/training/nnUNetTrainer/variants/network_architecture/nnUNetTrainerMRCT_AFP.py +192 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/training/nnUNetTrainer/variants/network_architecture/nnUNetTrainerMRCT_AFP_ft.py +192 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/training/nnUNetTrainer/variants/network_architecture/nnUNetTrainerMRCT_mae.py +191 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/training/nnUNetTrainer/variants/network_architecture/nnUNetTrainerMRCT_mae_fixed.py +97 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/training/nnUNetTrainer/variants/network_architecture/nnUNetTrainerMRCT_mse.py +191 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/training/nnUNetTrainer/variants/optimizer/__init__.py +0 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/training/nnUNetTrainer/variants/optimizer/nnUNetTrainerAdam.py +58 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/training/nnUNetTrainer/variants/optimizer/nnUNetTrainerAdan.py +66 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/training/nnUNetTrainer/variants/sampling/__init__.py +0 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/training/nnUNetTrainer/variants/sampling/nnUNetTrainer_probabilisticOversampling.py +84 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/training/nnUNetTrainer/variants/training_length/__init__.py +0 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/training/nnUNetTrainer/variants/training_length/nnUNetTrainer_Xepochs.py +76 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/training/nnUNetTrainer/variants/training_length/nnUNetTrainer_Xepochs_NoMirroring.py +60 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/utilities/__init__.py +0 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/utilities/collate_outputs.py +24 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/utilities/crossval_split.py +16 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/utilities/dataset_name_id_conversion.py +74 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/utilities/ddp_allgather.py +49 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/utilities/default_n_proc_DA.py +44 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/utilities/file_path_utilities.py +123 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/utilities/find_class_by_name.py +24 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/utilities/get_network_from_plans.py +43 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/utilities/helpers.py +27 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/utilities/json_export.py +60 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/utilities/label_handling/__init__.py +0 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/utilities/label_handling/label_handling.py +322 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/utilities/network_initialization.py +12 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/utilities/overlay_plots.py +275 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/utilities/plans_handling/__init__.py +0 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/utilities/plans_handling/plans_handler.py +339 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/nnunetv2/utilities/utils.py +70 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/pyproject.toml +102 -0
- ulfsynth-0.1.3/ulfsynth/_nnunet_src/setup.py +9 -0
- ulfsynth-0.1.3/ulfsynth/cli.py +85 -0
- ulfsynth-0.1.3/ulfsynth/enhance.py +121 -0
- ulfsynth-0.1.3/ulfsynth/simulate.py +177 -0
- ulfsynth-0.1.3/ulfsynth.egg-info/PKG-INFO +228 -0
- ulfsynth-0.1.3/ulfsynth.egg-info/SOURCES.txt +210 -0
- ulfsynth-0.1.3/ulfsynth.egg-info/dependency_links.txt +1 -0
- ulfsynth-0.1.3/ulfsynth.egg-info/entry_points.txt +2 -0
- ulfsynth-0.1.3/ulfsynth.egg-info/requires.txt +4 -0
- ulfsynth-0.1.3/ulfsynth.egg-info/top_level.txt +1 -0
ulfsynth-0.1.3/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Toufiq Musah
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
include LICENSE
|
|
2
|
+
include README.md
|
|
3
|
+
include pyproject.toml
|
|
4
|
+
include setup.py
|
|
5
|
+
recursive-include ulfsynth *.py
|
|
6
|
+
recursive-include ulfsynth/_nnunet_src *
|
|
7
|
+
recursive-include assets *
|
|
8
|
+
prune ulfsynth/_nnunet_src/nnunetv2.egg-info
|
|
9
|
+
prune ulfsynth/_nnunet_src/notebooks
|
|
10
|
+
prune ulfsynth/_nnunet_src/documentation
|
ulfsynth-0.1.3/PKG-INFO
ADDED
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ulfsynth
|
|
3
|
+
Version: 0.1.3
|
|
4
|
+
Summary: Physics-Guided Ultra-Low-Field MRI Enhancement & Simulation
|
|
5
|
+
Author: Toufiq Musah
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2026 Toufiq Musah
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
|
27
|
+
|
|
28
|
+
Project-URL: homepage, https://github.com/toufiqmusah/ULF-Synth
|
|
29
|
+
Project-URL: repository, https://github.com/toufiqmusah/ULF-Synth
|
|
30
|
+
Project-URL: documentation, https://github.com/toufiqmusah/ULF-Synth#readme
|
|
31
|
+
Project-URL: Bug Tracker, https://github.com/toufiqmusah/ULF-Synth/issues
|
|
32
|
+
Keywords: mri,ultra-low-field,ulf,medical-image-enhancement,image-synthesis,deep-learning,neuroimaging,nnunet,image-translation
|
|
33
|
+
Classifier: Development Status :: 4 - Beta
|
|
34
|
+
Classifier: Intended Audience :: Science/Research
|
|
35
|
+
Classifier: Intended Audience :: Healthcare Industry
|
|
36
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
37
|
+
Classifier: Programming Language :: Python :: 3
|
|
38
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
39
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
40
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
41
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
42
|
+
Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
|
|
43
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
44
|
+
Classifier: Topic :: Scientific/Engineering :: Image Processing
|
|
45
|
+
Classifier: Operating System :: OS Independent
|
|
46
|
+
Requires-Python: >=3.10
|
|
47
|
+
Description-Content-Type: text/markdown
|
|
48
|
+
License-File: LICENSE
|
|
49
|
+
Requires-Dist: numpy>=1.21.0
|
|
50
|
+
Requires-Dist: nibabel>=3.2.0
|
|
51
|
+
Requires-Dist: scipy>=1.7.0
|
|
52
|
+
Requires-Dist: torch>=2.1.0
|
|
53
|
+
Dynamic: license-file
|
|
54
|
+
Dynamic: requires-dist
|
|
55
|
+
Dynamic: summary
|
|
56
|
+
|
|
57
|
+
<p align="center">
|
|
58
|
+
<img src="assets/method.png" alt="ULF-Synth" width="100%">
|
|
59
|
+
</p>
|
|
60
|
+
|
|
61
|
+
<h1 align="center">ULF-Synth: Physics-Guided Ultra-Low-Field MRI Enhancement for Pediatric Neuroimaging</h1>
|
|
62
|
+
|
|
63
|
+
<p align="center">
|
|
64
|
+
<a href="https://arxiv.org/abs/2605.24625v1"><img src="https://img.shields.io/badge/arXiv-2605.24625-b31b1b.svg" alt="arXiv"></a>
|
|
65
|
+
<a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License: MIT"></a>
|
|
66
|
+
<a href="https://www.python.org/"><img src="https://img.shields.io/badge/python-3.9%2B-blue" alt="Python"></a>
|
|
67
|
+
</p>
|
|
68
|
+
|
|
69
|
+
## Abstract
|
|
70
|
+
|
|
71
|
+
Ultra-low-field (ULF) MRI enables portable and accessible neuroimaging, but suffers from low signal-to-noise ratio and limited spatial resolution relative to high-field (HF) systems. Acquiring paired ULF–HF data for supervised enhancement is often infeasible, particularly in resource-limited settings. We introduce **ULF-Synth**, a framework combining: (i) acquisition-based synthesis of realistic ULF images from HF volumes for large-scale paired training, and (ii) a spatial-frequency domain objective that prioritizes recovery of high-frequency anatomical detail. The formulation is architecture-agnostic, consistently improving structural similarity and perceptual fidelity across encoder-decoder, adversarial, and diffusion-based translation models. Trained exclusively on synthetic data, our models generalize to real 64 mT ULF acquisitions, improving multiclass brain segmentation and achieving higher radiologist preference and diagnostic acceptability in a blinded reader study.
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## Simulation Pipeline
|
|
76
|
+
|
|
77
|
+
The ULF synthesis module models the key physical phenomena distinguishing ULF from HF acquisitions:
|
|
78
|
+
|
|
79
|
+
| | Effect | Implementation |
|
|
80
|
+
|:---:|---|---|
|
|
81
|
+
| 1 | **Signal scaling** | $(B_{{ULF}}/B_{{HF}})^2$ polarization ratio |
|
|
82
|
+
| 2 | **T2\* decay & B0 inhomogeneity** | Spatially-varying exponential decay from random B0 field maps |
|
|
83
|
+
| 3 | **Thermal noise** | Gaussian noise scaled to SNR 15–50 |
|
|
84
|
+
| 4 | **k-space cropping** | Reduced resolution (45–55%) |
|
|
85
|
+
| 5 | **k-space undersampling** | Accelerated acquisition (2×–3×) with center-out sampling |
|
|
86
|
+
| 6 | **B0 off-resonance distortion** | Phase distortion from random B0 field maps |
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## Qualitative Results
|
|
91
|
+
|
|
92
|
+
<p align="center">
|
|
93
|
+
<img src="assets/results.png" alt="Sample results" width="95%">
|
|
94
|
+
</p>
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## Installation
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
git clone https://github.com/toufiqmusah/ULF-Synth.git
|
|
102
|
+
cd ULF-Synth
|
|
103
|
+
pip install -e .
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
This installs `ulfsynth` and all core dependencies (including PyTorch).
|
|
107
|
+
The bundled [nnUNet translation fork](src/nn-translation/) is automatically
|
|
108
|
+
discovered and installed during setup — no extra steps needed.
|
|
109
|
+
|
|
110
|
+
### Install from PyPI (future)
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
pip install ulfsynth # simulation only
|
|
114
|
+
pip install ulfsynth[full] # with enhancement support
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## CLI
|
|
120
|
+
|
|
121
|
+
The `ulfsynth` package provides three commands:
|
|
122
|
+
|
|
123
|
+
### `ulfsynth simulate` — ULF synthesis from HF volumes
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
# Single volume
|
|
127
|
+
ulfsynth simulate input.nii.gz output.nii.gz
|
|
128
|
+
|
|
129
|
+
# Folder of NIfTI files
|
|
130
|
+
ulfsynth simulate /path/to/hf/scans/ /path/to/ulf/scans/
|
|
131
|
+
|
|
132
|
+
# Reproducible seed
|
|
133
|
+
ulfsynth simulate input.nii.gz output.nii.gz --seed 42
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### `ulfsynth enhance` — ULF→HF restoration (requires nnUNet)
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
# Single volume (CPU)
|
|
140
|
+
ulfsynth enhance --device cpu input.nii.gz output.nii.gz
|
|
141
|
+
|
|
142
|
+
# Folder of NIfTI files (GPU)
|
|
143
|
+
ulfsynth enhance /path/to/ulf/scans/ /path/to/enhanced/scans/
|
|
144
|
+
|
|
145
|
+
# Weights are downloaded from HuggingFace on first use.
|
|
146
|
+
# Pre-download: ulfsynth download-weights
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### `ulfsynth download-weights` — cache pretrained weights
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
ulfsynth download-weights
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
Caches model weights from [HuggingFace](https://huggingface.co/toufiqmusah/ulfsynth-weights) to `~/.cache/ulfsynth/`.
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
## Python API
|
|
160
|
+
|
|
161
|
+
### Simulation
|
|
162
|
+
|
|
163
|
+
```python
|
|
164
|
+
from ulfsynth.simulate import simulate_ulf, simulate_file, simulate_folder, sample_params
|
|
165
|
+
|
|
166
|
+
# Generate one ULF volume with random parameters
|
|
167
|
+
ulf_volume, affine, header, params = simulate_ulf("hf_input.nii.gz")
|
|
168
|
+
|
|
169
|
+
# With a fixed seed
|
|
170
|
+
ulf_volume, affine, header, params = simulate_ulf("hf_input.nii.gz", seed=42)
|
|
171
|
+
|
|
172
|
+
# Custom parameters
|
|
173
|
+
params = sample_params()
|
|
174
|
+
params["signal_target"] = 30
|
|
175
|
+
ulf_volume, affine, header, params = simulate_ulf("hf_input.nii.gz", params=params)
|
|
176
|
+
|
|
177
|
+
# Single-file convenience (returns params dict)
|
|
178
|
+
params = simulate_file("hf_input.nii.gz", "ulf_output.nii.gz", seed=42)
|
|
179
|
+
|
|
180
|
+
# Batch folder processing (returns list of params)
|
|
181
|
+
results = simulate_folder("hf_scans/", "ulf_scans/", seed=42)
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
Output preserves the input affine and header metadata.
|
|
185
|
+
|
|
186
|
+
### Enhancement
|
|
187
|
+
|
|
188
|
+
```python
|
|
189
|
+
from ulfsynth.enhance import enhance_file, enhance_folder
|
|
190
|
+
|
|
191
|
+
# Single file
|
|
192
|
+
enhance_file("ulf_input.nii.gz", "enhanced_output.nii.gz", device="cpu")
|
|
193
|
+
|
|
194
|
+
# Batch folder processing
|
|
195
|
+
enhance_folder("ulf_scans/", "enhanced_scans/", device="cuda")
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
Requires nnUNet (`pip install -e src/nn-translation/`). Weights are auto-downloaded on first call.
|
|
199
|
+
|
|
200
|
+
---
|
|
201
|
+
|
|
202
|
+
## Roadmap
|
|
203
|
+
|
|
204
|
+
- [x] Physics-guided ULF synthesis pipeline
|
|
205
|
+
- [x] Pre-trained enhancement weights — ULF→HF restoration models
|
|
206
|
+
- [x] Python package — `pip install ulfsynth`
|
|
207
|
+
- [ ] Docker image — zero-config containerized pipeline
|
|
208
|
+
|
|
209
|
+
---
|
|
210
|
+
|
|
211
|
+
## Citation
|
|
212
|
+
|
|
213
|
+
```bibtex
|
|
214
|
+
@misc{musah2026ulfsynth,
|
|
215
|
+
title = {ULF-Synth: Physics-Guided Ultra-Low-Field MRI Enhancement for Pediatric Neuroimaging},
|
|
216
|
+
author = {Toufiq Musah and Salvatore Calcagno and Federica Proietto Salanitri and Xiaomeng Li and Maruf Adewole and Marawan Elbatel},
|
|
217
|
+
year = {2026},
|
|
218
|
+
eprint = {2605.24625},
|
|
219
|
+
archivePrefix = {arXiv},
|
|
220
|
+
url = {https://arxiv.org/abs/2605.24625}
|
|
221
|
+
}
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
---
|
|
225
|
+
|
|
226
|
+
## License
|
|
227
|
+
|
|
228
|
+
[MIT](LICENSE)
|
ulfsynth-0.1.3/README.md
ADDED
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="assets/method.png" alt="ULF-Synth" width="100%">
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<h1 align="center">ULF-Synth: Physics-Guided Ultra-Low-Field MRI Enhancement for Pediatric Neuroimaging</h1>
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
<a href="https://arxiv.org/abs/2605.24625v1"><img src="https://img.shields.io/badge/arXiv-2605.24625-b31b1b.svg" alt="arXiv"></a>
|
|
9
|
+
<a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License: MIT"></a>
|
|
10
|
+
<a href="https://www.python.org/"><img src="https://img.shields.io/badge/python-3.9%2B-blue" alt="Python"></a>
|
|
11
|
+
</p>
|
|
12
|
+
|
|
13
|
+
## Abstract
|
|
14
|
+
|
|
15
|
+
Ultra-low-field (ULF) MRI enables portable and accessible neuroimaging, but suffers from low signal-to-noise ratio and limited spatial resolution relative to high-field (HF) systems. Acquiring paired ULF–HF data for supervised enhancement is often infeasible, particularly in resource-limited settings. We introduce **ULF-Synth**, a framework combining: (i) acquisition-based synthesis of realistic ULF images from HF volumes for large-scale paired training, and (ii) a spatial-frequency domain objective that prioritizes recovery of high-frequency anatomical detail. The formulation is architecture-agnostic, consistently improving structural similarity and perceptual fidelity across encoder-decoder, adversarial, and diffusion-based translation models. Trained exclusively on synthetic data, our models generalize to real 64 mT ULF acquisitions, improving multiclass brain segmentation and achieving higher radiologist preference and diagnostic acceptability in a blinded reader study.
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Simulation Pipeline
|
|
20
|
+
|
|
21
|
+
The ULF synthesis module models the key physical phenomena distinguishing ULF from HF acquisitions:
|
|
22
|
+
|
|
23
|
+
| | Effect | Implementation |
|
|
24
|
+
|:---:|---|---|
|
|
25
|
+
| 1 | **Signal scaling** | $(B_{{ULF}}/B_{{HF}})^2$ polarization ratio |
|
|
26
|
+
| 2 | **T2\* decay & B0 inhomogeneity** | Spatially-varying exponential decay from random B0 field maps |
|
|
27
|
+
| 3 | **Thermal noise** | Gaussian noise scaled to SNR 15–50 |
|
|
28
|
+
| 4 | **k-space cropping** | Reduced resolution (45–55%) |
|
|
29
|
+
| 5 | **k-space undersampling** | Accelerated acquisition (2×–3×) with center-out sampling |
|
|
30
|
+
| 6 | **B0 off-resonance distortion** | Phase distortion from random B0 field maps |
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## Qualitative Results
|
|
35
|
+
|
|
36
|
+
<p align="center">
|
|
37
|
+
<img src="assets/results.png" alt="Sample results" width="95%">
|
|
38
|
+
</p>
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## Installation
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
git clone https://github.com/toufiqmusah/ULF-Synth.git
|
|
46
|
+
cd ULF-Synth
|
|
47
|
+
pip install -e .
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
This installs `ulfsynth` and all core dependencies (including PyTorch).
|
|
51
|
+
The bundled [nnUNet translation fork](src/nn-translation/) is automatically
|
|
52
|
+
discovered and installed during setup — no extra steps needed.
|
|
53
|
+
|
|
54
|
+
### Install from PyPI (future)
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
pip install ulfsynth # simulation only
|
|
58
|
+
pip install ulfsynth[full] # with enhancement support
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## CLI
|
|
64
|
+
|
|
65
|
+
The `ulfsynth` package provides three commands:
|
|
66
|
+
|
|
67
|
+
### `ulfsynth simulate` — ULF synthesis from HF volumes
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
# Single volume
|
|
71
|
+
ulfsynth simulate input.nii.gz output.nii.gz
|
|
72
|
+
|
|
73
|
+
# Folder of NIfTI files
|
|
74
|
+
ulfsynth simulate /path/to/hf/scans/ /path/to/ulf/scans/
|
|
75
|
+
|
|
76
|
+
# Reproducible seed
|
|
77
|
+
ulfsynth simulate input.nii.gz output.nii.gz --seed 42
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### `ulfsynth enhance` — ULF→HF restoration (requires nnUNet)
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
# Single volume (CPU)
|
|
84
|
+
ulfsynth enhance --device cpu input.nii.gz output.nii.gz
|
|
85
|
+
|
|
86
|
+
# Folder of NIfTI files (GPU)
|
|
87
|
+
ulfsynth enhance /path/to/ulf/scans/ /path/to/enhanced/scans/
|
|
88
|
+
|
|
89
|
+
# Weights are downloaded from HuggingFace on first use.
|
|
90
|
+
# Pre-download: ulfsynth download-weights
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### `ulfsynth download-weights` — cache pretrained weights
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
ulfsynth download-weights
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Caches model weights from [HuggingFace](https://huggingface.co/toufiqmusah/ulfsynth-weights) to `~/.cache/ulfsynth/`.
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## Python API
|
|
104
|
+
|
|
105
|
+
### Simulation
|
|
106
|
+
|
|
107
|
+
```python
|
|
108
|
+
from ulfsynth.simulate import simulate_ulf, simulate_file, simulate_folder, sample_params
|
|
109
|
+
|
|
110
|
+
# Generate one ULF volume with random parameters
|
|
111
|
+
ulf_volume, affine, header, params = simulate_ulf("hf_input.nii.gz")
|
|
112
|
+
|
|
113
|
+
# With a fixed seed
|
|
114
|
+
ulf_volume, affine, header, params = simulate_ulf("hf_input.nii.gz", seed=42)
|
|
115
|
+
|
|
116
|
+
# Custom parameters
|
|
117
|
+
params = sample_params()
|
|
118
|
+
params["signal_target"] = 30
|
|
119
|
+
ulf_volume, affine, header, params = simulate_ulf("hf_input.nii.gz", params=params)
|
|
120
|
+
|
|
121
|
+
# Single-file convenience (returns params dict)
|
|
122
|
+
params = simulate_file("hf_input.nii.gz", "ulf_output.nii.gz", seed=42)
|
|
123
|
+
|
|
124
|
+
# Batch folder processing (returns list of params)
|
|
125
|
+
results = simulate_folder("hf_scans/", "ulf_scans/", seed=42)
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Output preserves the input affine and header metadata.
|
|
129
|
+
|
|
130
|
+
### Enhancement
|
|
131
|
+
|
|
132
|
+
```python
|
|
133
|
+
from ulfsynth.enhance import enhance_file, enhance_folder
|
|
134
|
+
|
|
135
|
+
# Single file
|
|
136
|
+
enhance_file("ulf_input.nii.gz", "enhanced_output.nii.gz", device="cpu")
|
|
137
|
+
|
|
138
|
+
# Batch folder processing
|
|
139
|
+
enhance_folder("ulf_scans/", "enhanced_scans/", device="cuda")
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Requires nnUNet (`pip install -e src/nn-translation/`). Weights are auto-downloaded on first call.
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
## Roadmap
|
|
147
|
+
|
|
148
|
+
- [x] Physics-guided ULF synthesis pipeline
|
|
149
|
+
- [x] Pre-trained enhancement weights — ULF→HF restoration models
|
|
150
|
+
- [x] Python package — `pip install ulfsynth`
|
|
151
|
+
- [ ] Docker image — zero-config containerized pipeline
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
## Citation
|
|
156
|
+
|
|
157
|
+
```bibtex
|
|
158
|
+
@misc{musah2026ulfsynth,
|
|
159
|
+
title = {ULF-Synth: Physics-Guided Ultra-Low-Field MRI Enhancement for Pediatric Neuroimaging},
|
|
160
|
+
author = {Toufiq Musah and Salvatore Calcagno and Federica Proietto Salanitri and Xiaomeng Li and Maruf Adewole and Marawan Elbatel},
|
|
161
|
+
year = {2026},
|
|
162
|
+
eprint = {2605.24625},
|
|
163
|
+
archivePrefix = {arXiv},
|
|
164
|
+
url = {https://arxiv.org/abs/2605.24625}
|
|
165
|
+
}
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
---
|
|
169
|
+
|
|
170
|
+
## License
|
|
171
|
+
|
|
172
|
+
[MIT](LICENSE)
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "ulfsynth"
|
|
7
|
+
dynamic = ["version", "description", "dependencies", "optional-dependencies"]
|
|
8
|
+
readme = "README.md"
|
|
9
|
+
requires-python = ">=3.10"
|
|
10
|
+
license = { file = "LICENSE" }
|
|
11
|
+
authors = [
|
|
12
|
+
{ name = "Toufiq Musah" },
|
|
13
|
+
]
|
|
14
|
+
keywords = [
|
|
15
|
+
"mri", "ultra-low-field", "ulf", "medical-image-enhancement",
|
|
16
|
+
"image-synthesis", "deep-learning", "neuroimaging",
|
|
17
|
+
"nnunet", "image-translation",
|
|
18
|
+
]
|
|
19
|
+
classifiers = [
|
|
20
|
+
"Development Status :: 4 - Beta",
|
|
21
|
+
"Intended Audience :: Science/Research",
|
|
22
|
+
"Intended Audience :: Healthcare Industry",
|
|
23
|
+
"License :: OSI Approved :: MIT License",
|
|
24
|
+
"Programming Language :: Python :: 3",
|
|
25
|
+
"Programming Language :: Python :: 3.9",
|
|
26
|
+
"Programming Language :: Python :: 3.10",
|
|
27
|
+
"Programming Language :: Python :: 3.11",
|
|
28
|
+
"Programming Language :: Python :: 3.12",
|
|
29
|
+
"Topic :: Scientific/Engineering :: Medical Science Apps.",
|
|
30
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
31
|
+
"Topic :: Scientific/Engineering :: Image Processing",
|
|
32
|
+
"Operating System :: OS Independent",
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
[project.urls]
|
|
36
|
+
homepage = "https://github.com/toufiqmusah/ULF-Synth"
|
|
37
|
+
repository = "https://github.com/toufiqmusah/ULF-Synth"
|
|
38
|
+
documentation = "https://github.com/toufiqmusah/ULF-Synth#readme"
|
|
39
|
+
"Bug Tracker" = "https://github.com/toufiqmusah/ULF-Synth/issues"
|
|
40
|
+
|
|
41
|
+
[project.scripts]
|
|
42
|
+
ulfsynth = "ulfsynth.cli:main"
|
|
43
|
+
|
|
44
|
+
[tool.setuptools.packages.find]
|
|
45
|
+
include = ["ulfsynth*"]
|
|
46
|
+
|
|
47
|
+
[tool.ruff]
|
|
48
|
+
exclude = ["ulfsynth/_nnunet_src"]
|
ulfsynth-0.1.3/setup.cfg
ADDED
ulfsynth-0.1.3/setup.py
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"""Setup script for ULF-Synth.
|
|
2
|
+
|
|
3
|
+
The nnunetv2 fork (with MRCT kspace trainer) is bundled inside the
|
|
4
|
+
package at ``ulfsynth/_nnunet_src/`` and auto-installed on first use.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
import sys
|
|
8
|
+
from setuptools import setup
|
|
9
|
+
|
|
10
|
+
if sys.version_info < (3, 10):
|
|
11
|
+
sys.exit(f"ulfsynth requires Python >= 3.10, found {sys.version}")
|
|
12
|
+
|
|
13
|
+
setup(
|
|
14
|
+
version="0.1.3",
|
|
15
|
+
description="Physics-Guided Ultra-Low-Field MRI Enhancement & Simulation",
|
|
16
|
+
install_requires=[
|
|
17
|
+
"numpy>=1.21.0",
|
|
18
|
+
"nibabel>=3.2.0",
|
|
19
|
+
"scipy>=1.7.0",
|
|
20
|
+
"torch>=2.1.0",
|
|
21
|
+
],
|
|
22
|
+
)
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"""
|
|
2
|
+
ULF-Synth: Physics-Guided Ultra-Low-Field MRI Enhancement & Simulation.
|
|
3
|
+
|
|
4
|
+
Submodules:
|
|
5
|
+
simulate — Synthesize realistic ULF MRI from high-field NIfTI volumes
|
|
6
|
+
enhance — Enhance ULF MRI using pretrained restoration models
|
|
7
|
+
cli — Command-line interface (ulfsynth simulate, ulfsynth enhance)
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
__version__ = "0.1.3"
|