VBoussot commited on
Commit
15fcda3
·
1 Parent(s): 610386a

Update ParameterMap_Recommended.txt

Browse files

Update ParameterMap_Recommended.txt

Add mind

Update PresetDatabase.json

Add mind

Add mind

Add mind

Update ParameterMap_Mind.txt

Update PresetDatabase.json

Add mind

Add mind

Add mind

Add mind

Update ImpactReg/Uncertainty.yml

Create UncertaintyDVF

Add uncertainty

Add uncertainty

Add uncertainty

Add uncertainty

Add uncertainty

ImpactReg/Uncertainty.yml CHANGED
@@ -12,9 +12,10 @@ Evaluator:
12
  groups_dest:
13
  Uncertainty:
14
  transforms:
 
15
  Variance: {}
16
  Save:
17
- dataset: ./Evaluations/ImpactReg/Output:mha
18
  group: None
19
  subset: None
20
  dataset_filenames:
 
12
  groups_dest:
13
  Uncertainty:
14
  transforms:
15
+ UncertaintyDVF:DVFToNorm: {}
16
  Variance: {}
17
  Save:
18
+ dataset: ./Uncertainties/ImpactReg/Output:mha
19
  group: None
20
  subset: None
21
  dataset_filenames:
ImpactReg/UncertaintyDVF.py ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from konfai.data.transform import Transform
2
+ from konfai.utils.dataset import Attribute
3
+ import torch
4
+
5
+ class DVFToNorm(Transform):
6
+
7
+ def __init__(self) -> None:
8
+ super().__init__()
9
+
10
+ def __call__(self, name: str, tensors: torch.Tensor, cache_attribute: Attribute) -> torch.Tensor:
11
+ cache_attribute["Origin"] = cache_attribute.pop_np_array("Origin")[:tensors.dim()-2]
12
+ cache_attribute["Spacing"] = cache_attribute.pop_np_array("Spacing")[:tensors.dim()-2]
13
+ cache_attribute.pop("Direction")
14
+ cache_attribute["Direction"] = torch.eye(tensors.dim()-2).flatten()
15
+ return torch.linalg.norm(tensors, dim=-1)
ParameterMap_SynthRad2025_MRI_HN.txt → ParameterMap_Mind.txt RENAMED
@@ -1,138 +1,132 @@
1
- (MaximumNumberOfIterations 400 300 200 100)
2
- (NumberOfSpatialSamples 3000)
3
- (Transform "RecursiveBSplineTransform")
4
- (NumberOfResolutions 4)
5
- (FinalGridSpacingInPhysicalUnits 10)
6
- (FixedImagePyramid "FixedGenericImagePyramid")
7
- (MovingImagePyramid "MovingGenericImagePyramid")
8
- (FixedImagePyramidRescaleSchedule 1 1 1 1 1 1 1 1 1 1 1 1)
9
- (MovingImagePyramidRescaleSchedule 1 1 1 1 1 1 1 1 1 1 1 1)
10
- // (GridSpacingSchedule 10.000000 5.000000 2.000000 1.000000)
11
-
12
-
13
- (ImpactModelsPath0 "/Data/Model/MIND/R1D2.pt")
14
- (ImpactDimension0 3 )
15
- (ImpactNumberOfChannels0 1)
16
- (ImpactPatchSize0 0 0 0)
17
- (ImpactVoxelSize0 6 6 6)
18
- (ImpactLayersMask0 "1")
19
- (ImpactSubsetFeatures0 32)
20
- (ImpactPCA0 0)
21
- (ImpactDistance0 "L1")
22
- (ImpactLayersWeight0 1)
23
-
24
- (ImpactModelsPath1 "/Data/Model/MIND/R1D2.pt")
25
- (ImpactDimension1 3)
26
- (ImpactNumberOfChannels1 1)
27
- (ImpactPatchSize1 0 0 0)
28
- (ImpactVoxelSize1 3 3 3)
29
- (ImpactLayersMask1 "1")
30
- (ImpactSubsetFeatures1 32)
31
- (ImpactPCA1 0)
32
- (ImpactDistance1 "L1")
33
- (ImpactLayersWeight1 1)
34
-
35
- (ImpactModelsPath2 "/Data/Model/MIND/R1D2.pt")
36
- (ImpactDimension2 3)
37
- (ImpactNumberOfChannels2 1)
38
- (ImpactPatchSize2 0 0 0)
39
- (ImpactVoxelSize2 2 2 3)
40
- (ImpactLayersMask2 "1")
41
- (ImpactSubsetFeatures2 32)
42
- (ImpactPCA2 0)
43
- (ImpactDistance2 "L1")
44
- (ImpactLayersWeight2 1)
45
-
46
- (ImpactModelsPath3 "/Data/Model/MIND/R1D2.pt")
47
- (ImpactDimension3 3 3)
48
- (ImpactNumberOfChannels3 1 1)
49
- (ImpactPatchSize3 0 0 0 0 0 0)
50
- (ImpactVoxelSize3 1 1 3)
51
- (ImpactLayersMask3 "1")
52
- (ImpactSubsetFeatures3 32)
53
- (ImpactPCA3 0)
54
- (ImpactDistance3 "L1")
55
- (ImpactLayersWeight3 1)
56
-
57
-
58
- (ImpactUseMixedPrecision "true")
59
- (ImpactFeaturesMapUpdateInterval -1)
60
- (ImpactWriteFeatureMaps "false")
61
- (ImpactMode "Static")
62
- (ImpactGPU 0)
63
-
64
-
65
- (Metric "Impact" "AdvancedMattesMutualInformation" "TransformBendingEnergyPenalty")
66
- (Metric0Weight 1)
67
- (Metric1Weight 0.3)
68
- (Metric2Weight 50)
69
-
70
- // imageTypes
71
- (FixedInternalImagePixelType "float")
72
- (MovingInternalImagePixelType "float")
73
- (UseDirectionCosines "true")
74
-
75
- // components
76
- (Registration "MultiMetricMultiResolutionRegistration")
77
- (BSplineTransformSplineOrder 3)
78
- (UseCyclicTransform "false")
79
-
80
- // transform
81
- (AutomaticTransformInitialization "false")
82
- (AutomaticTransformInitializationMethod "GeometricalCenter")
83
- (AutomaticScalesEstimation "true")
84
- (HowToCombineTransforms "Compose")
85
-
86
-
87
- // optimizer
88
- (Optimizer "AdaptiveStochasticGradientDescent")
89
- (MaximumNumberOfSamplingAttempts 8)
90
- (UseAdaptiveStepSizes "true")
91
- (UseMultiThreadingForMetrics "true")
92
- (ASGDParameterEstimationMethod "DisplacementDistribution")
93
- //(MaximumStepLength 0.6602)
94
- (SigmoidInitialTime 0.0)
95
- (NoiseCompensation "true")
96
- (NumberOfSamplesForExactGradient 4096)
97
-
98
- // automatic
99
- (AutomaticParameterEstimation "true")
100
- //(SP_alpha 1)
101
- //(SP_A 20.0)
102
- //(SP a 400)
103
- //(SigmoidMax 1.0)
104
- //(SigmoidMin -0.8)
105
- //(SigmoidScale 0.00000001)
106
- //(NumberOfGradientMeasurements 10)
107
- //(NumberOfJacobianMeasurements 1000)
108
-
109
- (FixedKernelBSplineOrder 3)
110
- (MovingKernelBSplineOrder 3)
111
- (CheckNumberOfSamples "true")
112
- (UseRelativeWeights "false")
113
-
114
-
115
- // several
116
- (WriteTransformParametersEachIteration "false")
117
- (WriteTransformParametersEachResolution "false")
118
- (ShowExactMetricValue "false")
119
- (ErodeFixedMask "false")
120
- (ErodeMovingMask "false")
121
- (UseBinaryFormatForTransformationParameters "false")
122
-
123
- // imageSampler
124
- (Interpolator "BSplineInterpolator")
125
- (ImageSampler "RandomCoordinate")
126
- (NewSamplesEveryIteration "true")
127
- (UseRandomSampleRegion "false")
128
-
129
-
130
- // interpolator and resampler
131
- (ResampleInterpolator "FinalBSplineInterpolator")
132
- (FinalBSplineInterpolationOrder 3)
133
- (BSplineInterpolationOrder 3)
134
- (Resampler "DefaultResampler")
135
- (WriteIterationInfo "false")
136
- (WriteResultImage "false")
137
- (DefaultPixelValue 0)
138
- (ResultImageFormat "nii.gz")
 
