@@ -1181,24 +1181,6 @@ class ProcessingQualityMetrics(dj.Computed):
11811181 -> Fluorescence
11821182 """
11831183
1184- class Mask (dj .Part ):
1185- """Quality metrics used to evaluate the masks.
1186-
1187- Attributes:
1188- Fluorescence (foreign key): Primary key from Fluorescence.
1189- Segmentation.Mask (foreign key): Primary key from Segmentation.Mask.
1190- mask_area (float): Mask area in square micrometer.
1191- roundness (float): Roundness between 0 and 1. Values closer to 1 are rounder.
1192- """
1193-
1194- definition = """
1195- -> master
1196- -> Segmentation.Mask
1197- ---
1198- mask_area=null: float # Mask area in square micrometer.
1199- roundness: float # Roundness between 0 and 1. Values closer to 1 are rounder.
1200- """
1201-
12021184 class Trace (dj .Part ):
12031185 """Quality metrics used to evaluate the fluorescence traces.
12041186
@@ -1221,61 +1203,24 @@ def make(self, key):
12211203 """Populate the ProcessingQualityMetrics table and its part tables."""
12221204 from scipy .stats import skew
12231205
1224- (
1225- mask_xpixs ,
1226- mask_ypixs ,
1227- mask_weights ,
1228- fluorescence ,
1229- fluo_channels ,
1230- mask_ids ,
1231- mask_npix ,
1232- px_height ,
1233- px_width ,
1234- um_height ,
1235- um_width ,
1236- ) = (Segmentation .Mask * RecordingInfo * Fluorescence .Trace & key ).fetch (
1237- "mask_xpix" ,
1238- "mask_ypix" ,
1239- "mask_weights" ,
1240- "fluorescence" ,
1241- "fluo_channel" ,
1242- "mask" ,
1243- "mask_npix" ,
1244- "px_height" ,
1245- "px_width" ,
1246- "um_height" ,
1247- "um_width" ,
1248- )
1249-
1250- norm_mean = lambda x : x .mean () / x .max ()
1251- roundnesses = [
1252- norm_mean (np .linalg .eigvals (np .cov (x , y , aweights = w )))
1253- for x , y , w in zip (mask_xpixs , mask_ypixs , mask_weights )
1254- ]
1206+ (fluorescence , fluorescence_channels , mask_ids ,) = (
1207+ Segmentation .Mask * RecordingInfo * Fluorescence .Trace & key
1208+ ).fetch ("fluorescence" , "fluorescence_channel" , "mask" )
12551209
12561210 fluorescence = np .stack (fluorescence )
12571211
12581212 self .insert1 (key )
12591213
1260- self .Mask .insert (
1261- dict (key , mask = mask_id , mask_area = mask_area , roundness = roundness )
1262- for mask_id , mask_area , roundness in zip (
1263- mask_ids ,
1264- mask_npix * (um_height / px_height ) * (um_width / px_width ),
1265- roundnesses ,
1266- )
1267- )
1268-
12691214 self .Trace .insert (
12701215 dict (
12711216 key ,
1272- fluo_channel = fluo_channel ,
1217+ fluorescence_channel = fluorescence_channel ,
12731218 mask = mask_id ,
12741219 skewness = skewness ,
12751220 variance = variance ,
12761221 )
1277- for fluo_channel , mask_id , skewness , variance in zip (
1278- fluo_channels ,
1222+ for fluorescence_channel , mask_id , skewness , variance in zip (
1223+ fluorescence_channels ,
12791224 mask_ids ,
12801225 skew (fluorescence , axis = 1 ),
12811226 fluorescence .std (axis = 1 ),
0 commit comments