@@ -82,94 +82,94 @@ def contrast_curve_calc():
82
82
tissue_included = np .array ([1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 13 , 17 , 18 , 20 , 22 , 23 , 24 , 25 , 26 , 30 , 36 , 37 , 40 , 41 , 42 , 43 , 50 , 73 ])
83
83
84
84
D = np .zeros (74 )
85
- D [1 ] = 2e -3 # 1 Myocardium LV
86
- D [2 ] = 2e -3 # 2 myocardium RV
85
+ D [1 ] = 2.4e -3 # 1 Myocardium LV : Delattre et al. doi: 10.1097/RLI.0b013e31826ef901
86
+ D [2 ] = 2.4e -3 # 2 myocardium RV: Delattre et al. doi: 10.1097/RLI.0b013e31826ef901
87
87
D [3 ] = 2e-3 # 3 myocardium la
88
88
D [4 ] = 1.5e-3 # 4 myocardium ra
89
89
D [5 ] = 3e-3 # 5 Blood LV
90
90
D [6 ] = 3e-3 # 6 Blood RV
91
91
D [7 ] = 3e-3 # 7 Blood la
92
92
D [8 ] = 3e-3 # 8 Blood ra
93
- D [13 ] = 1.2e -3 # 13 liver
94
- D [17 ] = 1e -3 # 17 esophagus
95
- D [18 ] = 1e -3 # 18 esophagus cont
96
- D [20 ] = 1e -3 # 20 stomach wall
93
+ D [13 ] = 1.5e -3 # 13 liver: Delattre et al. doi: 10.1097/RLI.0b013e31826ef901
94
+ D [17 ] = 1.67e -3 # 17 esophagus : Huang et al. doi: 10.1259/bjr.20170421
95
+ D [18 ] = 1.67e -3 # 18 esophagus cont : Huang et al. doi: 10.1259/bjr.20170421
96
+ D [20 ] = 1.5e -3 # 20 stomach wall: Li et al. doi: 10.3389/fonc.2022.821586
97
97
D [22 ] = 1.3e-3 # 22 Pancreas (from literature)
98
- D [23 ] = 2e -3 # 23 right kydney cortex
99
- D [24 ] = 1e -3 # 23 right kydney medulla
100
- D [25 ] = 2e -3 # 23 left kydney cortex
101
- D [26 ] = 1e -3 # 23 left kydney medulla
102
- D [30 ] = 0.8e -3 # 30 spleen
98
+ D [23 ] = 2.12e -3 # 23 right kydney cortex : van Baalen et al. Doi: jmri.25519
99
+ D [24 ] = 2.09e -3 # 23 right kydney medulla : van Baalen et al. Doi: jmri.25519
100
+ D [25 ] = 2.12e -3 # 23 left kydney cortex : van Baalen et al. Doi: jmri.25519
101
+ D [26 ] = 2.09e -3 # 23 left kydney medulla : van Baalen et al. Doi: jmri.25519
102
+ D [30 ] = 1.3e -3 # 30 spleen : Taimouri et al. Doi: 10.1118/1.4915495
103
103
D [36 ] = 3e-3 # 36 artery
104
- D [37 ] = 3e-3 # 37 vein
105
- D [40 ] = 3e -3 # 40 asc lower intestine
106
- D [41 ] = 3e -3 # 41 trans lower intestine
107
- D [42 ] = 3e -3 # 42 desc lower intestine
108
- D [43 ] = 3e -3 # 43 small intestine
104
+ D [37 ] = 3e-3 # 37 vein
105
+ D [40 ] = 1.31e -3 # 40 asc lower intestine : Hai-Jing et al. doi: 10.1097/RCT.0000000000000926
106
+ D [41 ] = 1.31e -3 # 41 trans lower intestine : Hai-Jing et al. doi: 10.1097/RCT.0000000000000926
107
+ D [42 ] = 1.31e -3 # 42 desc lower intestine : Hai-Jing et al. doi: 10.1097/RCT.0000000000000926
108
+ D [43 ] = 1.31e -3 # 43 small intestine : Hai-Jing et al. doi: 10.1097/RCT.0000000000000926
109
109
D [50 ] = 3e-3 # 50 pericardium
110
110
D [73 ] = 1.8e-3 # 73 Pancreatic tumor (advanced state, from literature)
111
111
112
112
f = np .zeros (74 )
113
- f [1 ] = 0.7 # 1 Myocardium LV
114
- f [2 ] = 0.7 # 2 myocardium RV
115
- f [3 ] = 0.7 # 3 myocardium la
116
- f [4 ] = 0.7 # 4 myocardium ra
113
+ f [1 ] = 0.15 # 1 Myocardium LV : Delattre et al. doi: 10.1097/RLI.0b013e31826ef901
114
+ f [2 ] = 0.15 # 2 myocardium RV : Delattre et al. doi: 10.1097/RLI.0b013e31826ef901
115
+ f [3 ] = 0.07 # 3 myocardium la
116
+ f [4 ] = 0.07 # 4 myocardium ra
117
117
f [5 ] = 1.00 # 5 Blood LV
118
118
f [6 ] = 1.00 # 6 Blood RV
119
119
f [7 ] = 1.00 # 7 Blood la
120
120
f [8 ] = 1.00 # 8 Blood ra
121
- f [13 ] = 0.25 # 13 liver
122
- f [17 ] = 0.1 # 17 esophagus
123
- f [18 ] = 0.1 # 18 esophagus cont
124
- f [20 ] = 0.3 # 20 stomach wall
121
+ f [13 ] = 0.11 # 13 liver : Delattre et al. doi: 10.1097/RLI.0b013e31826ef901
122
+ f [17 ] = 0.32 # 17 esophagus : Huang et al. doi: 10.1259/bjr.20170421
123
+ f [18 ] = 0.32 # 18 esophagus cont : Huang et al. doi: 10.1259/bjr.20170421
124
+ f [20 ] = 0.3 # 20 stomach wall: Li et al. doi: 10.3389/fonc.2022.821586
125
125
f [22 ] = 0.15 # 22 Pancreas (from literature)
126
- f [23 ] = 0.3 # 23 right kydney cortex
127
- f [24 ] = 0.2 # 23 right kydney medulla
128
- f [25 ] = 0.3 # 23 left kydney cortex
129
- f [26 ] = 0.2 # 23 left kydney medulla
130
- f [30 ] = 0.4 # 30 spleen
131
- f [36 ] = 1.0 # 36 artery
132
- f [37 ] = 1.0 # 37 vein
133
- f [40 ] = 0.19 # 40 asc lower intestine
134
- f [41 ] = 0.19 # 41 trans lower intestine
135
- f [42 ] = 0.19 # 42 desc lower intestine
136
- f [43 ] = 0.19 # 43 small intestine
126
+ f [23 ] = 0.097 # 23 right kydney cortex : van Baalen et al. Doi: jmri.25519
127
+ f [24 ] = 0.158 # 23 right kydney medulla : van Baalen et al. Doi: jmri.25519
128
+ f [25 ] = 0.097 # 23 left kydney cortex : van Baalen et al. Doi: jmri.25519
129
+ f [26 ] = 0.158 # 23 left kydney medulla : van Baalen et al. Doi: jmri.25519
130
+ f [30 ] = 0.2 # 30 spleen : Taimouri et al. Doi: 10.1118/1.4915495
131
+ f [36 ] = 1.0 # 36 artery
132
+ f [37 ] = 1.0 # 37 vein
133
+ f [40 ] = 0.69 # 40 asc lower intestine : Hai-Jing et al. doi: 10.1097/RCT.0000000000000926
134
+ f [41 ] = 0.69 # 41 trans lower intestine : Hai-Jing et al. doi: 10.1097/RCT.0000000000000926
135
+ f [42 ] = 0.69 # 42 desc lower intestine : Hai-Jing et al. doi: 10.1097/RCT.0000000000000926
136
+ f [43 ] = 0.69 # 43 small intestine : Hai-Jing et al. doi: 10.1097/RCT.0000000000000926
137
137
f [50 ] = 0.07 # 50 pericardium
138
138
f [73 ] = 0.37 # 73 Pancreatic tumor (advanced state, from literature)
139
139
140
140
Ds = np .zeros (74 )
141
- Ds [1 ] = 0.07 # 1 Myocardium LV
142
- Ds [2 ] = 0.07 # 2 myocardium RV
141
+ Ds [1 ] = 0.08 # 1 Myocardium LV: Delattre et al. doi: 10.1097/RLI.0b013e31826ef901
142
+ Ds [2 ] = 0.08 # 2 myocardium RV: Delattre et al. doi: 10.1097/RLI.0b013e31826ef901
143
143
Ds [3 ] = 0.07 # 3 myocardium la
144
144
Ds [4 ] = 0.07 # 4 myocardium ra
145
145
Ds [5 ] = 0.1 # 5 Blood LV
146
146
Ds [6 ] = 0.1 # 6 Blood RV
147
147
Ds [7 ] = 0.1 # 7 Blood la
148
148
Ds [8 ] = 0.1 # 8 Blood ra
149
- Ds [13 ] = 0.05 # 13 liver
150
- Ds [17 ] = 0.05 # 17 esophagus
151
- Ds [18 ] = 0.05 # 18 esophagus cont
152
- Ds [20 ] = 0.07 # 20 stomach wall
149
+ Ds [13 ] = 0.1 # 13 liver: Delattre et al. doi: 10.1097/RLI.0b013e31826ef901
150
+ Ds [17 ] = 0.03 # 17 esophagus : Huang et al. doi: 10.1259/bjr.20170421
151
+ Ds [18 ] = 0.03 # 18 esophagus cont : Huang et al. doi: 10.1259/bjr.20170421
152
+ Ds [20 ] = 0.012 # 20 stomach wall: Li et al. doi: 10.3389/fonc.2022.821586
153
153
Ds [22 ] = 0.01 # 22 Pancreas (from literature)
154
- Ds [23 ] = 0.02 # 23 right kydney cortex
155
- Ds [24 ] = 0.07 # 23 right kydney medulla
156
- Ds [25 ] = 0.02 # 23 left kydney cortex
157
- Ds [26 ] = 0.07 # 23 left kydney medulla
158
- Ds [30 ] = 0.08 # 30 spleen
159
- Ds [36 ] = 0.1 # 36 artery
160
- Ds [37 ] = 0.1 # 37 vein
161
- Ds [40 ] = 0.09 # 40 asc lower intestine
162
- Ds [41 ] = 0.09 # 41 trans lower intestine
163
- Ds [42 ] = 0.09 # 42 desc lower intestine
164
- Ds [43 ] = 0.09 # 43 small intestine
154
+ Ds [23 ] = 0.02 # 23 right kydney cortex : van Baalen et al. Doi: jmri.25519
155
+ Ds [24 ] = 0.019 # 23 right kydney medulla : van Baalen et al. Doi: jmri.25519
156
+ Ds [25 ] = 0.02 # 23 left kydney cortex : van Baalen et al. Doi: jmri.25519
157
+ Ds [26 ] = 0.019 # 23 left kydney medulla : van Baalen et al. Doi: jmri.25519
158
+ Ds [30 ] = 0.03 # 30 spleen : Taimouri et al. Doi: 10.1118/1.4915495
159
+ Ds [36 ] = 0.1 # 36 artery
160
+ Ds [37 ] = 0.1 # 37 vein
161
+ Ds [40 ] = 0.029 # 40 asc lower intestine : Hai-Jing et al. doi: 10.1097/RCT.0000000000000926
162
+ Ds [41 ] = 0.029 # 41 trans lower intestine : Hai-Jing et al. doi: 10.1097/RCT.0000000000000926
163
+ Ds [42 ] = 0.029 # 42 desc lower intestine : Hai-Jing et al. doi: 10.1097/RCT.0000000000000926
164
+ Ds [43 ] = 0.029 # 43 small intestine : Hai-Jing et al. doi: 10.1097/RCT.0000000000000926
165
165
Ds [50 ] = 0.01 # 50 pericardium
166
166
Ds [73 ] = 0.01 # 73 Pancreatic tumor (advanced state, from literature)
167
167
# Return values
168
168
169
169
return tissue_included , D , f , Ds
170
170
171
171
172
- def XCAT_to_MR_DCE (XCAT , TR , TE , bvalue , tissue_included , D , f , Ds , b0 = 3 , ivim_cont = True , Contrast = 'SE' , FA = 90 ):
172
+ def XCAT_to_MR_DCE (XCAT , TR , TE , bvalue , tissue_included , D , f , Ds , b0 = 3 , ivim_cont = True ):
173
173
###########################################################################################
174
174
# This script converts XCAT tissue values to MR contrast based on the SSFP signal equation.
175
175
# Christopher W. Roy 2018-12-04 # fetal.xcmr@gmail.com
@@ -355,19 +355,8 @@ def XCAT_to_MR_DCE(XCAT, TR, TE, bvalue, tissue_included, D, f, Ds, b0=3, ivim_c
355
355
#S0 = np.zeros(len(bvalue))
356
356
S0 = ivim (bvalue ,Dtemp ,ftemp ,Dstemp )
357
357
if T1 > 0 or T2 > 0 :
358
- if Contrast == 'GRE' :
359
- if iTissue not in [31 , 32 , 33 ]:
360
- MR = MR + (XCAT == iTissue ) * np .sin (np .deg2rad (FA )) * (1 - np .exp (- TR / T1 )) / (
361
- 1 - (np .cos (np .deg2rad (FA )) * np .exp (- TR / T1 )))
362
- elif Contrast == 'bSSFP' :
363
- MR = MR + (XCAT == iTissue ) * np .sin (np .deg2rad (FA )) * (1 - np .exp (- TR / T1 )) * np .exp (- TE / T2 ) / (
364
- 1 - (np .exp (- TR / T1 ) - np .exp (- TR / T2 )) * np .cos (np .deg2rad (FA )) - np .exp (
365
- - TR / T1 ) * np .exp (- TR / T2 ))
366
- elif Contrast == 'SE' :
367
- MR = MR + np .tile (np .expand_dims (XCAT == iTissue ,3 ),len (S0 )) * S0 * (1 - 2 * np .exp (- (TR - TE / 2 ) / T1 ) + np .exp (- TR / T1 )) * np .exp (
368
- - TE / T2 )
369
- else :
370
- raise ValueError ('Unknown MR contrast. Use only GRE, bSSFP, or SE.' )
358
+ MR = MR + np .tile (np .expand_dims (XCAT == iTissue ,3 ),len (S0 )) * S0 * (1 - 2 * np .exp (- (TR - TE / 2 ) / T1 ) + np .exp (- TR / T1 )) * np .exp (
359
+ - TE / T2 )
371
360
Dim = Dim + (XCAT == iTissue ) * Dtemp
372
361
fim = fim + (XCAT == iTissue ) * ftemp
373
362
Dpim = Dpim + (XCAT == iTissue ) * Dstemp
@@ -396,18 +385,21 @@ def XCAT_to_MR_DCE(XCAT, TR, TE, bvalue, tissue_included, D, f, Ds, b0=3, ivim_c
396
385
output_file = 'output_xcat.nii.gz' # Replace with your desired output file name
397
386
nib .save (nifti_img , output_file )
398
387
399
- nifti_img = nib .Nifti1Image (Dim * 1000000 , affine = res ) # Replace affine if necessary
388
+ nifti_img = nib .Nifti1Image (Dim , affine = res ) # Replace affine if necessary
400
389
# Save the NIfTI image to a file
390
+ nifti_img .header .set_data_dtype (np .float64 )
401
391
output_file = 'D.nii.gz' # Replace with your desired output file name
402
392
nib .save (nifti_img , output_file )
403
393
404
- nifti_img = nib .Nifti1Image (fim * 1000 , affine = res ) # Replace affine if necessary
394
+ nifti_img = nib .Nifti1Image (fim , affine = res ) # Replace affine if necessary
405
395
# Save the NIfTI image to a file
396
+ nifti_img .header .set_data_dtype (np .float64 )
406
397
output_file = 'f.nii.gz' # Replace with your desired output file name
407
398
nib .save (nifti_img , output_file )
408
399
409
- nifti_img = nib .Nifti1Image (Dpim * 1000 , affine = res ) # Replace affine if necessary
400
+ nifti_img = nib .Nifti1Image (Dpim , affine = res ) # Replace affine if necessary
410
401
# Save the NIfTI image to a file
402
+ nifti_img .header .set_data_dtype (np .float64 )
411
403
output_file = 'Dp.nii.gz' # Replace with your desired output file name
412
404
nib .save (nifti_img , output_file )
413
405
0 commit comments