1
+ (MaximumNumberOfIterations 300 300 300 300)
2
+ (NumberOfSpatialSamples 2048)
3
+ (Transform "RecursiveBSplineTransform")
4
+ (NumberOfResolutions 4)
5
+ (FinalGridSpacingInPhysicalUnits 16)
6
+ (FixedImagePyramid "FixedRecursiveImagePyramid")
7
+ (MovingImagePyramid "MovingRecursiveImagePyramid")
8
+
9
+ (ImpactModelsPath0 "MIND/R1D2.pt")
10
+ (ImpactDimension0 3 )
11
+ (ImpactNumberOfChannels0 1)
12
+ (ImpactPatchSize0 0 0 0)
13
+ (ImpactVoxelSize0 6 6 6)
14
+ (ImpactLayersMask0 "1")
15
+ (ImpactSubsetFeatures0 32)
16
+ (ImpactPCA0 0)
17
+ (ImpactDistance0 "L1")
18
+ (ImpactLayersWeight0 1)
19
+
20
+ (ImpactModelsPath1 "MIND/R1D2.pt")
21
+ (ImpactDimension1 3)
22
+ (ImpactNumberOfChannels1 1)
23
+ (ImpactPatchSize1 0 0 0)
24
+ (ImpactVoxelSize1 3 3 3)
25
+ (ImpactLayersMask1 "1")
26
+ (ImpactSubsetFeatures1 32)
27
+ (ImpactPCA1 0)
28
+ (ImpactDistance1 "L1")
29
+ (ImpactLayersWeight1 1)
30
+
31
+ (ImpactModelsPath2 "MIND/R1D2.pt")
32
+ (ImpactDimension2 3)
33
+ (ImpactNumberOfChannels2 1)
34
+ (ImpactPatchSize2 0 0 0)
35
+ (ImpactVoxelSize2 1.5 1.5 1.5)
36
+ (ImpactLayersMask2 "1")
37
+ (ImpactSubsetFeatures2 32)
38
+ (ImpactPCA2 0)
39
+ (ImpactDistance2 "L1")
40
+ (ImpactLayersWeight2 1)
41
+
42
+ (ImpactModelsPath3 "MIND/R1D2.pt")
43
+ (ImpactDimension3 3)
44
+ (ImpactNumberOfChannels3 1)
45
+ (ImpactPatchSize3 0 0 0)
46
+ (ImpactVoxelSize3 1 1 1)
47
+ (ImpactLayersMask3 "1")
48
+ (ImpactSubsetFeatures3 32)
49
+ (ImpactPCA3 0)
50
+ (ImpactDistance3 "L1")
51
+ (ImpactLayersWeight3 1)
52
+
53
+ (ImpactUseMixedPrecision "true")
54
+ (ImpactFeaturesMapUpdateInterval -1)
55
+ (ImpactWriteFeatureMaps "./Features/")
56
+ (ImpactMode "Static")
57
+ (ImpactGPU 0)
58
+
59
+ (Metric "Impact")
60
+ (Metric0Weight 1)
61
+
62
+ // imageTypes
63
+ (FixedInternalImagePixelType "float")
64
+ (MovingInternalImagePixelType "float")
65
+ (UseDirectionCosines "true")
66
+
67
+ // components
68
+ (Registration "MultiMetricMultiResolutionRegistration")
69
+ (BSplineTransformSplineOrder 3)
70
+ (UseCyclicTransform "false")
71
+
72
+ // transform
73
+ (AutomaticTransformInitialization "false")
74
+ (AutomaticTransformInitializationMethod "GeometricalCenter")
75
+ (AutomaticScalesEstimation "true")
76
+ (HowToCombineTransforms "Compose")
77
+
78
+
79
+ // optimizer
80
+ (Optimizer "AdaptiveStochasticGradientDescent")
81
+ (MaximumNumberOfSamplingAttempts 8)
82
+ (UseAdaptiveStepSizes "true")
83
+ (UseMultiThreadingForMetrics "true")
84
+ (ASGDParameterEstimationMethod "DisplacementDistribution")
85
+ //(MaximumStepLength 0.6602)
86
+ (SigmoidInitialTime 0.0)
87
+ (NoiseCompensation "true")
88
+ (NumberOfSamplesForExactGradient 4096)
89
+
90
+ // automatic
91
+ (AutomaticParameterEstimation "true")
92
+ //(SP_alpha 1)
93
+ //(SP_A 20.0)
94
+ //(SP a 400)
95
+ //(SigmoidMax 1.0)
96
+ //(SigmoidMin -0.8)
97
+ //(SigmoidScale 0.00000001)
98
+ //(NumberOfGradientMeasurements 10)
99
+ //(NumberOfJacobianMeasurements 1000)
100
+
101
+ (FixedKernelBSplineOrder 3)
102
+ (MovingKernelBSplineOrder 3)
103
+ (CheckNumberOfSamples "true")
104
+ (UseRelativeWeights "false")
105
+
106
+
107
+ // several
108
+ (WriteTransformParametersEachIteration "false")
109
+ (WriteTransformParametersEachResolution "false")
110
+ (ShowExactMetricValue "false")
111
+ (ErodeFixedMask "false")
112
+ (ErodeMovingMask "false")
113
+ (UseBinaryFormatForTransformationParameters "false")
114
+
115
+ // imageSampler
116
+ (Interpolator "BSplineInterpolator")
117
+ (ImageSampler "RandomCoordinate")
118
+ (NewSamplesEveryIteration "true")
119
+ (UseRandomSampleRegion "false")
120
+
121
+ // interpolator and resampler
122
+ (ResampleInterpolator "FinalBSplineInterpolator")
123
+ (FinalBSplineInterpolationOrder 3)
124
+ (BSplineInterpolationOrder 3)
125
+ (Resampler "DefaultResampler")
126
+ (WriteIterationInfo "false")
127
+ (WriteResultImage "false")
128
+ (DefaultPixelValue -1024)
129
+ (ResultImageFormat "mha")
130
+
131
+ (ITKTransformOutputFileNameExtension "itk.txt")
132
+ (WriteITKCompositeTransform "true")
 
 
 
 
 
 
ParameterMap_Recommended.txt CHANGED
@@ -2,7 +2,7 @@
2
  (Metric "Impact")
