Hounsfield conversion
Simple class for conversion from HU to the provided units through a piecewise curve fit
Source code in pygrpm/material/hounsfield_conversion.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 |
|
fit_curve(curve_dataframe=None, plot=False)
Method used to apply the curve fit on the provided filepath data :param curve_dataframe: Dataframe containing the conversion data :param plot: Whether to display a preview plot of the fit :return :A tuple of 3 tuples x and y data from the loaded data parameters and covariance of the fit x and y labels from the loaded data
Source code in pygrpm/material/hounsfield_conversion.py
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 |
|
get_fit_params()
Returns a tuple of fit parameters as returned by scipy's curve_fit() https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.curve_fit.html :return: Tuple
Source code in pygrpm/material/hounsfield_conversion.py
68 69 70 71 72 73 74 |
|
load_curve_csv(filepath)
Simple method to load csv, acts as a soft wrapper to pandas read_csv :param filepath: String :return: DataFrame
Source code in pygrpm/material/hounsfield_conversion.py
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
|
plot_fit(plot_data, fit_data)
staticmethod
Internal method to quickly preview the performed fit :param plot_data: A tuple/array containing x and y lists/arrays :param fit_data: A tuple/array containing the x and y fit parameters :return : None
Source code in pygrpm/material/hounsfield_conversion.py
139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 |
|