@@ -87,10 +87,39 @@ def makeAttenuationRadiographs(leapct, g, air_scan=None, dark_scan=None, ROI=Non
8787
8888 return True
8989
90+ def badPixelCorrection (leapct , g , badPixelMap , windowSize = 3 , isAttenuationData = True ):
91+ r"""Removes bad pixels from CT projections
92+
93+ LEAP CT geometry parameters must be set prior to running this function
94+ and can be applied to any CT geometry type.
95+ This algorithm processes each projection independently
96+ and removes bad pixels specified by the user using a median filter
97+
98+ Args:
99+ leapct (tomographicModels object): This is just needed to access LEAP algorithms
100+ g (contiguous float32 numpy array or torch tensor): attenuation or transmission projection data
101+ badPixelMap (C contiguous float32 numpy array or torch tensor): 2D bad pixel map (numRows x numCols) where a value of 1.0 marks a pixel as bad
102+ windowSize (int): the window size; can be 3, 5, or 7
103+ isAttenuationData (bool): True if g is attenuation data, False otherwise
104+
105+ Returns:
106+ True if successful, False otherwise
107+ """
108+
109+ if g is None or badPixelMap is None :
110+ return False
111+
112+ # This algorithm processes each transmission
113+ if isAttenuationData :
114+ leapct .expNeg (g )
115+ leapct .badPixelCorrection (g , badPixelMap , windowSize )
116+ if isAttenuationData :
117+ leapct .negLog (g )
118+ return True
119+
90120def outlierCorrection (leapct , g , threshold = 0.03 , windowSize = 3 , isAttenuationData = True ):
91121 r"""Removes outliers (zingers) from CT projections
92122
93- Assumes the input data is in attenuation space.
94123 No LEAP parameters need to be set for this function to work
95124 and can be applied to any CT geometry type.
96125 This algorithm processes each projection independently
@@ -121,7 +150,6 @@ def outlierCorrection(leapct, g, threshold=0.03, windowSize=3, isAttenuationData
121150def outlierCorrection_highEnergy (leapct , g , isAttenuationData = True ):
122151 """Removes outliers (zingers) from CT projections
123152
124- Assumes the input data is in attenuation space.
125153 No LEAP parameters need to be set for this function to work
126154 and can be applied to any CT geometry type.
127155 This algorithm processes each projection independently
@@ -152,7 +180,6 @@ def outlierCorrection_highEnergy(leapct, g, isAttenuationData=True):
152180def LowSignalCorrection (leapct , g , threshold = 0.03 , windowSize = 3 , signalThreshold = 0.001 , isAttenuationData = True ):
153181 r"""Corrects detector pixels that have very low transmission (photon starvation)
154182
155- Assumes the input data is in attenuation space.
156183 No LEAP parameters need to be set for this function to work
157184 and can be applied to any CT geometry type.
158185 This algorithm processes each projection independently
0 commit comments