3
  (Metric0Weight 1)
4
 
5
- (ImpactModelsPath0 "/Models/TS/M730_2_Layers.pt")
6
  (ImpactDimension0 3)
7
  (ImpactNumberOfChannels0 1)
8
  (ImpactPatchSize0 11 11 11)
@@ -13,7 +13,7 @@
13
  (ImpactDistance0 "L2")
14
  (ImpactLayersWeight0 1)
15
 
16
- (ImpactModelsPath1 "/Models/TS/M258_2_Layers.pt")
17
  (ImpactDimension1 3)
18
  (ImpactNumberOfChannels1 1)
19
  (ImpactPatchSize1 11 11 11)
@@ -24,7 +24,7 @@
24
  (ImpactDistance1 "L2")
25
  (ImpactLayersWeight1 1)
26
 
27
- (ImpactModelsPath2 "/Models/TS/M258_2_Layers.pt")
28
  (ImpactDimension2 3)
29
  (ImpactNumberOfChannels2 1)
30
  (ImpactPatchSize2 11 11 11)
@@ -35,7 +35,7 @@
35
  (ImpactDistance2 "L2")
36
  (ImpactLayersWeight2 1)
37
 
38
- (ImpactModelsPath3 "/Models/TS/M258_2_Layers.pt")
39
  (ImpactDimension3 3)
