diff --git a/ConvexAdam_Coarse/Prediction.yml b/ConvexAdam_Coarse/Prediction.yml index 4a714113b27acead7b8209f4c6281bb90506347e..fd6d7ac41cceba69092e0c158382a9338324908f 100644 --- a/ConvexAdam_Coarse/Prediction.yml +++ b/ConvexAdam_Coarse/Prediction.yml @@ -5,12 +5,24 @@ Predictor: models: '0': ref: VBoussot/impact-torchscript-models:MIND/R1D2_3D.pt + voxel_size: + - 3.0 + - 3.0 + - 3.0 layers_mask: '1' - layers_weight: - - 1.0 + layers_weight: 1.0 + pca: 0 + distance: L1 + overlap: 2 mixed_precision: false grid_spacing: 6 displacement_half_width: 4 + iterations: 80 + learning_rate: 1.0 + regularization_weight: 1.25 + grid_shrink: 2 + control_grid_smoothing: 3 + subset_features: [] linear: true linear_iterations: 200 seed: 42 @@ -67,15 +79,10 @@ Predictor: prob: 1 nb: 2 Patch: - patch_size: - - 0 - - 0 - - 0 + patch_size: [0, 0, 0] overlap: 20% pad_value: None extend_slice: 0 - mode: resample - max_voxels: None subset: None dataset_filenames: - ./Dataset/:mha diff --git a/ConvexAdam_Coarse/app.json b/ConvexAdam_Coarse/app.json index 29a6a53db791e21cd744698b52e7a5ea75ceeadd..3282d82d41494d6376218842f58a1653681a891e 100644 --- a/ConvexAdam_Coarse/app.json +++ b/ConvexAdam_Coarse/app.json @@ -85,10 +85,5 @@ } } } - }, - "vram_bytes_per_voxel": 350, - "tiling": { - "global": "Prediction.yml" - }, - "ram_bytes_per_voxel": 800 + } } diff --git a/ConvexAdam_Coarse/requirements.txt b/ConvexAdam_Coarse/requirements.txt index 01451364378c844fe7656363752e3e1c50561509..5f3cb92684944e91bbb99146d29b9e97740f9bac 100644 --- a/ConvexAdam_Coarse/requirements.txt +++ b/ConvexAdam_Coarse/requirements.txt @@ -1,2 +1,2 @@ -itk-impact>=0.1.1,<0.1.6 +itk-impact>=0.1.1 impact_reg_konfai>=1.7.0 diff --git a/ConvexAdam_Composite/Prediction.yml b/ConvexAdam_Composite/Prediction.yml index 60eff14eb05597616ba1d18eacd25b942dd97f1a..5330bdeba722656cc88fcb767134e85ac397505a 100644 --- a/ConvexAdam_Composite/Prediction.yml +++ b/ConvexAdam_Composite/Prediction.yml @@ -5,19 +5,24 @@ Predictor: models: '0': ref: VBoussot/impact-torchscript-models:MIND/R1D2_3D.pt + voxel_size: + - 3.0 + - 3.0 + - 3.0 layers_mask: '1' - layers_weight: - - 1.0 + layers_weight: 1.0 pca: 0 - distance: L2 + distance: L1 + overlap: 2 mixed_precision: false grid_spacing: 6 displacement_half_width: 4 iterations: 80 - learning_rate: 2.0 + learning_rate: 1.0 regularization_weight: 1.25 grid_shrink: 2 control_grid_smoothing: 3 + subset_features: [] linear: true linear_iterations: 200 seed: 42 @@ -75,15 +80,10 @@ Predictor: prob: 1 nb: 2 Patch: - patch_size: - - 0 - - 0 - - 0 + patch_size: [0, 0, 0] overlap: 20% pad_value: None extend_slice: 0 - mode: resample - max_voxels: None subset: None dataset_filenames: - ./Dataset/:mha diff --git a/ConvexAdam_Composite/Prediction_tile.yml b/ConvexAdam_Composite/Prediction_tile.yml deleted file mode 100644 index 952cbf5fd0bc2dd11f40dbea1a776cf1d3e0ca27..0000000000000000000000000000000000000000 --- a/ConvexAdam_Composite/Prediction_tile.yml +++ /dev/null @@ -1,115 +0,0 @@ -Predictor: - Model: - classpath: impact_reg_konfai.models.convexadam:RegistrationNet - RegistrationNet: - models: - '0': - ref: VBoussot/impact-torchscript-models:MIND/R1D2_3D.pt - layers_mask: '1' - layers_weight: - - 1.0 - pca: 0 - distance: L2 - mixed_precision: false - grid_spacing: 6 - displacement_half_width: 4 - iterations: 80 - learning_rate: 2.0 - regularization_weight: 1.25 - grid_shrink: 2 - control_grid_smoothing: 3 - linear: false - linear_iterations: 200 - seed: 42 - outputs_criterions: None - stages: - - fine - Dataset: - groups_src: - Volume_0: - groups_dest: - Fixed: - transforms: - TensorCast: - dtype: float32 - inverse: false - patch_transforms: None - is_input: true - Volume_1: - groups_dest: - Moving: - transforms: - TensorCast: - dtype: float32 - inverse: false - patch_transforms: None - is_input: true - Volume_2: - groups_dest: - FixedMask: - transforms: - TensorCast: - dtype: float32 - inverse: false - patch_transforms: None - is_input: true - Volume_3: - groups_dest: - MovingMask: - transforms: - TensorCast: - dtype: float32 - inverse: false - patch_transforms: None - is_input: true - augmentations: - DataAugmentation_0: - data_augmentations: - Flip: - f_prob: - - 0 - - 0.5 - - 0.5 - vector_field: true - prob: 1 - nb: 2 - Patch: - patch_size: - - 0 - - 0 - - 0 - overlap: 20% - pad_value: None - extend_slice: 0 - mode: tile - max_voxels: None - subset: None - dataset_filenames: - - ./Dataset/:mha - batch_size: 1 - num_workers: None - pin_memory: false - prefetch_factor: None - persistent_workers: None - outputs_dataset: - DisplacementField: - OutputDataset: - name_class: OutputDataset - before_reduction_transforms: None - after_reduction_transforms: None - final_transforms: - TensorCast: - dtype: float32 - inverse: false - dataset_filename: Transform:itktransform - group: Transform - same_as_group: Volume_0:Fixed - patch_combine: Cosinus - reduction: Mean - Mean: {} - train_name: ImpactReg-ConvexAdam-Composite - manual_seed: 42 - gpu_checkpoints: None - combine: Mean - autocast: false - data_log: None diff --git a/ConvexAdam_Composite/app.json b/ConvexAdam_Composite/app.json index 660aa1b0d9b81f9cdf8aae35cbb1315e71747755..76f4fac70fc7089ba3b9250607cb9af70ced8749 100644 --- a/ConvexAdam_Composite/app.json +++ b/ConvexAdam_Composite/app.json @@ -1,7 +1,7 @@ { "display_name": "ConvexAdam (MIND)", "short_description": "Coarse + fine ConvexAdam registration in one app (IMPACT/MIND features).", - "description": "The full ConvexAdam pipeline chained in one app: optional moments+affine linear pre-align, then a ConvexAdam coarse coupled-convex initialization, then an Adam instance-optimisation refinement, all driven by the IMPACT metric on MIND features. Produces the displacement field on the fixed grid, from which impact-reg-konfai derives the moved image.", + "description": "The full ConvexAdam pipeline chained in one app: optional moments+affine linear pre-align, then a ConvexAdam coarse coupled-convex initialization, then an Adam instance-optimisation refinement, all driven by the IMPACT metric on MIND features. Produces the moved image and the displacement field on the fixed grid.", "task": "registration", "tta": 0, "mc_dropout": 0, @@ -85,13 +85,5 @@ } } } - }, - "vram_bytes_per_voxel": 350, - "tiling": { - "global": "Prediction.yml", - "tile": "Prediction_tile.yml", - "tile_vram_bytes_per_voxel": 350, - "tile_ram_bytes_per_voxel": 800 - }, - "ram_bytes_per_voxel": 800 + } } diff --git a/ConvexAdam_Composite/requirements.txt b/ConvexAdam_Composite/requirements.txt index 01451364378c844fe7656363752e3e1c50561509..5f3cb92684944e91bbb99146d29b9e97740f9bac 100644 --- a/ConvexAdam_Composite/requirements.txt +++ b/ConvexAdam_Composite/requirements.txt @@ -1,2 +1,2 @@ -itk-impact>=0.1.1,<0.1.6 +itk-impact>=0.1.1 impact_reg_konfai>=1.7.0 diff --git a/ConvexAdam_IMPACT_CBCT/Evaluation_with_fid.yml b/ConvexAdam_IMPACT_CBCT/Evaluation_with_fid.yml deleted file mode 100644 index 267c860058b1bcbbfe85cc6ae314289089b9ed23..0000000000000000000000000000000000000000 --- a/ConvexAdam_IMPACT_CBCT/Evaluation_with_fid.yml +++ /dev/null @@ -1,22 +0,0 @@ -Evaluator: - metrics: - FixedFid: - targets_criterions: - MovingFid: - criterions_loader: - TRE: {} - Dataset: - groups_src: - Volume_0: - groups_dest: - FixedFid: - transforms: None - Reference_0: - groups_dest: - MovingFid: - transforms: None - subset: None - dataset_filenames: - - ./Dataset:mha - validation: None - train_name: ImpactReg diff --git a/ConvexAdam_IMPACT_CBCT/Evaluation_with_images.yml b/ConvexAdam_IMPACT_CBCT/Evaluation_with_images.yml deleted file mode 100644 index ce145cfb0b192646149642d91f15e53da8a5bfe6..0000000000000000000000000000000000000000 --- a/ConvexAdam_IMPACT_CBCT/Evaluation_with_images.yml +++ /dev/null @@ -1,35 +0,0 @@ -Evaluator: - metrics: - FixedImage: - targets_criterions: - MovingImage;Mask: - criterions_loader: - MAESaveMap: - reduction: mean - dataset: ./Evaluations/ImpactReg/Output:mha - group: MAE_map - Dataset: - groups_src: - Volume_0: - groups_dest: - FixedImage: - transforms: - TensorCast: - dtype: float32 - Reference_0: - groups_dest: - MovingImage: - transforms: - TensorCast: - dtype: float32 - Mask_0: - groups_dest: - Mask: - transforms: - TensorCast: - dtype: uint8 - subset: None - dataset_filenames: - - ./Dataset:mha - validation: None - train_name: ImpactReg diff --git a/ConvexAdam_IMPACT_CBCT/Evaluation_with_seg.yml b/ConvexAdam_IMPACT_CBCT/Evaluation_with_seg.yml deleted file mode 100644 index 6221238dd64ccead3148eb85730feb73df4d8fde..0000000000000000000000000000000000000000 --- a/ConvexAdam_IMPACT_CBCT/Evaluation_with_seg.yml +++ /dev/null @@ -1,29 +0,0 @@ -Evaluator: - metrics: - FixedSeg: - targets_criterions: - MovingSeg: - criterions_loader: - DiceSaveMap: - labels: None - dataset: ./Evaluations/ImpactReg/Output:mha - group: Seg_MAE_map - Dataset: - groups_src: - Volume_0: - groups_dest: - FixedSeg: - transforms: - TensorCast: - dtype: uint8 - Reference_0: - groups_dest: - MovingSeg: - transforms: - TensorCast: - dtype: uint8 - subset: None - dataset_filenames: - - ./Dataset:mha - validation: None - train_name: ImpactReg diff --git a/ConvexAdam_IMPACT_CBCT/Prediction.yml b/ConvexAdam_IMPACT_CBCT/Prediction.yml deleted file mode 100644 index b5a1c7dde6590ea29a55c4e6fa0dd988a90f3944..0000000000000000000000000000000000000000 --- a/ConvexAdam_IMPACT_CBCT/Prediction.yml +++ /dev/null @@ -1,123 +0,0 @@ -Predictor: - Model: - classpath: impact_reg_konfai.models.convexadam:RegistrationNet - RegistrationNet: - models: - '0': - ref: VBoussot/impact-torchscript-models:MIND/R1D2_3D.pt - layers_mask: '1' - layers_weight: - - 1.0 - pca: 0 - distance: L2 - '1': - ref: VBoussot/impact-torchscript-models:TS/M730.pt - layers_mask: '01' - layers_weight: - - 1.0 - pca: 0 - distance: L2 - mixed_precision: false - grid_spacing: 6 - displacement_half_width: 4 - iterations: 80 - learning_rate: 2.0 - regularization_weight: 5.0 - grid_shrink: 2 - control_grid_smoothing: 3 - linear: true - linear_iterations: 200 - seed: 42 - outputs_criterions: None - stages: - - coarse - - fine - Dataset: - groups_src: - Volume_0: - groups_dest: - Fixed: - transforms: - TensorCast: - dtype: float32 - inverse: false - patch_transforms: None - is_input: true - Volume_1: - groups_dest: - Moving: - transforms: - TensorCast: - dtype: float32 - inverse: false - patch_transforms: None - is_input: true - Volume_2: - groups_dest: - FixedMask: - transforms: - TensorCast: - dtype: float32 - inverse: false - patch_transforms: None - is_input: true - Volume_3: - groups_dest: - MovingMask: - transforms: - TensorCast: - dtype: float32 - inverse: false - patch_transforms: None - is_input: true - augmentations: - DataAugmentation_0: - data_augmentations: - Flip: - f_prob: - - 0 - - 0.5 - - 0.5 - vector_field: true - prob: 1 - nb: 2 - Patch: - patch_size: - - 0 - - 0 - - 0 - overlap: 20% - pad_value: None - extend_slice: 0 - mode: resample - max_voxels: None - subset: None - dataset_filenames: - - ./Dataset/:mha - batch_size: 1 - num_workers: None - pin_memory: false - prefetch_factor: None - persistent_workers: None - outputs_dataset: - DisplacementField: - OutputDataset: - name_class: OutputDataset - before_reduction_transforms: None - after_reduction_transforms: None - final_transforms: - TensorCast: - dtype: float32 - inverse: false - dataset_filename: Transform:itktransform - group: Transform - same_as_group: Volume_0:Fixed - patch_combine: Cosinus - reduction: Mean - Mean: {} - train_name: ImpactReg-ConvexAdam-IMPACT-CBCT - manual_seed: 42 - gpu_checkpoints: None - combine: Mean - autocast: false - data_log: None diff --git a/ConvexAdam_IMPACT_CBCT/Prediction_tile.yml b/ConvexAdam_IMPACT_CBCT/Prediction_tile.yml deleted file mode 100644 index 30427eb73c77e518e346fa531aab29f9c2f3931b..0000000000000000000000000000000000000000 --- a/ConvexAdam_IMPACT_CBCT/Prediction_tile.yml +++ /dev/null @@ -1,122 +0,0 @@ -Predictor: - Model: - classpath: impact_reg_konfai.models.convexadam:RegistrationNet - RegistrationNet: - models: - '0': - ref: VBoussot/impact-torchscript-models:MIND/R1D2_3D.pt - layers_mask: '1' - layers_weight: - - 1.0 - pca: 0 - distance: L2 - '1': - ref: VBoussot/impact-torchscript-models:TS/M730.pt - layers_mask: '01' - layers_weight: - - 1.0 - pca: 0 - distance: L2 - mixed_precision: false - grid_spacing: 6 - displacement_half_width: 4 - iterations: 80 - learning_rate: 2.0 - regularization_weight: 5.0 - grid_shrink: 2 - control_grid_smoothing: 3 - linear: false - linear_iterations: 200 - seed: 42 - outputs_criterions: None - stages: - - fine - Dataset: - groups_src: - Volume_0: - groups_dest: - Fixed: - transforms: - TensorCast: - dtype: float32 - inverse: false - patch_transforms: None - is_input: true - Volume_1: - groups_dest: - Moving: - transforms: - TensorCast: - dtype: float32 - inverse: false - patch_transforms: None - is_input: true - Volume_2: - groups_dest: - FixedMask: - transforms: - TensorCast: - dtype: float32 - inverse: false - patch_transforms: None - is_input: true - Volume_3: - groups_dest: - MovingMask: - transforms: - TensorCast: - dtype: float32 - inverse: false - patch_transforms: None - is_input: true - augmentations: - DataAugmentation_0: - data_augmentations: - Flip: - f_prob: - - 0 - - 0.5 - - 0.5 - vector_field: true - prob: 1 - nb: 2 - Patch: - patch_size: - - 0 - - 0 - - 0 - overlap: 20% - pad_value: None - extend_slice: 0 - mode: tile - max_voxels: None - subset: None - dataset_filenames: - - ./Dataset/:mha - batch_size: 1 - num_workers: None - pin_memory: false - prefetch_factor: None - persistent_workers: None - outputs_dataset: - DisplacementField: - OutputDataset: - name_class: OutputDataset - before_reduction_transforms: None - after_reduction_transforms: None - final_transforms: - TensorCast: - dtype: float32 - inverse: false - dataset_filename: Transform:itktransform - group: Transform - same_as_group: Volume_0:Fixed - patch_combine: Cosinus - reduction: Mean - Mean: {} - train_name: ImpactReg-ConvexAdam-IMPACT-CBCT - manual_seed: 42 - gpu_checkpoints: None - combine: Mean - autocast: false - data_log: None diff --git a/ConvexAdam_IMPACT_CBCT/Uncertainty.yml b/ConvexAdam_IMPACT_CBCT/Uncertainty.yml deleted file mode 100644 index 9507d1b0c994741a002aa0d44c24b55847e61ce0..0000000000000000000000000000000000000000 --- a/ConvexAdam_IMPACT_CBCT/Uncertainty.yml +++ /dev/null @@ -1,24 +0,0 @@ -Evaluator: - metrics: - Uncertainty: - targets_criterions: - None: - criterions_loader: - Mean: - name: Uncertainty - Dataset: - groups_src: - Volume_0: - groups_dest: - Uncertainty: - transforms: - Norm: {} - StandardDeviation: {} - Save: - dataset: ./Uncertainties/ImpactReg/Output:mha - group: None - subset: None - dataset_filenames: - - ./Dataset:mha - validation: None - train_name: ImpactReg diff --git a/ConvexAdam_IMPACT_CBCT/app.json b/ConvexAdam_IMPACT_CBCT/app.json deleted file mode 100644 index d9b016320a4e8418aae73047658d19366ae00aeb..0000000000000000000000000000000000000000 --- a/ConvexAdam_IMPACT_CBCT/app.json +++ /dev/null @@ -1,97 +0,0 @@ -{ - "display_name": "ConvexAdam, MIND + TotalSegmentator MR early layer", - "short_description": "ConvexAdam_Composite (MIND) with the second layer of TotalSegmentator MR (TS/M730) added, for CT/CBCT.", - "description": "ConvexAdam_Composite (MIND) with the second layer of TotalSegmentator MR (TS/M730) added, for CT/CBCT. Everything else is ConvexAdam_Composite's (the affine pre-alignment on mutual information, the coupled-convex coarse search, then the Adam refinement, on both feature models) except the refinement's regularisation, raised to 5: with the refinement's IMPACT loss normalised (every feature layer starts at 1), thorax CBCT folded 2.0 % of the body at 2.5 and 0.3 % at 5 (Dice 0.496 and 0.498), OASIS 0.9 % and 0.1 %, AbdomenCTCT 0.75 % and 0.01 %.", - "task": "registration", - "tta": 0, - "mc_dropout": 0, - "models": [], - "inputs": { - "Fixed": { - "display_name": "Fixed image", - "volume_type": "VOLUME", - "required": true - }, - "Moving": { - "display_name": "Moving image", - "volume_type": "VOLUME", - "required": true - }, - "FixedMask": { - "display_name": "Fixed mask (optional)", - "volume_type": "SEGMENTATION", - "required": false, - "default": "ones" - }, - "MovingMask": { - "display_name": "Moving mask (optional)", - "volume_type": "SEGMENTATION", - "required": false, - "default": "ones" - } - }, - "outputs": { - "DisplacementField": { - "display_name": "Displacement field", - "volume_type": "VOLUME", - "required": true - } - }, - "inputs_evaluations": { - "Image": { - "Evaluation_with_images.yml": { - "FixedImage": { - "display_name": "Fixed image", - "volume_type": "VOLUME", - "required": true - }, - "MovingImage": { - "display_name": "Moving image", - "volume_type": "VOLUME", - "required": true - }, - "Mask": { - "display_name": "Evaluation mask", - "volume_type": "SEGMENTATION", - "required": false - } - } - }, - "Segmentation": { - "Evaluation_with_seg.yml": { - "FixedSeg": { - "display_name": "Fixed segmentation", - "volume_type": "SEGMENTATION", - "required": true - }, - "MovingSeg": { - "display_name": "Moving segmentation", - "volume_type": "SEGMENTATION", - "required": true - } - } - }, - "Landmarks": { - "Evaluation_with_fid.yml": { - "FixedFid": { - "display_name": "Fixed landmarks", - "volume_type": "FIDUCIALS", - "required": true - }, - "MovingFid": { - "display_name": "Moving landmarks", - "volume_type": "FIDUCIALS", - "required": true - } - } - } - }, - "vram_bytes_per_voxel": 650, - "tiling": { - "global": "Prediction.yml", - "tile": "Prediction_tile.yml", - "tile_vram_bytes_per_voxel": 650, - "tile_ram_bytes_per_voxel": 1200 - }, - "ram_bytes_per_voxel": 1200 -} diff --git a/ConvexAdam_IMPACT_CBCT/icon.png b/ConvexAdam_IMPACT_CBCT/icon.png deleted file mode 100644 index ebc0a4a8ab8b6cc732667cd98879965e5c7770c8..0000000000000000000000000000000000000000 Binary files a/ConvexAdam_IMPACT_CBCT/icon.png and /dev/null differ diff --git a/ConvexAdam_IMPACT_CBCT/requirements.txt b/ConvexAdam_IMPACT_CBCT/requirements.txt deleted file mode 100644 index 01451364378c844fe7656363752e3e1c50561509..0000000000000000000000000000000000000000 --- a/ConvexAdam_IMPACT_CBCT/requirements.txt +++ /dev/null @@ -1,2 +0,0 @@ -itk-impact>=0.1.1,<0.1.6 -impact_reg_konfai>=1.7.0 diff --git a/ConvexAdam_IMPACT_MRCT/Evaluation_with_fid.yml b/ConvexAdam_IMPACT_MRCT/Evaluation_with_fid.yml deleted file mode 100644 index 267c860058b1bcbbfe85cc6ae314289089b9ed23..0000000000000000000000000000000000000000 --- a/ConvexAdam_IMPACT_MRCT/Evaluation_with_fid.yml +++ /dev/null @@ -1,22 +0,0 @@ -Evaluator: - metrics: - FixedFid: - targets_criterions: - MovingFid: - criterions_loader: - TRE: {} - Dataset: - groups_src: - Volume_0: - groups_dest: - FixedFid: - transforms: None - Reference_0: - groups_dest: - MovingFid: - transforms: None - subset: None - dataset_filenames: - - ./Dataset:mha - validation: None - train_name: ImpactReg diff --git a/ConvexAdam_IMPACT_MRCT/Evaluation_with_images.yml b/ConvexAdam_IMPACT_MRCT/Evaluation_with_images.yml deleted file mode 100644 index ce145cfb0b192646149642d91f15e53da8a5bfe6..0000000000000000000000000000000000000000 --- a/ConvexAdam_IMPACT_MRCT/Evaluation_with_images.yml +++ /dev/null @@ -1,35 +0,0 @@ -Evaluator: - metrics: - FixedImage: - targets_criterions: - MovingImage;Mask: - criterions_loader: - MAESaveMap: - reduction: mean - dataset: ./Evaluations/ImpactReg/Output:mha - group: MAE_map - Dataset: - groups_src: - Volume_0: - groups_dest: - FixedImage: - transforms: - TensorCast: - dtype: float32 - Reference_0: - groups_dest: - MovingImage: - transforms: - TensorCast: - dtype: float32 - Mask_0: - groups_dest: - Mask: - transforms: - TensorCast: - dtype: uint8 - subset: None - dataset_filenames: - - ./Dataset:mha - validation: None - train_name: ImpactReg diff --git a/ConvexAdam_IMPACT_MRCT/Evaluation_with_seg.yml b/ConvexAdam_IMPACT_MRCT/Evaluation_with_seg.yml deleted file mode 100644 index 6221238dd64ccead3148eb85730feb73df4d8fde..0000000000000000000000000000000000000000 --- a/ConvexAdam_IMPACT_MRCT/Evaluation_with_seg.yml +++ /dev/null @@ -1,29 +0,0 @@ -Evaluator: - metrics: - FixedSeg: - targets_criterions: - MovingSeg: - criterions_loader: - DiceSaveMap: - labels: None - dataset: ./Evaluations/ImpactReg/Output:mha - group: Seg_MAE_map - Dataset: - groups_src: - Volume_0: - groups_dest: - FixedSeg: - transforms: - TensorCast: - dtype: uint8 - Reference_0: - groups_dest: - MovingSeg: - transforms: - TensorCast: - dtype: uint8 - subset: None - dataset_filenames: - - ./Dataset:mha - validation: None - train_name: ImpactReg diff --git a/ConvexAdam_IMPACT_MRCT/Prediction.yml b/ConvexAdam_IMPACT_MRCT/Prediction.yml deleted file mode 100644 index aa75fead609da724192e618d070b58011ebaa5bf..0000000000000000000000000000000000000000 --- a/ConvexAdam_IMPACT_MRCT/Prediction.yml +++ /dev/null @@ -1,122 +0,0 @@ -Predictor: - Model: - classpath: impact_reg_konfai.models.convexadam:RegistrationNet - RegistrationNet: - models: - '0': - ref: VBoussot/impact-torchscript-models:MIND/R1D2_3D.pt - layers_mask: '1' - layers_weight: - - 1.0 - pca: 0 - distance: L2 - '1': - ref: VBoussot/impact-torchscript-models:TS/M730.pt - layers_mask: '00000001' - layers_weight: - - 1.0 - pca: 0 - distance: L2 - mixed_precision: false - grid_spacing: 6 - displacement_half_width: 4 - iterations: 80 - learning_rate: 2.0 - regularization_weight: 2.5 - grid_shrink: 2 - control_grid_smoothing: 3 - linear: true - linear_iterations: 200 - seed: 42 - outputs_criterions: None - stages: - - coarse - Dataset: - groups_src: - Volume_0: - groups_dest: - Fixed: - transforms: - TensorCast: - dtype: float32 - inverse: false - patch_transforms: None - is_input: true - Volume_1: - groups_dest: - Moving: - transforms: - TensorCast: - dtype: float32 - inverse: false - patch_transforms: None - is_input: true - Volume_2: - groups_dest: - FixedMask: - transforms: - TensorCast: - dtype: float32 - inverse: false - patch_transforms: None - is_input: true - Volume_3: - groups_dest: - MovingMask: - transforms: - TensorCast: - dtype: float32 - inverse: false - patch_transforms: None - is_input: true - augmentations: - DataAugmentation_0: - data_augmentations: - Flip: - f_prob: - - 0 - - 0.5 - - 0.5 - vector_field: true - prob: 1 - nb: 2 - Patch: - patch_size: - - 0 - - 0 - - 0 - overlap: 20% - pad_value: None - extend_slice: 0 - mode: resample - max_voxels: None - subset: None - dataset_filenames: - - ./Dataset/:mha - batch_size: 1 - num_workers: None - pin_memory: false - prefetch_factor: None - persistent_workers: None - outputs_dataset: - DisplacementField: - OutputDataset: - name_class: OutputDataset - before_reduction_transforms: None - after_reduction_transforms: None - final_transforms: - TensorCast: - dtype: float32 - inverse: false - dataset_filename: Transform:itktransform - group: Transform - same_as_group: Volume_0:Fixed - patch_combine: Cosinus - reduction: Mean - Mean: {} - train_name: ImpactReg-ConvexAdam-IMPACT-MRCT - manual_seed: 42 - gpu_checkpoints: None - combine: Mean - autocast: false - data_log: None diff --git a/ConvexAdam_IMPACT_MRCT/Uncertainty.yml b/ConvexAdam_IMPACT_MRCT/Uncertainty.yml deleted file mode 100644 index 9507d1b0c994741a002aa0d44c24b55847e61ce0..0000000000000000000000000000000000000000 --- a/ConvexAdam_IMPACT_MRCT/Uncertainty.yml +++ /dev/null @@ -1,24 +0,0 @@ -Evaluator: - metrics: - Uncertainty: - targets_criterions: - None: - criterions_loader: - Mean: - name: Uncertainty - Dataset: - groups_src: - Volume_0: - groups_dest: - Uncertainty: - transforms: - Norm: {} - StandardDeviation: {} - Save: - dataset: ./Uncertainties/ImpactReg/Output:mha - group: None - subset: None - dataset_filenames: - - ./Dataset:mha - validation: None - train_name: ImpactReg diff --git a/ConvexAdam_IMPACT_MRCT/app.json b/ConvexAdam_IMPACT_MRCT/app.json deleted file mode 100644 index 30f1cc44a18eb5ca6d0b5f45328a342e6f748c92..0000000000000000000000000000000000000000 --- a/ConvexAdam_IMPACT_MRCT/app.json +++ /dev/null @@ -1,94 +0,0 @@ -{ - "display_name": "ConvexAdam, MIND + TotalSegmentator MR segmentation", - "short_description": "ConvexAdam's coarse search on MIND and the segmentation head of TotalSegmentator MR (TS/M730), for MR/CT.", - "description": "ConvexAdam's coupled-convex coarse search on MIND and the segmentation head of TotalSegmentator MR (TS/M730), for MR/CT: the one-hot map of its 30 structures, compared by squared differences like MIND, after the affine pre-alignment on mutual information. No Adam refinement: on MR/CT pairs the refinement folded 1 to 2 % of the body and cost the head-and-neck pair about 0.2 of Dice, where the coarse field alone reached a Dice of 0.665, 0.599 and 0.686 on the Learn2Reg abdomen, SynthRAD abdomen and SynthRAD head-and-neck MR/CT pairs, with no fold.", - "task": "registration", - "tta": 0, - "mc_dropout": 0, - "models": [], - "inputs": { - "Fixed": { - "display_name": "Fixed image", - "volume_type": "VOLUME", - "required": true - }, - "Moving": { - "display_name": "Moving image", - "volume_type": "VOLUME", - "required": true - }, - "FixedMask": { - "display_name": "Fixed mask (optional)", - "volume_type": "SEGMENTATION", - "required": false, - "default": "ones" - }, - "MovingMask": { - "display_name": "Moving mask (optional)", - "volume_type": "SEGMENTATION", - "required": false, - "default": "ones" - } - }, - "outputs": { - "DisplacementField": { - "display_name": "Displacement field", - "volume_type": "VOLUME", - "required": true - } - }, - "inputs_evaluations": { - "Image": { - "Evaluation_with_images.yml": { - "FixedImage": { - "display_name": "Fixed image", - "volume_type": "VOLUME", - "required": true - }, - "MovingImage": { - "display_name": "Moving image", - "volume_type": "VOLUME", - "required": true - }, - "Mask": { - "display_name": "Evaluation mask", - "volume_type": "SEGMENTATION", - "required": false - } - } - }, - "Segmentation": { - "Evaluation_with_seg.yml": { - "FixedSeg": { - "display_name": "Fixed segmentation", - "volume_type": "SEGMENTATION", - "required": true - }, - "MovingSeg": { - "display_name": "Moving segmentation", - "volume_type": "SEGMENTATION", - "required": true - } - } - }, - "Landmarks": { - "Evaluation_with_fid.yml": { - "FixedFid": { - "display_name": "Fixed landmarks", - "volume_type": "FIDUCIALS", - "required": true - }, - "MovingFid": { - "display_name": "Moving landmarks", - "volume_type": "FIDUCIALS", - "required": true - } - } - } - }, - "vram_bytes_per_voxel": 1150, - "tiling": { - "global": "Prediction.yml" - }, - "ram_bytes_per_voxel": 2050 -} diff --git a/ConvexAdam_IMPACT_MRCT/icon.png b/ConvexAdam_IMPACT_MRCT/icon.png deleted file mode 100644 index ebc0a4a8ab8b6cc732667cd98879965e5c7770c8..0000000000000000000000000000000000000000 Binary files a/ConvexAdam_IMPACT_MRCT/icon.png and /dev/null differ diff --git a/ConvexAdam_IMPACT_MRCT/requirements.txt b/ConvexAdam_IMPACT_MRCT/requirements.txt deleted file mode 100644 index 01451364378c844fe7656363752e3e1c50561509..0000000000000000000000000000000000000000 --- a/ConvexAdam_IMPACT_MRCT/requirements.txt +++ /dev/null @@ -1,2 +0,0 @@ -itk-impact>=0.1.1,<0.1.6 -impact_reg_konfai>=1.7.0 diff --git a/Elastix_IMPACT_Jacobian/ParameterMap_Jacobian.txt b/Elastix_IMPACT_Jacobian/ParameterMap_Jacobian.txt index a459a8449de8c227afb84dc2bb12ab0f1377c10c..359979d3447d97011be991836b28b329ee3e8a31 100644 --- a/Elastix_IMPACT_Jacobian/ParameterMap_Jacobian.txt +++ b/Elastix_IMPACT_Jacobian/ParameterMap_Jacobian.txt @@ -5,7 +5,6 @@ (FinalGridSpacingInPhysicalUnits 10) (FixedImagePyramid "FixedGenericImagePyramid") (MovingImagePyramid "MovingGenericImagePyramid") -(ComputePyramidImagesPerResolution "true") (FixedImagePyramidRescaleSchedule 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1) (MovingImagePyramidRescaleSchedule 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1) // (GridSpacingSchedule 10.000000 5.000000 2.000000 1.000000) diff --git a/Elastix_IMPACT_Jacobian/Parameters_Rigid.txt b/Elastix_IMPACT_Jacobian/Parameters_Rigid.txt deleted file mode 100644 index cce67f5856961b9d1732d17795d60fa36a0677ba..0000000000000000000000000000000000000000 --- a/Elastix_IMPACT_Jacobian/Parameters_Rigid.txt +++ /dev/null @@ -1,147 +0,0 @@ -// Example parameter file for rotation registration -// C-style comments: // - -// The internal pixel type, used for internal computations -// Leave to float in general. -// NB: this is not the type of the input images! The pixel -// type of the input images is automatically read from the -// images themselves. -// This setting can be changed to "short" to save some memory -// in case of very large 3D images. -(FixedInternalImagePixelType "float") -(MovingInternalImagePixelType "float") - -// **************** Main Components ************************** - -// The following components should usually be left as they are: -(Registration "MultiResolutionRegistration") -(Interpolator "BSplineInterpolator") -(ResampleInterpolator "FinalBSplineInterpolator") -(Resampler "DefaultResampler") - -// These may be changed to Fixed/MovingSmoothingImagePyramid. -// See the manual. -(FixedImagePyramid "FixedRecursiveImagePyramid") -(MovingImagePyramid "MovingRecursiveImagePyramid") - -// The following components are most important: -// The optimizer AdaptiveStochasticGradientDescent (ASGD) works -// quite ok in general. The Transform and Metric are important -// and need to be chosen careful for each application. See manual. -(Optimizer "AdaptiveStochasticGradientDescent") -(Transform "EulerTransform") -(Metric "AdvancedMattesMutualInformation") - -// ***************** Transformation ************************** - -// Scales the rotations compared to the translations, to make -// sure they are in the same range. In general, it's best to -// use automatic scales estimation: -(AutomaticScalesEstimation "true") - -// Automatically guess an initial translation by aligning the -// geometric centers of the fixed and moving. -(AutomaticTransformInitialization "true") - -// Whether transforms are combined by composition or by addition. -// In generally, Compose is the best option in most cases. -// It does not influence the results very much. -(HowToCombineTransforms "Compose") - -//Save composite ITK transform -(ITKTransformOutputFileNameExtension "itk.txt") -(WriteITKCompositeTransform "true") - -// ******************* Similarity measure ********************* - -// Number of grey level bins in each resolution level, -// for the mutual information. 16 or 32 usually works fine. -// You could also employ a hierarchical strategy: -//(NumberOfHistogramBins 16 32 64) -(NumberOfHistogramBins 32) - -// If you use a mask, this option is important. -// If the mask serves as region of interest, set it to false. -// If the mask indicates which pixels are valid, then set it to true. -// If you do not use a mask, the option doesn't matter. -(ErodeMask "false") - -// ******************** Multiresolution ********************** - -// The number of resolutions. 1 Is only enough if the expected -// deformations are small. 3 or 4 mostly works fine. For large -// images and large deformations, 5 or 6 may even be useful. -(NumberOfResolutions 4) - -// The downsampling/blurring factors for the image pyramids. -// By default, the images are downsampled by a factor of 2 -// compared to the next resolution. -// So, in 2D, with 4 resolutions, the following schedule is used: -//(ImagePyramidSchedule 8 8 4 4 2 2 1 1 ) -// And in 3D: -//(ImagePyramidSchedule 8 8 8 4 4 4 2 2 2 1 1 1 ) -// You can specify any schedule, for example: -//(ImagePyramidSchedule 4 4 4 3 2 1 1 1 ) -// Make sure that the number of elements equals the number -// of resolutions times the image dimension. - -// ******************* Optimizer **************************** - -// Maximum number of iterations in each resolution level: -// 200-500 works usually fine for rigid registration. -// For more robustness, you may increase this to 1000-2000. -(MaximumNumberOfIterations 250) - -// The step size of the optimizer, in mm. By default the voxel size is used. -// which usually works well. In case of unusual high-resolution images -// (eg histology) it is necessary to increase this value a bit, to the size -// of the "smallest visible structure" in the image: -//(MaximumStepLength 1.0) - -// **************** Image sampling ********************** - -// Number of spatial samples used to compute the mutual -// information (and its derivative) in each iteration. -// With an AdaptiveStochasticGradientDescent optimizer, -// in combination with the two options below, around 2000 -// samples may already suffice. -(NumberOfSpatialSamples 2048) - -// Refresh these spatial samples in every iteration, and select -// them randomly. See the manual for information on other sampling -// strategies. -(NewSamplesEveryIteration "true") -(ImageSampler "Random") - -// ************* Interpolation and Resampling **************** - -// Order of B-Spline interpolation used during registration/optimisation. -// It may improve accuracy if you set this to 3. Never use 0. -// An order of 1 gives linear interpolation. This is in most -// applications a good choice. -(BSplineInterpolationOrder 1) - -// Order of B-Spline interpolation used for applying the final -// deformation. -// 3 gives good accuracy; recommended in most cases. -// 1 gives worse accuracy (linear interpolation) -// 0 gives worst accuracy, but is appropriate for binary images -// (masks, segmentations); equivalent to nearest neighbor interpolation. -(FinalBSplineInterpolationOrder 3) - -//Default pixel value for pixels that come from outside the picture: -(DefaultPixelValue 0) - -// Choose whether to generate the deformed moving image. -// You can save some time by setting this to false, if you are -// only interested in the final (nonrigidly) deformed moving image -// for example. -(WriteResultImage "false") - -// The pixel type and format of the resulting deformed moving image -(ResultImagePixelType "short") -(ResultImageFormat "mha") -(WriteTransformParametersEachIteration "false") -(WriteTransformParametersEachResolution "false") -(WriteIterationInfo "false") - diff --git a/Elastix_IMPACT_Jacobian/Prediction.yml b/Elastix_IMPACT_Jacobian/Prediction.yml index 08f8caa9b1018ea99b0577a9621f44cadb6f7388..08fae8f3251e4a849613b7f8de8637dc82a2d8cf 100644 --- a/Elastix_IMPACT_Jacobian/Prediction.yml +++ b/Elastix_IMPACT_Jacobian/Prediction.yml @@ -4,23 +4,23 @@ Predictor: RegistrationNet: engine: elastix parameter_maps: - - Parameters_Rigid.txt - ParameterMap_Jacobian.txt outputs_criterions: None max_iterations: 0 final_grid_spacing: 10.0 + subset_features: 0 spatial_samples: 2000 parameter_overrides: [] - levels: + resolutions: '0': max_iterations: 300 models: '0': ref: VBoussot/impact-torchscript-models:TS/M730.pt voxel_size: - - 3.0 - - 3.0 - - 3.0 + - 6.0 + - 6.0 + - 6.0 layers_mask: '01' layers_weight: - 1.0 @@ -88,7 +88,6 @@ Predictor: pca: 0 distance: L1 mode: Jacobian - mixed_precision: true Dataset: groups_src: Volume_0: @@ -146,8 +145,6 @@ Predictor: overlap: 20% pad_value: None extend_slice: 0 - mode: resample - max_voxels: None subset: None dataset_filenames: - ./Dataset/:mha diff --git a/Elastix_IMPACT_Jacobian/app.json b/Elastix_IMPACT_Jacobian/app.json index 8bf9963990396f3e2717c2a9a1df5001f2e5776b..90ec017af6c2928020de386ed1a61e8b01a99f0a 100644 --- a/Elastix_IMPACT_Jacobian/app.json +++ b/Elastix_IMPACT_Jacobian/app.json @@ -1,7 +1,7 @@ { "display_name": "elastix + IMPACT (Jacobian), TotalSegmentator M730", - "short_description": "A rigid alignment on mutual information, then an elastix B-spline driven by IMPACT on TotalSegmentator M730, early layers, Jacobian mode: the loss is differentiated through the network on a patch sized to the layers' field of view. The pairing that suits CT and CBCT, where texture carries the alignment.", - "description": "A rigid alignment on mutual information, then an elastix B-spline driven by IMPACT on TotalSegmentator M730, early layers, Jacobian mode: the loss is differentiated through the network on a patch sized to the layers' field of view. The pairing that suits CT and CBCT, where texture carries the alignment.", + "short_description": "elastix B-spline driven by IMPACT on TotalSegmentator M730, early layers, Jacobian mode: the loss is differentiated through the network on a patch sized to the layers' field of view. The pairing that suits CT and CBCT, where texture carries the alignment.", + "description": "elastix B-spline driven by IMPACT on TotalSegmentator M730, early layers, Jacobian mode: the loss is differentiated through the network on a patch sized to the layers' field of view. The pairing that suits CT and CBCT, where texture carries the alignment.", "task": "registration", "tta": 0, "mc_dropout": 0, @@ -85,10 +85,5 @@ } } } - }, - "vram_bytes_per_voxel": 350, - "tiling": { - "global": "Prediction.yml" - }, - "ram_bytes_per_voxel": 1150 -} + } +} \ No newline at end of file diff --git a/Elastix_IMPACT_Static/ParameterMap_Static.txt b/Elastix_IMPACT_Static/ParameterMap_Static.txt index 398beda0a6cca07a829a1b4248136e7f963b35ee..bbe04ae2565e3f56bf5e9978fe9896af39506070 100644 --- a/Elastix_IMPACT_Static/ParameterMap_Static.txt +++ b/Elastix_IMPACT_Static/ParameterMap_Static.txt @@ -5,7 +5,6 @@ (FinalGridSpacingInPhysicalUnits 14) (FixedImagePyramid "FixedGenericImagePyramid") (MovingImagePyramid "MovingGenericImagePyramid") -(ComputePyramidImagesPerResolution "true") (FixedImagePyramidRescaleSchedule 1 1 1 1 1 1 1 1 1 1 1 1) (MovingImagePyramidRescaleSchedule 1 1 1 1 1 1 1 1 1 1 1 1) // (GridSpacingSchedule 10.000000 5.000000 2.000000 1.000000) diff --git a/Elastix_IMPACT_Static/Parameters_Rigid.txt b/Elastix_IMPACT_Static/Parameters_Rigid.txt deleted file mode 100644 index cce67f5856961b9d1732d17795d60fa36a0677ba..0000000000000000000000000000000000000000 --- a/Elastix_IMPACT_Static/Parameters_Rigid.txt +++ /dev/null @@ -1,147 +0,0 @@ -// Example parameter file for rotation registration -// C-style comments: // - -// The internal pixel type, used for internal computations -// Leave to float in general. -// NB: this is not the type of the input images! The pixel -// type of the input images is automatically read from the -// images themselves. -// This setting can be changed to "short" to save some memory -// in case of very large 3D images. -(FixedInternalImagePixelType "float") -(MovingInternalImagePixelType "float") - -// **************** Main Components ************************** - -// The following components should usually be left as they are: -(Registration "MultiResolutionRegistration") -(Interpolator "BSplineInterpolator") -(ResampleInterpolator "FinalBSplineInterpolator") -(Resampler "DefaultResampler") - -// These may be changed to Fixed/MovingSmoothingImagePyramid. -// See the manual. -(FixedImagePyramid "FixedRecursiveImagePyramid") -(MovingImagePyramid "MovingRecursiveImagePyramid") - -// The following components are most important: -// The optimizer AdaptiveStochasticGradientDescent (ASGD) works -// quite ok in general. The Transform and Metric are important -// and need to be chosen careful for each application. See manual. -(Optimizer "AdaptiveStochasticGradientDescent") -(Transform "EulerTransform") -(Metric "AdvancedMattesMutualInformation") - -// ***************** Transformation ************************** - -// Scales the rotations compared to the translations, to make -// sure they are in the same range. In general, it's best to -// use automatic scales estimation: -(AutomaticScalesEstimation "true") - -// Automatically guess an initial translation by aligning the -// geometric centers of the fixed and moving. -(AutomaticTransformInitialization "true") - -// Whether transforms are combined by composition or by addition. -// In generally, Compose is the best option in most cases. -// It does not influence the results very much. -(HowToCombineTransforms "Compose") - -//Save composite ITK transform -(ITKTransformOutputFileNameExtension "itk.txt") -(WriteITKCompositeTransform "true") - -// ******************* Similarity measure ********************* - -// Number of grey level bins in each resolution level, -// for the mutual information. 16 or 32 usually works fine. -// You could also employ a hierarchical strategy: -//(NumberOfHistogramBins 16 32 64) -(NumberOfHistogramBins 32) - -// If you use a mask, this option is important. -// If the mask serves as region of interest, set it to false. -// If the mask indicates which pixels are valid, then set it to true. -// If you do not use a mask, the option doesn't matter. -(ErodeMask "false") - -// ******************** Multiresolution ********************** - -// The number of resolutions. 1 Is only enough if the expected -// deformations are small. 3 or 4 mostly works fine. For large -// images and large deformations, 5 or 6 may even be useful. -(NumberOfResolutions 4) - -// The downsampling/blurring factors for the image pyramids. -// By default, the images are downsampled by a factor of 2 -// compared to the next resolution. -// So, in 2D, with 4 resolutions, the following schedule is used: -//(ImagePyramidSchedule 8 8 4 4 2 2 1 1 ) -// And in 3D: -//(ImagePyramidSchedule 8 8 8 4 4 4 2 2 2 1 1 1 ) -// You can specify any schedule, for example: -//(ImagePyramidSchedule 4 4 4 3 2 1 1 1 ) -// Make sure that the number of elements equals the number -// of resolutions times the image dimension. - -// ******************* Optimizer **************************** - -// Maximum number of iterations in each resolution level: -// 200-500 works usually fine for rigid registration. -// For more robustness, you may increase this to 1000-2000. -(MaximumNumberOfIterations 250) - -// The step size of the optimizer, in mm. By default the voxel size is used. -// which usually works well. In case of unusual high-resolution images -// (eg histology) it is necessary to increase this value a bit, to the size -// of the "smallest visible structure" in the image: -//(MaximumStepLength 1.0) - -// **************** Image sampling ********************** - -// Number of spatial samples used to compute the mutual -// information (and its derivative) in each iteration. -// With an AdaptiveStochasticGradientDescent optimizer, -// in combination with the two options below, around 2000 -// samples may already suffice. -(NumberOfSpatialSamples 2048) - -// Refresh these spatial samples in every iteration, and select -// them randomly. See the manual for information on other sampling -// strategies. -(NewSamplesEveryIteration "true") -(ImageSampler "Random") - -// ************* Interpolation and Resampling **************** - -// Order of B-Spline interpolation used during registration/optimisation. -// It may improve accuracy if you set this to 3. Never use 0. -// An order of 1 gives linear interpolation. This is in most -// applications a good choice. -(BSplineInterpolationOrder 1) - -// Order of B-Spline interpolation used for applying the final -// deformation. -// 3 gives good accuracy; recommended in most cases. -// 1 gives worse accuracy (linear interpolation) -// 0 gives worst accuracy, but is appropriate for binary images -// (masks, segmentations); equivalent to nearest neighbor interpolation. -(FinalBSplineInterpolationOrder 3) - -//Default pixel value for pixels that come from outside the picture: -(DefaultPixelValue 0) - -// Choose whether to generate the deformed moving image. -// You can save some time by setting this to false, if you are -// only interested in the final (nonrigidly) deformed moving image -// for example. -(WriteResultImage "false") - -// The pixel type and format of the resulting deformed moving image -(ResultImagePixelType "short") -(ResultImageFormat "mha") -(WriteTransformParametersEachIteration "false") -(WriteTransformParametersEachResolution "false") -(WriteIterationInfo "false") - diff --git a/Elastix_IMPACT_Static/Prediction.yml b/Elastix_IMPACT_Static/Prediction.yml index 25ecb26c2118702767c896d56194580c9542d910..31541b09b9a32a5f8b72cce786d4209a4eccdaef 100644 --- a/Elastix_IMPACT_Static/Prediction.yml +++ b/Elastix_IMPACT_Static/Prediction.yml @@ -4,14 +4,14 @@ Predictor: RegistrationNet: engine: elastix parameter_maps: - - Parameters_Rigid.txt - ParameterMap_Static.txt outputs_criterions: None max_iterations: 0 - final_grid_spacing: 20.0 + final_grid_spacing: 14.0 + subset_features: 0 spatial_samples: 2000 parameter_overrides: [] - levels: + resolutions: '0': max_iterations: 400 models: @@ -30,9 +30,9 @@ Predictor: '1': ref: VBoussot/impact-torchscript-models:TS/M730.pt voxel_size: - - 3.0 - - 3.0 - - 3.0 + - 6.0 + - 6.0 + - 6.0 layers_mask: '0000001' layers_weight: - 0.8 @@ -87,7 +87,7 @@ Predictor: - 2.0 - 2.0 - 2.0 - layers_mask: '00000001' + layers_mask: '0000001' layers_weight: - 0.4 subset_features: 64 @@ -114,14 +114,13 @@ Predictor: - 2.0 - 2.0 - 2.0 - layers_mask: '00000001' + layers_mask: '0000001' layers_weight: - 0.3 subset_features: 64 pca: 0 distance: Dice mode: Static - mixed_precision: true Dataset: groups_src: Volume_0: @@ -179,8 +178,6 @@ Predictor: overlap: 20% pad_value: None extend_slice: 0 - mode: resample - max_voxels: None subset: None dataset_filenames: - ./Dataset/:mha diff --git a/Elastix_IMPACT_Static/app.json b/Elastix_IMPACT_Static/app.json index 23a4a84e0cae03b3396b63fdb787836dd2904cb0..2add2c57409fd817a94ee881af870fc849c40be1 100644 --- a/Elastix_IMPACT_Static/app.json +++ b/Elastix_IMPACT_Static/app.json @@ -1,7 +1,7 @@ { "display_name": "elastix + IMPACT (Static), TotalSegmentator M730", - "short_description": "A rigid alignment on mutual information, then an elastix B-spline driven by IMPACT on TotalSegmentator M730 (its last decoder layer at the two coarse levels, its segmentation head at the two fine ones) and MIND, Static mode: the features are extracted once on the whole image. The pairing that suits MR and CT, where the contours and the segmentation-level features carry the alignment across modalities.", - "description": "A rigid alignment on mutual information, then an elastix B-spline driven by IMPACT on TotalSegmentator M730 (its last decoder layer at the two coarse levels, its segmentation head at the two fine ones) and MIND, Static mode: the features are extracted once on the whole image. The pairing that suits MR and CT, where the contours and the segmentation-level features carry the alignment across modalities.", + "short_description": "elastix B-spline driven by IMPACT on TotalSegmentator M730, last layer, Static mode: the features are extracted once on the whole image. The pairing that suits MR and CT, where the contours and the segmentation-level features carry the alignment across modalities.", + "description": "elastix B-spline driven by IMPACT on TotalSegmentator M730, last layer, Static mode: the features are extracted once on the whole image. The pairing that suits MR and CT, where the contours and the segmentation-level features carry the alignment across modalities.", "task": "registration", "tta": 0, "mc_dropout": 0, @@ -85,10 +85,5 @@ } } } - }, - "vram_bytes_per_voxel": 150, - "tiling": { - "global": "Prediction.yml" - }, - "ram_bytes_per_voxel": 950 -} + } +} \ No newline at end of file diff --git a/FireANTs_Anatomix/Prediction.yml b/FireANTs_Anatomix/Prediction.yml index 4fcbf479bbd7bfc13c50cc0e898f8d9653da5508..1014dc1193bdfffa8bc59703e8e7827480250cd1 100644 --- a/FireANTs_Anatomix/Prediction.yml +++ b/FireANTs_Anatomix/Prediction.yml @@ -19,37 +19,35 @@ Predictor: - 100 cc_kernel: 5 affine_metric: mi - affine_lr: 0.03 + affine_lr: 0.003 deformable_method: syn deformable_metric: impact - deformable_lr: 0.5 + deformable_lr: 1.0 integrator_n: 10 - smooth_warp_sigma: 1.0 + smooth_warp_sigma: 0.5 smooth_grad_sigma: 1.0 seed: 42 models: '0': ref: VBoussot/impact-torchscript-models:Anatomix/Anatomix.pt layers_mask: '1' - layers_weight: - - 1.0 + layers_weight: 1.0 pca: 8 - distance: LNCC - feature_normalization: l2 + distance: L2 '1': ref: VBoussot/impact-torchscript-models:MIND/R1D2_3D.pt layers_mask: '1' - layers_weight: - - 1.0 + layers_weight: 1.0 pca: 6 - distance: LNCC - feature_normalization: l2 + distance: L1 outputs_criterions: None mode: Static feature_patch: 0 feature_chunk: 0 feature_overlap: 0.25 - lncc_kernel: 5 + feature_multiple: 16 + feature_normalization: l2 + feature_metric: cc Dataset: groups_src: Volume_0: @@ -107,8 +105,6 @@ Predictor: overlap: 20% pad_value: None extend_slice: 0 - mode: resample - max_voxels: None subset: None dataset_filenames: - ./Dataset/:mha diff --git a/FireANTs_Anatomix/Prediction_tile.yml b/FireANTs_Anatomix/Prediction_tile.yml deleted file mode 100644 index 98b9586e79e4e2fc82f08716b73f78cc333eaa8b..0000000000000000000000000000000000000000 --- a/FireANTs_Anatomix/Prediction_tile.yml +++ /dev/null @@ -1,142 +0,0 @@ -Predictor: - Model: - classpath: impact_reg_konfai.models.fireants:RegistrationNet - RegistrationNet: - scales: - - 6 - - 4 - - 2 - - 1 - affine_iterations: - - 100 - - 100 - - 100 - - 100 - deformable_iterations: - - 100 - - 100 - - 100 - - 100 - cc_kernel: 5 - affine_metric: mi - affine_lr: 0.03 - deformable_method: syn - deformable_metric: impact - deformable_lr: 0.5 - integrator_n: 10 - smooth_warp_sigma: 1.0 - smooth_grad_sigma: 1.0 - seed: 42 - models: - '0': - ref: VBoussot/impact-torchscript-models:Anatomix/Anatomix.pt - layers_mask: '1' - layers_weight: - - 1.0 - pca: 8 - distance: LNCC - feature_normalization: l2 - '1': - ref: VBoussot/impact-torchscript-models:MIND/R1D2_3D.pt - layers_mask: '1' - layers_weight: - - 1.0 - pca: 6 - distance: LNCC - feature_normalization: l2 - outputs_criterions: None - mode: Static - feature_patch: 0 - feature_chunk: 0 - feature_overlap: 0.25 - linear_method: none - lncc_kernel: 5 - Dataset: - groups_src: - Volume_0: - groups_dest: - Fixed: - transforms: - TensorCast: - dtype: float32 - inverse: false - patch_transforms: None - is_input: true - Volume_1: - groups_dest: - Moving: - transforms: - TensorCast: - dtype: float32 - inverse: false - patch_transforms: None - is_input: true - Volume_2: - groups_dest: - FixedMask: - transforms: - TensorCast: - dtype: float32 - inverse: false - patch_transforms: None - is_input: true - Volume_3: - groups_dest: - MovingMask: - transforms: - TensorCast: - dtype: float32 - inverse: false - patch_transforms: None - is_input: true - augmentations: - DataAugmentation_0: - data_augmentations: - Flip: - f_prob: - - 0 - - 0.5 - - 0.5 - vector_field: true - prob: 1 - nb: 2 - Patch: - patch_size: - - 0 - - 0 - - 0 - overlap: 20% - pad_value: None - extend_slice: 0 - mode: tile - max_voxels: None - subset: None - dataset_filenames: - - ./Dataset/:mha - batch_size: 1 - num_workers: None - pin_memory: false - prefetch_factor: None - persistent_workers: None - outputs_dataset: - DisplacementField: - OutputDataset: - name_class: OutputDataset - before_reduction_transforms: None - after_reduction_transforms: None - final_transforms: - TensorCast: - dtype: float32 - inverse: false - dataset_filename: Transform:itktransform - group: Transform - same_as_group: Volume_0:Fixed - patch_combine: Cosinus - reduction: Mean - Mean: {} - train_name: ImpactReg-FireANTs-Anatomix - manual_seed: 42 - gpu_checkpoints: None - combine: Mean - autocast: false - data_log: None diff --git a/FireANTs_Anatomix/app.json b/FireANTs_Anatomix/app.json index ea50d193b3d58408a8c70b48a426fa5a784a955e..fa8249361cd4ecc04af4b2968de9482f9bbabb1d 100644 --- a/FireANTs_Anatomix/app.json +++ b/FireANTs_Anatomix/app.json @@ -85,16 +85,5 @@ } } } - }, - "vram_bytes_per_voxel": 1950, - "tiling": { - "global": "Prediction.yml", - "tile": "Prediction_tile.yml", - "tile_vram_bytes_per_voxel": 1950, - "tile_ram_bytes_per_voxel": 1400 - }, - "requirements_no_deps": [ - "fireants>=1.5,<1.6" - ], - "ram_bytes_per_voxel": 1500 -} + } +} \ No newline at end of file diff --git a/FireANTs_Anatomix/requirements.txt b/FireANTs_Anatomix/requirements.txt index cb6865d5e19cafdd0f4e30810680d63af6a429fc..328648f8f84a7fc973b5c29be70680b4862223cf 100644 --- a/FireANTs_Anatomix/requirements.txt +++ b/FireANTs_Anatomix/requirements.txt @@ -1,8 +1,4 @@ hydra-core nibabel pandas -scipy impact_reg_konfai>=1.7.0 -matplotlib -scikit-image -tqdm diff --git a/FireANTs_IMPACT/Prediction.yml b/FireANTs_IMPACT/Prediction.yml index 7b9bfd4b7d232fdaa89f36f98e27a2cb9ea80eb7..e55c2b75b78d3d0039135043c4f7b4c83146480e 100644 --- a/FireANTs_IMPACT/Prediction.yml +++ b/FireANTs_IMPACT/Prediction.yml @@ -16,7 +16,7 @@ Predictor: - 50 cc_kernel: 5 affine_metric: mi - affine_lr: 0.03 + affine_lr: 0.003 deformable_method: syn deformable_metric: impact deformable_lr: 0.25 @@ -28,12 +28,9 @@ Predictor: '0': ref: VBoussot/impact-torchscript-models:TS/M291.pt layers_mask: '01' - layers_weight: - - 1.0 + layers_weight: 1.0 pca: 0 distance: L1 - feature_normalization: none - mode: Jacobian outputs_criterions: None Dataset: groups_src: @@ -85,15 +82,10 @@ Predictor: prob: 1 nb: 2 Patch: - patch_size: - - 0 - - 0 - - 0 + patch_size: [0, 0, 0] overlap: 20% pad_value: None extend_slice: 0 - mode: resample - max_voxels: None subset: None dataset_filenames: - ./Dataset/:mha diff --git a/FireANTs_IMPACT/Prediction_tile.yml b/FireANTs_IMPACT/Prediction_tile.yml deleted file mode 100644 index 19f848ce75d621f61ac826a87de4072d78fbe24e..0000000000000000000000000000000000000000 --- a/FireANTs_IMPACT/Prediction_tile.yml +++ /dev/null @@ -1,127 +0,0 @@ -Predictor: - Model: - classpath: impact_reg_konfai.models.fireants:RegistrationNet - RegistrationNet: - scales: - - 4 - - 2 - - 1 - affine_iterations: - - 200 - - 100 - - 50 - deformable_iterations: - - 200 - - 100 - - 50 - cc_kernel: 5 - affine_metric: mi - affine_lr: 0.03 - deformable_method: syn - deformable_metric: impact - deformable_lr: 0.25 - integrator_n: 10 - smooth_warp_sigma: 0.5 - smooth_grad_sigma: 1.0 - seed: 42 - models: - '0': - ref: VBoussot/impact-torchscript-models:TS/M291.pt - layers_mask: '01' - layers_weight: - - 1.0 - pca: 0 - distance: L1 - feature_normalization: none - mode: Jacobian - outputs_criterions: None - linear_method: none - Dataset: - groups_src: - Volume_0: - groups_dest: - Fixed: - transforms: - TensorCast: - dtype: float32 - inverse: false - patch_transforms: None - is_input: true - Volume_1: - groups_dest: - Moving: - transforms: - TensorCast: - dtype: float32 - inverse: false - patch_transforms: None - is_input: true - Volume_2: - groups_dest: - FixedMask: - transforms: - TensorCast: - dtype: float32 - inverse: false - patch_transforms: None - is_input: true - Volume_3: - groups_dest: - MovingMask: - transforms: - TensorCast: - dtype: float32 - inverse: false - patch_transforms: None - is_input: true - augmentations: - DataAugmentation_0: - data_augmentations: - Flip: - f_prob: - - 0 - - 0.5 - - 0.5 - vector_field: true - prob: 1 - nb: 2 - Patch: - patch_size: - - 0 - - 0 - - 0 - overlap: 20% - pad_value: None - extend_slice: 0 - mode: tile - max_voxels: None - subset: None - dataset_filenames: - - ./Dataset/:mha - batch_size: 1 - num_workers: None - pin_memory: false - prefetch_factor: None - persistent_workers: None - outputs_dataset: - DisplacementField: - OutputDataset: - name_class: OutputDataset - before_reduction_transforms: None - after_reduction_transforms: None - final_transforms: - TensorCast: - dtype: float32 - inverse: false - dataset_filename: Transform:itktransform - group: Transform - same_as_group: Volume_0:Fixed - patch_combine: Cosinus - reduction: Mean - Mean: {} - train_name: ImpactReg-FireANTs-IMPACT - manual_seed: 42 - gpu_checkpoints: None - combine: Mean - autocast: false - data_log: None diff --git a/FireANTs_IMPACT/app.json b/FireANTs_IMPACT/app.json index c24da6a8f4bf2ec2d9cb978495afebbdad770479..6ba67ca6cdb89334a5a5385ed5276439793064b6 100644 --- a/FireANTs_IMPACT/app.json +++ b/FireANTs_IMPACT/app.json @@ -1,7 +1,7 @@ { "display_name": "FireANTs (IMPACT)", "short_description": "Rigid + Affine + SyN driven by the IMPACT deep-feature metric on GPU (FireANTs).", - "description": "GPU deformable registration with FireANTs where the SyN stage is driven by the KonfAI IMPACT metric — deep features from one or more pretrained TorchScript models — instead of an intensity metric. A Rigid (MI) + Affine (MI) linear pre-align seeds a symmetric diffeomorphic SyN optimised with Riemannian Adam against a weighted multi-model feature distance. Produces the displacement field on the fixed grid, from which impact-reg-konfai derives the moved image. FireANTs is an external dependency under the FireANTs License v1.0 (see NOTICE); the feature models are fetched from VBoussot/impact-torchscript-models.", + "description": "GPU deformable registration with FireANTs where the SyN stage is driven by the KonfAI IMPACT metric \u2014 deep features from one or more pretrained TorchScript models \u2014 instead of an intensity metric. A Rigid (MI) + Affine (MI) linear pre-align seeds a symmetric diffeomorphic SyN optimised with Riemannian Adam against a weighted multi-model feature distance. Produces the moved image and the total displacement field on the fixed grid. FireANTs is an external dependency under the FireANTs License v1.0 (see NOTICE); the feature models are fetched from VBoussot/impact-torchscript-models.", "task": "registration", "tta": 0, "mc_dropout": 0, @@ -85,16 +85,5 @@ } } } - }, - "vram_bytes_per_voxel": 1150, - "tiling": { - "global": "Prediction.yml", - "tile": "Prediction_tile.yml", - "tile_vram_bytes_per_voxel": 1150, - "tile_ram_bytes_per_voxel": 3050 - }, - "requirements_no_deps": [ - "fireants>=1.5,<1.6" - ], - "ram_bytes_per_voxel": 3150 + } } diff --git a/FireANTs_IMPACT/requirements.txt b/FireANTs_IMPACT/requirements.txt index cb6865d5e19cafdd0f4e30810680d63af6a429fc..328648f8f84a7fc973b5c29be70680b4862223cf 100644 --- a/FireANTs_IMPACT/requirements.txt +++ b/FireANTs_IMPACT/requirements.txt @@ -1,8 +1,4 @@ hydra-core nibabel pandas -scipy impact_reg_konfai>=1.7.0 -matplotlib -scikit-image -tqdm diff --git a/FireANTs_IMPACT_MRCT/Evaluation_with_fid.yml b/FireANTs_IMPACT_MRCT/Evaluation_with_fid.yml deleted file mode 100644 index 267c860058b1bcbbfe85cc6ae314289089b9ed23..0000000000000000000000000000000000000000 --- a/FireANTs_IMPACT_MRCT/Evaluation_with_fid.yml +++ /dev/null @@ -1,22 +0,0 @@ -Evaluator: - metrics: - FixedFid: - targets_criterions: - MovingFid: - criterions_loader: - TRE: {} - Dataset: - groups_src: - Volume_0: - groups_dest: - FixedFid: - transforms: None - Reference_0: - groups_dest: - MovingFid: - transforms: None - subset: None - dataset_filenames: - - ./Dataset:mha - validation: None - train_name: ImpactReg diff --git a/FireANTs_IMPACT_MRCT/Evaluation_with_images.yml b/FireANTs_IMPACT_MRCT/Evaluation_with_images.yml deleted file mode 100644 index ce145cfb0b192646149642d91f15e53da8a5bfe6..0000000000000000000000000000000000000000 --- a/FireANTs_IMPACT_MRCT/Evaluation_with_images.yml +++ /dev/null @@ -1,35 +0,0 @@ -Evaluator: - metrics: - FixedImage: - targets_criterions: - MovingImage;Mask: - criterions_loader: - MAESaveMap: - reduction: mean - dataset: ./Evaluations/ImpactReg/Output:mha - group: MAE_map - Dataset: - groups_src: - Volume_0: - groups_dest: - FixedImage: - transforms: - TensorCast: - dtype: float32 - Reference_0: - groups_dest: - MovingImage: - transforms: - TensorCast: - dtype: float32 - Mask_0: - groups_dest: - Mask: - transforms: - TensorCast: - dtype: uint8 - subset: None - dataset_filenames: - - ./Dataset:mha - validation: None - train_name: ImpactReg diff --git a/FireANTs_IMPACT_MRCT/Evaluation_with_seg.yml b/FireANTs_IMPACT_MRCT/Evaluation_with_seg.yml deleted file mode 100644 index 6221238dd64ccead3148eb85730feb73df4d8fde..0000000000000000000000000000000000000000 --- a/FireANTs_IMPACT_MRCT/Evaluation_with_seg.yml +++ /dev/null @@ -1,29 +0,0 @@ -Evaluator: - metrics: - FixedSeg: - targets_criterions: - MovingSeg: - criterions_loader: - DiceSaveMap: - labels: None - dataset: ./Evaluations/ImpactReg/Output:mha - group: Seg_MAE_map - Dataset: - groups_src: - Volume_0: - groups_dest: - FixedSeg: - transforms: - TensorCast: - dtype: uint8 - Reference_0: - groups_dest: - MovingSeg: - transforms: - TensorCast: - dtype: uint8 - subset: None - dataset_filenames: - - ./Dataset:mha - validation: None - train_name: ImpactReg diff --git a/FireANTs_IMPACT_MRCT/NOTICE b/FireANTs_IMPACT_MRCT/NOTICE deleted file mode 100644 index 43a25db7c8d0e298e69ef5f49ae556b74dcd5db8..0000000000000000000000000000000000000000 --- a/FireANTs_IMPACT_MRCT/NOTICE +++ /dev/null @@ -1,40 +0,0 @@ -FireANTs_SyN — third-party attribution -====================================== - -This KonfAI app drives FireANTs, an external registration library. FireANTs is NOT -redistributed here as source: the app depends on the official `fireants` wheel -(https://pypi.org/project/fireants/), which is installed at resolve time (see -requirements.txt) and called through its public Python API only. No FireANTs source -code (functions, classes, or modules) is copied into this app. - -FireANTs is distributed under the **FireANTs License, Version 1.0 (July 2025)**, a -custom license modified from Apache 2.0. Its redistribution clause requires that, when -FireANTs is incorporated as a dependency in other projects, all license terms — -including attribution and the bibliography below — be maintained. - - Project : FireANTs - Source : https://github.com/rohitrango/FireANTs - License : https://github.com/rohitrango/FireANTs/blob/main/LICENSE - Copyright (c) 2026 Rohit Jena. All rights reserved. - -Bibliography (as required by the FireANTs License — cite if you use this app) ----------------------------------------------------------------------------- - - @article{jena2024fireants, - title={FireANTs: Adaptive Riemannian Optimization for Multi-Scale Diffeomorphic Registration}, - author={Jena, Rohit and Chaudhari, Pratik and Gee, James C}, - journal={Nature Communications}, - year={2024} - } - - @inproceedings{jena2025scalable, - title={A Scalable Distributed Framework for Multimodal {GigaVoxel} Image Registration}, - author={Jena, Rohit and Zope, Vedant and Chaudhari, Pratik and Gee, James C}, - booktitle={The Fourteenth International Conference on Learning Representations}, - year={2026}, - url={https://openreview.net/forum?id=8dLexnao2h} - } - -The wrapper code in this directory (Model.py, the KonfAI app configuration) is original -work © 2025 Valentin Boussot, licensed under Apache-2.0, and is a separate work that -merely links to the FireANTs interfaces. diff --git a/FireANTs_IMPACT_MRCT/Prediction.yml b/FireANTs_IMPACT_MRCT/Prediction.yml deleted file mode 100644 index 074491b52bfcd887f3e6f1339e7269cd9299102e..0000000000000000000000000000000000000000 --- a/FireANTs_IMPACT_MRCT/Prediction.yml +++ /dev/null @@ -1,138 +0,0 @@ -Predictor: - Model: - classpath: impact_reg_konfai.models.fireants:RegistrationNet - RegistrationNet: - scales: - - 4 - - 2 - - 1 - affine_iterations: - - 200 - - 100 - - 50 - deformable_iterations: - - 200 - - 100 - - 50 - cc_kernel: 5 - affine_metric: mi - affine_lr: 0.03 - deformable_method: syn - deformable_metric: impact - deformable_lr: 0.25 - integrator_n: 10 - smooth_warp_sigma: 0.5 - smooth_grad_sigma: 1.0 - seed: 42 - outputs_criterions: None - models: - '0': - ref: VBoussot/impact-torchscript-models:TS/M730.pt - layers_mask: '0000001' - layers_weight: - - 1.0 - pca: 8 - distance: LNCC - feature_normalization: l2 - '1': - ref: VBoussot/impact-torchscript-models:MIND/R1D2_3D.pt - layers_mask: '1' - layers_weight: - - 1.0 - pca: 6 - distance: LNCC - feature_normalization: l2 - mode: Static - feature_patch: 0 - feature_chunk: 0 - feature_overlap: 0.25 - lncc_kernel: 5 - Dataset: - groups_src: - Volume_0: - groups_dest: - Fixed: - transforms: - TensorCast: - dtype: float32 - inverse: false - patch_transforms: None - is_input: true - Volume_1: - groups_dest: - Moving: - transforms: - TensorCast: - dtype: float32 - inverse: false - patch_transforms: None - is_input: true - Volume_2: - groups_dest: - FixedMask: - transforms: - TensorCast: - dtype: float32 - inverse: false - patch_transforms: None - is_input: true - Volume_3: - groups_dest: - MovingMask: - transforms: - TensorCast: - dtype: float32 - inverse: false - patch_transforms: None - is_input: true - augmentations: - DataAugmentation_0: - data_augmentations: - Flip: - f_prob: - - 0 - - 0.5 - - 0.5 - vector_field: true - prob: 1 - nb: 2 - Patch: - patch_size: - - 0 - - 0 - - 0 - overlap: 20% - pad_value: None - extend_slice: 0 - mode: resample - max_voxels: None - subset: None - dataset_filenames: - - ./Dataset/:mha - batch_size: 1 - num_workers: None - pin_memory: false - prefetch_factor: None - persistent_workers: None - outputs_dataset: - DisplacementField: - OutputDataset: - name_class: OutputDataset - before_reduction_transforms: None - after_reduction_transforms: None - final_transforms: - TensorCast: - dtype: float32 - inverse: false - dataset_filename: Transform:itktransform - group: Transform - same_as_group: Volume_0:Fixed - patch_combine: Cosinus - reduction: Mean - Mean: {} - train_name: ImpactReg-FireANTs-IMPACT-MRCT - manual_seed: 42 - gpu_checkpoints: None - combine: Mean - autocast: false - data_log: None diff --git a/FireANTs_IMPACT_MRCT/Prediction_tile.yml b/FireANTs_IMPACT_MRCT/Prediction_tile.yml deleted file mode 100644 index 68a55b4a972c8ff333690a57ceab90b7261727f8..0000000000000000000000000000000000000000 --- a/FireANTs_IMPACT_MRCT/Prediction_tile.yml +++ /dev/null @@ -1,139 +0,0 @@ -Predictor: - Model: - classpath: impact_reg_konfai.models.fireants:RegistrationNet - RegistrationNet: - scales: - - 4 - - 2 - - 1 - affine_iterations: - - 200 - - 100 - - 50 - deformable_iterations: - - 200 - - 100 - - 50 - cc_kernel: 5 - affine_metric: mi - affine_lr: 0.03 - deformable_method: syn - deformable_metric: impact - deformable_lr: 0.25 - integrator_n: 10 - smooth_warp_sigma: 0.5 - smooth_grad_sigma: 1.0 - seed: 42 - outputs_criterions: None - linear_method: none - models: - '0': - ref: VBoussot/impact-torchscript-models:TS/M730.pt - layers_mask: '0000001' - layers_weight: - - 1.0 - pca: 8 - distance: LNCC - feature_normalization: l2 - '1': - ref: VBoussot/impact-torchscript-models:MIND/R1D2_3D.pt - layers_mask: '1' - layers_weight: - - 1.0 - pca: 6 - distance: LNCC - feature_normalization: l2 - mode: Static - feature_patch: 0 - feature_chunk: 0 - feature_overlap: 0.25 - lncc_kernel: 5 - Dataset: - groups_src: - Volume_0: - groups_dest: - Fixed: - transforms: - TensorCast: - dtype: float32 - inverse: false - patch_transforms: None - is_input: true - Volume_1: - groups_dest: - Moving: - transforms: - TensorCast: - dtype: float32 - inverse: false - patch_transforms: None - is_input: true - Volume_2: - groups_dest: - FixedMask: - transforms: - TensorCast: - dtype: float32 - inverse: false - patch_transforms: None - is_input: true - Volume_3: - groups_dest: - MovingMask: - transforms: - TensorCast: - dtype: float32 - inverse: false - patch_transforms: None - is_input: true - augmentations: - DataAugmentation_0: - data_augmentations: - Flip: - f_prob: - - 0 - - 0.5 - - 0.5 - vector_field: true - prob: 1 - nb: 2 - Patch: - patch_size: - - 0 - - 0 - - 0 - overlap: 20% - pad_value: None - extend_slice: 0 - mode: tile - max_voxels: None - subset: None - dataset_filenames: - - ./Dataset/:mha - batch_size: 1 - num_workers: None - pin_memory: false - prefetch_factor: None - persistent_workers: None - outputs_dataset: - DisplacementField: - OutputDataset: - name_class: OutputDataset - before_reduction_transforms: None - after_reduction_transforms: None - final_transforms: - TensorCast: - dtype: float32 - inverse: false - dataset_filename: Transform:itktransform - group: Transform - same_as_group: Volume_0:Fixed - patch_combine: Cosinus - reduction: Mean - Mean: {} - train_name: ImpactReg-FireANTs-IMPACT-MRCT - manual_seed: 42 - gpu_checkpoints: None - combine: Mean - autocast: false - data_log: None diff --git a/FireANTs_IMPACT_MRCT/Uncertainty.yml b/FireANTs_IMPACT_MRCT/Uncertainty.yml deleted file mode 100644 index 9507d1b0c994741a002aa0d44c24b55847e61ce0..0000000000000000000000000000000000000000 --- a/FireANTs_IMPACT_MRCT/Uncertainty.yml +++ /dev/null @@ -1,24 +0,0 @@ -Evaluator: - metrics: - Uncertainty: - targets_criterions: - None: - criterions_loader: - Mean: - name: Uncertainty - Dataset: - groups_src: - Volume_0: - groups_dest: - Uncertainty: - transforms: - Norm: {} - StandardDeviation: {} - Save: - dataset: ./Uncertainties/ImpactReg/Output:mha - group: None - subset: None - dataset_filenames: - - ./Dataset:mha - validation: None - train_name: ImpactReg diff --git a/FireANTs_IMPACT_MRCT/app.json b/FireANTs_IMPACT_MRCT/app.json deleted file mode 100644 index c16c1f43b1ef639a83558a540247b45e13e81ce6..0000000000000000000000000000000000000000 --- a/FireANTs_IMPACT_MRCT/app.json +++ /dev/null @@ -1,100 +0,0 @@ -{ - "display_name": "FireANTs SyN, TotalSegmentator MR decoder + MIND", - "short_description": "FireANTs_SyN with IMPACT on the last decoder layer of TotalSegmentator MR (TS/M730) and MIND, extracted once per image (Static), in place of the cross-correlation, for MR/CT.", - "description": "FireANTs_SyN with IMPACT on the last decoder layer of TotalSegmentator MR (TS/M730) and MIND, extracted once per image (Static), in place of the cross-correlation, for MR/CT. Everything else is FireANTs_SyN's: the rigid and affine stages on mutual information and SyN's schedule (4x2x1, 200/100/50 iterations).", - "task": "registration", - "tta": 0, - "mc_dropout": 0, - "models": [], - "inputs": { - "Fixed": { - "display_name": "Fixed image", - "volume_type": "VOLUME", - "required": true - }, - "Moving": { - "display_name": "Moving image", - "volume_type": "VOLUME", - "required": true - }, - "FixedMask": { - "display_name": "Fixed mask (optional)", - "volume_type": "SEGMENTATION", - "required": false, - "default": "ones" - }, - "MovingMask": { - "display_name": "Moving mask (optional)", - "volume_type": "SEGMENTATION", - "required": false, - "default": "ones" - } - }, - "outputs": { - "DisplacementField": { - "display_name": "Displacement field", - "volume_type": "VOLUME", - "required": true - } - }, - "inputs_evaluations": { - "Image": { - "Evaluation_with_images.yml": { - "FixedImage": { - "display_name": "Fixed image", - "volume_type": "VOLUME", - "required": true - }, - "MovingImage": { - "display_name": "Moving image", - "volume_type": "VOLUME", - "required": true - }, - "Mask": { - "display_name": "Evaluation mask", - "volume_type": "SEGMENTATION", - "required": false - } - } - }, - "Segmentation": { - "Evaluation_with_seg.yml": { - "FixedSeg": { - "display_name": "Fixed segmentation", - "volume_type": "SEGMENTATION", - "required": true - }, - "MovingSeg": { - "display_name": "Moving segmentation", - "volume_type": "SEGMENTATION", - "required": true - } - } - }, - "Landmarks": { - "Evaluation_with_fid.yml": { - "FixedFid": { - "display_name": "Fixed landmarks", - "volume_type": "FIDUCIALS", - "required": true - }, - "MovingFid": { - "display_name": "Moving landmarks", - "volume_type": "FIDUCIALS", - "required": true - } - } - } - }, - "vram_bytes_per_voxel": 1950, - "tiling": { - "global": "Prediction.yml", - "tile": "Prediction_tile.yml", - "tile_vram_bytes_per_voxel": 1950, - "tile_ram_bytes_per_voxel": 1600 - }, - "requirements_no_deps": [ - "fireants>=1.5,<1.6" - ], - "ram_bytes_per_voxel": 1700 -} diff --git a/FireANTs_IMPACT_MRCT/icon.png b/FireANTs_IMPACT_MRCT/icon.png deleted file mode 100644 index b9ab504f1c50c094fec0eb7d9d571302ae631ff9..0000000000000000000000000000000000000000 Binary files a/FireANTs_IMPACT_MRCT/icon.png and /dev/null differ diff --git a/FireANTs_IMPACT_MRCT/requirements.txt b/FireANTs_IMPACT_MRCT/requirements.txt deleted file mode 100644 index cb6865d5e19cafdd0f4e30810680d63af6a429fc..0000000000000000000000000000000000000000 --- a/FireANTs_IMPACT_MRCT/requirements.txt +++ /dev/null @@ -1,8 +0,0 @@ -hydra-core -nibabel -pandas -scipy -impact_reg_konfai>=1.7.0 -matplotlib -scikit-image -tqdm diff --git a/FireANTs_SyN/Prediction.yml b/FireANTs_SyN/Prediction.yml index 98ef6c2c8803ddf41bf830bde8323752faf2a263..0e7b2117de6aaacfdefd3f5897fef14c05cb2838 100644 --- a/FireANTs_SyN/Prediction.yml +++ b/FireANTs_SyN/Prediction.yml @@ -16,7 +16,7 @@ Predictor: - 50 cc_kernel: 5 affine_metric: mi - affine_lr: 0.03 + affine_lr: 0.003 deformable_method: syn deformable_metric: cc deformable_lr: 0.25 @@ -75,15 +75,10 @@ Predictor: prob: 1 nb: 2 Patch: - patch_size: - - 0 - - 0 - - 0 + patch_size: [0, 0, 0] overlap: 20% pad_value: None extend_slice: 0 - mode: resample - max_voxels: None subset: None dataset_filenames: - ./Dataset/:mha diff --git a/FireANTs_SyN/Prediction_tile.yml b/FireANTs_SyN/Prediction_tile.yml deleted file mode 100644 index 074f2b17c27b56bb1ba3d6598087154ad25ee60e..0000000000000000000000000000000000000000 --- a/FireANTs_SyN/Prediction_tile.yml +++ /dev/null @@ -1,117 +0,0 @@ -Predictor: - Model: - classpath: impact_reg_konfai.models.fireants:RegistrationNet - RegistrationNet: - scales: - - 4 - - 2 - - 1 - affine_iterations: - - 200 - - 100 - - 50 - deformable_iterations: - - 200 - - 100 - - 50 - cc_kernel: 5 - affine_metric: mi - affine_lr: 0.03 - deformable_method: syn - deformable_metric: cc - deformable_lr: 0.25 - integrator_n: 10 - smooth_warp_sigma: 0.5 - smooth_grad_sigma: 1.0 - seed: 42 - outputs_criterions: None - linear_method: none - Dataset: - groups_src: - Volume_0: - groups_dest: - Fixed: - transforms: - TensorCast: - dtype: float32 - inverse: false - patch_transforms: None - is_input: true - Volume_1: - groups_dest: - Moving: - transforms: - TensorCast: - dtype: float32 - inverse: false - patch_transforms: None - is_input: true - Volume_2: - groups_dest: - FixedMask: - transforms: - TensorCast: - dtype: float32 - inverse: false - patch_transforms: None - is_input: true - Volume_3: - groups_dest: - MovingMask: - transforms: - TensorCast: - dtype: float32 - inverse: false - patch_transforms: None - is_input: true - augmentations: - DataAugmentation_0: - data_augmentations: - Flip: - f_prob: - - 0 - - 0.5 - - 0.5 - vector_field: true - prob: 1 - nb: 2 - Patch: - patch_size: - - 0 - - 0 - - 0 - overlap: 20% - pad_value: None - extend_slice: 0 - mode: tile - max_voxels: None - subset: None - dataset_filenames: - - ./Dataset/:mha - batch_size: 1 - num_workers: None - pin_memory: false - prefetch_factor: None - persistent_workers: None - outputs_dataset: - DisplacementField: - OutputDataset: - name_class: OutputDataset - before_reduction_transforms: None - after_reduction_transforms: None - final_transforms: - TensorCast: - dtype: float32 - inverse: false - dataset_filename: Transform:itktransform - group: Transform - same_as_group: Volume_0:Fixed - patch_combine: Cosinus - reduction: Mean - Mean: {} - train_name: ImpactReg-FireANTs-SyN - manual_seed: 42 - gpu_checkpoints: None - combine: Mean - autocast: false - data_log: None diff --git a/FireANTs_SyN/app.json b/FireANTs_SyN/app.json index e7c743998bac6fbe65487d91a89a83268bdf7fa0..dff5b0faeeeeebf077f591be79b8a3ee855c80d0 100644 --- a/FireANTs_SyN/app.json +++ b/FireANTs_SyN/app.json @@ -1,7 +1,7 @@ { "display_name": "FireANTs (SyN)", "short_description": "Rigid + Affine + SyN diffeomorphic registration on GPU (FireANTs).", - "description": "GPU deformable registration with FireANTs: a Rigid (MI) + Affine (MI) linear pre-align followed by a symmetric diffeomorphic SyN stage (CC), all optimised with Riemannian Adam. Produces the displacement field on the fixed grid, from which impact-reg-konfai derives the moved image. FireANTs is an external dependency under the FireANTs License v1.0 (see NOTICE).", + "description": "GPU deformable registration with FireANTs: a Rigid (MI) + Affine (MI) linear pre-align followed by a symmetric diffeomorphic SyN stage (CC), all optimised with Riemannian Adam. Produces the moved image and the total displacement field on the fixed grid. FireANTs is an external dependency under the FireANTs License v1.0 (see NOTICE).", "task": "registration", "tta": 0, "mc_dropout": 0, @@ -85,16 +85,5 @@ } } } - }, - "vram_bytes_per_voxel": 1150, - "tiling": { - "global": "Prediction.yml", - "tile": "Prediction_tile.yml", - "tile_vram_bytes_per_voxel": 620, - "tile_ram_bytes_per_voxel": 850 - }, - "requirements_no_deps": [ - "fireants>=1.5,<1.6" - ], - "ram_bytes_per_voxel": 1550 + } } diff --git a/FireANTs_SyN/requirements.txt b/FireANTs_SyN/requirements.txt index cb6865d5e19cafdd0f4e30810680d63af6a429fc..328648f8f84a7fc973b5c29be70680b4862223cf 100644 --- a/FireANTs_SyN/requirements.txt +++ b/FireANTs_SyN/requirements.txt @@ -1,8 +1,4 @@ hydra-core nibabel pandas -scipy impact_reg_konfai>=1.7.0 -matplotlib -scikit-image -tqdm diff --git a/Generic_Rigid/Prediction.yml b/Generic_Rigid/Prediction.yml index b1d521313d2a0c5eacfc91fcf99f9c5118b1e088..32fbf70c340a9a95f48122cdc789ac849cf50254 100644 --- a/Generic_Rigid/Prediction.yml +++ b/Generic_Rigid/Prediction.yml @@ -59,15 +59,10 @@ Predictor: prob: 1 nb: 2 Patch: - patch_size: - - 0 - - 0 - - 0 + patch_size: [0, 0, 0] overlap: 20% pad_value: None extend_slice: 0 - mode: resample - max_voxels: None subset: None dataset_filenames: - ./Dataset/:mha diff --git a/Generic_Rigid/app.json b/Generic_Rigid/app.json index b6836de481a3964a32a62b2437312fc22185d8c3..8b8d4a8c41574e9ac6e90ccc602f7aac96bf4f07 100644 --- a/Generic_Rigid/app.json +++ b/Generic_Rigid/app.json @@ -85,10 +85,5 @@ } } } - }, - "vram_bytes_per_voxel": 120, - "tiling": { - "global": "Prediction.yml" - }, - "ram_bytes_per_voxel": 550 + } } diff --git a/Generic_Rigid_BSpline/Prediction.yml b/Generic_Rigid_BSpline/Prediction.yml index 5a2ba2697cd289a8024374a66b4e034d66461a02..4e6cb61af01d1bae0a887bf91429cb51dbe89a5a 100644 --- a/Generic_Rigid_BSpline/Prediction.yml +++ b/Generic_Rigid_BSpline/Prediction.yml @@ -61,15 +61,10 @@ Predictor: prob: 1 nb: 2 Patch: - patch_size: - - 0 - - 0 - - 0 + patch_size: [0, 0, 0] overlap: 20% pad_value: None extend_slice: 0 - mode: resample - max_voxels: None subset: None dataset_filenames: - ./Dataset/:mha diff --git a/Generic_Rigid_BSpline/Prediction_tile.yml b/Generic_Rigid_BSpline/Prediction_tile.yml deleted file mode 100644 index 4ba285199d14ec5e2718b28b368b4f33cc6a5a83..0000000000000000000000000000000000000000 --- a/Generic_Rigid_BSpline/Prediction_tile.yml +++ /dev/null @@ -1,101 +0,0 @@ -Predictor: - Model: - classpath: impact_reg_konfai.models.elastix:RegistrationNet - RegistrationNet: - engine: elastix - parameter_maps: - - Parameters_BSpline.txt - outputs_criterions: None - max_iterations: 0 - final_grid_spacing: 16.0 - spatial_samples: 2048 - parameter_overrides: [] - Dataset: - groups_src: - Volume_0: - groups_dest: - Fixed: - transforms: - TensorCast: - dtype: float32 - inverse: false - patch_transforms: None - is_input: true - Volume_1: - groups_dest: - Moving: - transforms: - TensorCast: - dtype: float32 - inverse: false - patch_transforms: None - is_input: true - Volume_2: - groups_dest: - FixedMask: - transforms: - TensorCast: - dtype: float32 - inverse: false - patch_transforms: None - is_input: true - Volume_3: - groups_dest: - MovingMask: - transforms: - TensorCast: - dtype: float32 - inverse: false - patch_transforms: None - is_input: true - augmentations: - DataAugmentation_0: - data_augmentations: - Flip: - f_prob: - - 0 - - 0.5 - - 0.5 - vector_field: true - prob: 1 - nb: 2 - Patch: - patch_size: - - 0 - - 0 - - 0 - overlap: 20% - pad_value: None - extend_slice: 0 - mode: tile - max_voxels: None - subset: None - dataset_filenames: - - ./Dataset/:mha - batch_size: 1 - num_workers: None - pin_memory: false - prefetch_factor: None - persistent_workers: None - outputs_dataset: - DisplacementField: - OutputDataset: - name_class: OutputDataset - before_reduction_transforms: None - after_reduction_transforms: None - final_transforms: - TensorCast: - dtype: float32 - inverse: false - dataset_filename: Transform:itktransform - group: Transform - same_as_group: Volume_0:Fixed - patch_combine: Cosinus - reduction: Mean - Mean: {} - train_name: ImpactReg-Generic-Rigid-BSpline - manual_seed: 42 - gpu_checkpoints: None - combine: Mean - autocast: false - data_log: None diff --git a/Generic_Rigid_BSpline/app.json b/Generic_Rigid_BSpline/app.json index ee45d7fdd6ce0ed4f954975c67dd5fc7a2db07eb..cbcc239dfc0cdba767ef7d494e41101bdbc70d86 100644 --- a/Generic_Rigid_BSpline/app.json +++ b/Generic_Rigid_BSpline/app.json @@ -85,13 +85,5 @@ } } } - }, - "vram_bytes_per_voxel": 120, - "tiling": { - "global": "Prediction.yml", - "tile": "Prediction_tile.yml", - "tile_vram_bytes_per_voxel": 120, - "tile_ram_bytes_per_voxel": 550 - }, - "ram_bytes_per_voxel": 550 + } } diff --git a/README.md b/README.md index 9c2f448ed1d62114d2a7c87a01fb534cc50d5bd3..39d66670bc1b584801c47035337aad94d9fe02f5 100644 --- a/README.md +++ b/README.md @@ -21,10 +21,9 @@ similarity metric — deep features from pretrained segmentation / foundation mo **TotalSegmentator**, **anatomix**) — so cross-modality pairs align while the deformation stays smooth and physically plausible. -Each preset is a **self-contained KonfAI app** that writes one output: the **`DisplacementField`** on the -**fixed** grid (`Transform.h5`, an ITK displacement field mapping a fixed point to its moving partner, in mm). -`impact-reg-konfai register` derives the moved image from it, and **ensembles** presets by averaging their -fields into one transform. +Each preset is a **self-contained KonfAI app**: on the **fixed** grid it produces the moving image +resampled onto the fixed image (**`MovedImage`**) and the **`DisplacementField`**. Presets can be +**ensembled** (their displacement fields are averaged into one transform). ## 🧩 Presets @@ -32,16 +31,13 @@ fields into one transform. |:--|:--|:--|:--| | `Generic_Rigid` | any | elastix | Rigid alignment (mutual information, multi-resolution) | | `Generic_Rigid_BSpline` | any | elastix | Rigid, then B-spline deformable refinement | -| `Elastix_IMPACT_Jacobian` | CT/CBCT | elastix + IMPACT | A rigid (MI) stage, then a B-spline on early `TS/M730` layers, differentiated through the network (Jacobian) | -| `Elastix_IMPACT_Static` | MR/CT | elastix + IMPACT | A rigid (MI) stage, then a B-spline on MIND and `TS/M730` (last decoder layer at the coarse levels, segmentation head at the fine ones), features extracted once (Static) | +| `Elastix_IMPACT_Jacobian` | CT/CBCT | elastix + IMPACT | Early `TS/M730` layers, differentiated through the network (Jacobian) | +| `Elastix_IMPACT_Static` | MR/CT | elastix + IMPACT | A deep `TS/M730` layer + MIND, features extracted once (Static) | | `ConvexAdam_Coarse` | any | itk-impact (native) | Global coarse coupled-convex initialisation on MIND features | | `ConvexAdam_Composite` | any | itk-impact (native) | The same coarse pass followed by the Adam refinement, in one app | -| `ConvexAdam_IMPACT_CBCT` | CT/CBCT | itk-impact (native) | The same pipeline on the second layer of TotalSegmentator MR (`TS/M730`) | -| `ConvexAdam_IMPACT_MRCT` | MR/CT | itk-impact (native) | The same pipeline on the last decoder layer of `TS/M730` (soft Dice) and MIND, more regularised | | `FireANTs_SyN` | any | FireANTs (native) | Rigid + Affine + deformable — SyN or Greedy via `deformable_method` (Riemannian Adam, GPU) | -| `FireANTs_IMPACT` | CT/CBCT | FireANTs + IMPACT | Rigid + Affine + SyN driven by the IMPACT deep-feature metric (multi-model, GPU) | +| `FireANTs_IMPACT` | any | FireANTs + IMPACT | Rigid + Affine + SyN driven by the IMPACT deep-feature metric (multi-model, GPU) | | `FireANTs_Anatomix` | any | FireANTs + IMPACT | The anatomix pipeline: anatomix + MIND features registered as feature volumes (Static), each reduced to its main components (GPU) | -| `FireANTs_IMPACT_MRCT` | MR/CT | FireANTs + IMPACT | Rigid + Affine + SyN on the last decoder layer of `TS/M730` and MIND, extracted once and reduced to their main components (Static, GPU) | Inputs: **Fixed**, **Moving**, and optional **FixedMask** / **MovingMask** (restrict the metric region). @@ -53,77 +49,42 @@ pip install impact-reg-konfai impact-reg-konfai register ConvexAdam_Composite -f fixed.nii.gz -m moving.nii.gz -o ./Output --gpu 0 ``` -- **Generic runner (single preset):** `konfai-apps infer VBoussot/ImpactReg:ConvexAdam_Composite -i fixed.nii.gz -i moving.nii.gz -o output/` writes the displacement field only. +- **Generic runner (single preset):** `konfai-apps infer VBoussot/ImpactReg:ConvexAdam_Composite -i fixed.nii.gz -i moving.nii.gz -o output/` - **Interactive:** [**SlicerImpactReg**](https://github.com/vboussot/SlicerImpactReg) — a 3D Slicer extension driving these presets. -> The `ConvexAdam_*` presets depend on [`itk-impact`](https://pypi.org/project/itk-impact/), whose wheels are built against **torch 2.12**: install it alongside (`pip install impact-reg-konfai "torch==2.12.*"`). An app's requirements never replace the torch already installed. +> The `ConvexAdam_*` presets depend on [`itk-impact`](https://pypi.org/project/itk-impact/); resolving the app installs it automatically (it reuses your existing PyTorch, CPU or GPU). > -> The `FireANTs_*` presets depend on [`fireants`](https://pypi.org/project/fireants/) (installed at resolve time; a GPU is recommended, the CPU works but is slow). FireANTs is distributed under the **FireANTs License v1.0** — this app calls its public API without copying its source, and ships its license and citation in each preset's `NOTICE`; please cite FireANTs if you use them. `FireANTs_IMPACT` and `FireANTs_Anatomix` additionally drive the deformable stage with the KonfAI **IMPACT** metric, fetching their feature models from `VBoussot/impact-torchscript-models`. +> The `FireANTs_*` presets depend on [`fireants`](https://pypi.org/project/fireants/) (installed at resolve time; **GPU required**). FireANTs is distributed under the **FireANTs License v1.0** — this app calls its public API without copying its source, and ships its license and citation in each preset's `NOTICE`; please cite FireANTs if you use them. `FireANTs_IMPACT` and `FireANTs_Anatomix` additionally drive the deformable stage with the KonfAI **IMPACT** metric, fetching their feature models from `VBoussot/impact-torchscript-models`. -## 🩻 In 3D Slicer - -[**SlicerImpactReg**](https://github.com/vboussot/SlicerImpactReg) runs these presets on the volumes of a Slicer scene: fixed and moving images, optional masks, several presets ensembled in one run, the moved image and the transform loaded back into the scene, then an evaluation panel (MAE against a reference image, Dice against reference segmentations, TRE on paired landmarks) and an uncertainty map from the spread of the ensemble. +## ⚡ Performance & VRAM -[![The moved MRI under the CT organ contours in Slicer](https://raw.githubusercontent.com/vboussot/SlicerImpactReg/main/Screenshots/tutorial/05-after.jpg)](https://github.com/vboussot/SlicerImpactReg/blob/main/Screenshots/SlicerImpactReg-tutorial.mp4) +`ConvexAdam` presets (native, GPU) benchmarked on an **NVIDIA RTX PRO 5000 (24 GB)** with a real +abdomen **MR→CT** pair, **222 × 226 × 124 @ 2 mm** (single pass, no TTA): -🎥 [Walkthrough video](https://github.com/vboussot/SlicerImpactReg/blob/main/Screenshots/SlicerImpactReg-tutorial.mp4) (with captions) and its [step-by-step tutorial](https://github.com/vboussot/SlicerImpactReg/blob/main/TUTORIAL.md), on an abdomen MRI/CT pair of the public SynthRAD2025 dataset. +| Preset | Stages | Time / case | Peak VRAM | +|:--|:--|:--:|:--:| +| `ConvexAdam_Coarse` | linear + coarse | **≈ 4.6 s** | ~2.1 GB | +| `ConvexAdam_Composite` | linear + coarse + fine | **≈ 5.1 s** | ~2.1 GB | +| `FireANTs_Anatomix` | rigid + affine + SyN on feature volumes | **≈ 75 s** | ~1.5 GB | -On that pair, rigidly aligned by the challenge, the ensemble of `ConvexAdam_Composite`, `FireANTs_Anatomix` and `Elastix_IMPACT_Static` brings the mean Dice of eight organs from 0.65 to 0.83 and their landmark error from 11.2 to 6.1 mm. The time, Dice and landmark error of each preset are in the [SlicerImpactReg README](https://github.com/vboussot/SlicerImpactReg#-on-the-walkthrough-case). +ConvexAdam per-stage breakdown: linear pre-align **≈ 4.2 s** (ITK affine, MI) · coarse **≈ 0.4 s** · fine **≈ 0.5 s**. +One-time TorchScript feature-model load **≈ 7 s** (amortised across a batch). Times scale with case size; +`--tta k` multiplies runtime. The `elastix + IMPACT` presets run through elastix and scale differently. -## ⚡ Performance & VRAM +## 🧩 Large volumes -Measured with `impact-reg-konfai register` on nine public datasets (Learn2Reg's AbdomenMRCT, ThoraxCBCT, AbdomenCTCT -and OASIS, Lung250M-4B, BraTS-Reg and three SynthRAD2025 tasks: MR/CT, CBCT/CT, CT/CT and MR/MR pairs of 6 to 33 -million voxels), one case at a time on an **NVIDIA RTX PRO 5000 Blackwell Laptop GPU (24 GB)**. The time is the whole call, start-up, model loading and writing included; the VRAM is the peak of its -processes, PyTorch's cache included, so a preset that finds a free card fills more of it than it needs. - -| Preset | Time per case | Peak VRAM | -|:--|:--:|:--:| -| `Generic_Rigid` | 6 s to 13 s | 1.8 to 5.6 GB | -| `Generic_Rigid_BSpline` | 8 s to 20 s | 1.8 to 5.6 GB | -| `Elastix_IMPACT_Static` | 53 s to 2 min | 1.9 to 12.8 GB | -| `Elastix_IMPACT_Jacobian` | 4 min to 6 min | 2.1 to 5.4 GB | -| `ConvexAdam_Coarse` | 20 s to 2 min | 1.8 to 8.0 GB | -| `ConvexAdam_Composite` | 20 s to 2 min | 2.0 to 9.4 GB | -| `ConvexAdam_IMPACT_CBCT` | 26 s to 56 s | 6.8 to 17.3 GB | -| `ConvexAdam_IMPACT_MRCT` | 24 s to 47 s | 7.9 to 23.0 GB | -| `FireANTs_SyN` | 22 s to 4 min | 6.4 to 20.5 GB | -| `FireANTs_IMPACT` | 62 s to 24 min | 16.2 to 23.3 GB | -| `FireANTs_Anatomix` | 31 s to 5 min | 10.7 to 22.9 GB | -| `FireANTs_IMPACT_MRCT` | 57 s to 11 min | 9.9 to 21.2 GB | - -How accurate each preset is on each pair, and which one to start from: -[the presets page](https://github.com/fideus-labs/KonfAI/blob/main/apps/impact_reg/docs/presets.md). +Every preset leaves its patch free (`patch_size: [0, 0, 0]`). A pair that fits the GPU runs as one patch, and +the engine receives exactly what it did before. When the GPU runs out of memory, KonfAI cuts the volume into +the fewest equal patches that fit, registers each, and blends the fields over a 20 % overlap with a cosine +window. A patch size can still be forced with `--patch-size`. -## 🧩 Large volumes +The `elastix + IMPACT` presets rarely get there. IMPACT computes its features on the whole image and, when that +does not fit the GPU, retries on smaller feature patches by itself: the run is slower, and the registration +stays one global registration. -A pair that fits the device registers whole. A larger one is registered at its native resolution, in tiles, by -`impact-reg-konfai register` and by SlicerImpactReg, which runs it. Each preset states what one voxel costs it on the -GPU, whole and in a tile (`vram_bytes_per_voxel` and `tiling` in its `app.json`); on the CPU the same figures are read -against half the RAM left: - -1. The preset (`Prediction.yml`, patch `mode: resample`) runs once on the whole pair, which KonfAI resamples onto a - grid just coarse enough to fit and whose field it brings back onto the native fixed grid: rigid, affine and - deformable stay one global registration. -2. The moving image goes through that result onto the native fixed grid, streamed. -3. The preset's deformable stage alone (`Prediction_tile.yml`) refines it on native tiles, blended over their overlap - with a cosine window. KonfAI cuts the tiles (patch `mode: tile`) to what the device holds, sized before the run. - A tile the fixed mask does not reach gets a zero field without running. -4. The two fields are composed on the native grid. - -`Generic_Rigid`, `ConvexAdam_Coarse`, `ConvexAdam_IMPACT_MRCT` and the two elastix IMPACT presets stop after step 1: -their result is resampled onto the native grid. The elastix IMPACT features are computed at their model's own voxel size, a few millimetres: -registered again on native tiles, they added deformation rather than detail (on an abdomen MRI/CT pair, -`Elastix_IMPACT_Static` missed the organ landmarks by 12.2 mm that way, 10.0 mm global only, 9.2 mm whole). - -On two ExaSPIM mouse brains at 80 µm (257 × 665 × 887 voxels), `FireANTs_SyN` then reaches a correlation of 0.68 in -6 min 19 s on a 24 GB GPU, where cutting the pair into patches that each fit their own rigid and affine gave 0.62 in -16 min 24 s. - -Every `Prediction.yml` leaves its patch free (`patch_size: [0, 0, 0]`, `mode: resample`) and is never cut: with -`--max-voxels 0`, or through the generic `konfai-apps infer`, KonfAI resamples a pair that runs out of memory onto a -coarser grid and runs it again whole. `--patch-size` forces a size. The `elastix + IMPACT` presets also retry their IMPACT features on smaller patches by -themselves when the whole image does not fit the GPU. +Tiling suits a local, deformable stage (the fine ConvexAdam pass, `FireANTs_SyN`). A global stage +(rigid, affine, the coarse ConvexAdam initialisation) is then estimated per patch, which is no longer one +global transform: for those, prefer a GPU the volume fits on, or a coarser input. ## 🔗 Links & Citation