40
  (ImpactNumberOfChannels3 1)
41
  (ImpactPatchSize3 11 11 11)
@@ -56,7 +56,7 @@
56
  (NumberOfSpatialSamples 2000)
57
  (Transform "RecursiveBSplineTransform")
58
  (NumberOfResolutions 4)
59
- (FinalGridSpacingInPhysicalUnits 8)
60
  (FixedImagePyramid "FixedSmoothingImagePyramid")
61
  (MovingImagePyramid "MovingSmoothingImagePyramid")
62
  (GridSpacingSchedule 10.000000 5.000000 2.000000 1.000000)
@@ -130,4 +130,5 @@
130
  (DefaultPixelValue -1024)
131
  (ResultImageFormat "mha")
132
 
133
- (ITKTransformOutputFileNameExtension "itk.txt")
 
 
2
  (Metric "Impact")
3
  (Metric0Weight 1)
4
 
5
+ (ImpactModelsPath0 "TS/M730_2_Layers.pt")
6
  (ImpactDimension0 3)
7
  (ImpactNumberOfChannels0 1)
8
  (ImpactPatchSize0 11 11 11)
 
13
  (ImpactDistance0 "L2")
14
  (ImpactLayersWeight0 1)
15
 
16
+ (ImpactModelsPath1 "TS/M730_2_Layers.pt")
17
  (ImpactDimension1 3)
18
  (ImpactNumberOfChannels1 1)
19
  (ImpactPatchSize1 11 11 11)
 
24
  (ImpactDistance1 "L2")
25
  (ImpactLayersWeight1 1)
26
 
27
+ (ImpactModelsPath2 "TS/M730_2_Layers.pt")
28
  (ImpactDimension2 3)
29
  (ImpactNumberOfChannels2 1)
30
  (ImpactPatchSize2 11 11 11)
 
35
  (ImpactDistance2 "L2")
36
  (ImpactLayersWeight2 1)
37
 
38
+ (ImpactModelsPath3 "TS/M730_2_Layers.pt")
39
  (ImpactDimension3 3)
40
  (ImpactNumberOfChannels3 1)
41
  (ImpactPatchSize3 11 11 11)
 
56
  (NumberOfSpatialSamples 2000)
57
  (Transform "RecursiveBSplineTransform")
58
  (NumberOfResolutions 4)
59
+ (FinalGridSpacingInPhysicalUnits 10)
60
  (FixedImagePyramid "FixedSmoothingImagePyramid")
61
  (MovingImagePyramid "MovingSmoothingImagePyramid")
62
  (GridSpacingSchedule 10.000000 5.000000 2.000000 1.000000)
 
130
  (DefaultPixelValue -1024)
131
  (ResultImageFormat "mha")
132
 
133
+ (ITKTransformOutputFileNameExtension "itk.txt")
134
+ (WriteITKCompositeTransform "true")
PresetDatabase.json CHANGED
@@ -24,7 +24,7 @@
24
  "description": "This preset performs rigid alignment using an Euler transform optimized with Adaptive Stochastic Gradient Descent. It uses a 4-level multi-resolution strategy and Mattes mutual information as similarity metric. Initial alignment based on image centers are enabled to ensure robust convergence for multimodal images."
25
  },
26
  {
27
- "display_name": "IMPACT BSpline M730",
28
  "parameter_maps": [
29
  "ParameterMap_Recommended.txt"
30
  ],
@@ -34,7 +34,21 @@
34
  "preprocess_function": "Preprocess:standardize_MRI",
35
  "iterations": 1900,
36
  "short_description": "IMPACT-based multimodal BSpline registration with deep semantic features (M730)",
37
- "description": "A deformable BSpline registration using the IMPACT metric to align semantic features extracted from pretrained models (MIND + M730). The method uses 4 resolution levels."
 
 
 
 
 
 
 
 
 
 
 
 
 
38
  }
 
39
  ]
40
  }
 
24
  "description": "This preset performs rigid alignment using an Euler transform optimized with Adaptive Stochastic Gradient Descent. It uses a 4-level multi-resolution strategy and Mattes mutual information as similarity metric. Initial alignment based on image centers are enabled to ensure robust convergence for multimodal images."
25
  },
26
  {
27
+ "display_name": "IMPACT BSpline jacobian M730",
28
  "parameter_maps": [
29
  "ParameterMap_Recommended.txt"
30
  ],
 
34
  "preprocess_function": "Preprocess:standardize_MRI",
35
  "iterations": 1900,
36
  "short_description": "IMPACT-based multimodal BSpline registration with deep semantic features (M730)",
37
+ "description": "A deformable BSpline registration using the IMPACT metric to align semantic features extracted from pretrained models (M730). The method uses 4 resolution levels."
38
+ },
39
+ {
40
+ "display_name": "IMPACT MIND",
41
+ "parameter_maps": [
42
+ "ParameterMap_Mind.txt"
43
+ ],
44
+ "models": [
45
+ "VBoussot/impact-torchscript-models:MIND/R1D2.pt"
46
+ ],
47
+ "preprocess_function": "Preprocess:standardize_MRI",
48
+ "iterations": 900,
49
+ "short_description": "IMPACT-based multimodal BSpline registration with MIND",
50
+ "description": "A deformable BSpline registration using the IMPACT metric to align semantic features extracted from pretrained models MIND. The method uses 4 resolution levels."
51
  }
52
+
53
  ]
54
  }