@@ -51,13 +51,15 @@ def ParticleAnalysis(acquisition,parameters,particles=None,mask=np.zeros((1))):
5151
5252 if mask == 'UI' :
5353 labeled = label (np .load (inspect .getfile (process ).rpartition ('\\ ' )[0 ]+ '/Parameters/manual_mask.npy' ))
54+ plt .imshow (labeled )
55+ #morphology.remove_small_objects(labeled,30,in_place=True)
5456 elif mask .sum ()== 0 :
5557 labeled = process (image ,parameters )
5658 #labels = np.unique(labeled).tolist() #some labeled number have been removed by "remove_small_holes" function
5759 else :
5860 labeled = label (mask )
5961
60- for region in regionprops (labeled ): #'count' start with 1, 0 is background
62+ for region in regionprops (labeled , coordinates = 'rc' ): #'count' start with 1, 0 is background
6163 p = Particle ()
6264
6365 p_im = np .zeros_like (image .data )
@@ -97,7 +99,7 @@ def ParticleAnalysis(acquisition,parameters,particles=None,mask=np.zeros((1))):
9799 p .set_eccentricity (eccentricity )
98100
99101 #Set total image intensity
100- intensity = (image .data * maskp ).sum () - p . background
102+ intensity = (( image .data - p . background ) * maskp ).sum ()
101103 p .set_intensity (intensity )
102104
103105 #Set zoneaxis
@@ -118,7 +120,7 @@ def ParticleAnalysis(acquisition,parameters,particles=None,mask=np.zeros((1))):
118120
119121 if isinstance (acquisition ,list ):
120122 p .spectrum = {}
121- for ac in acquisition :
123+ for ac in acquisition [ 1 :] :
122124 if ac .metadata .Signal .signal_type == 'EDS_TEM' :
123125 ac .set_elements (parameters .eds ['elements' ])
124126 ac .add_lines ()
@@ -128,7 +130,6 @@ def ParticleAnalysis(acquisition,parameters,particles=None,mask=np.zeros((1))):
128130 if parameters .eds ["factors" ]!= False :
129131 get_composition (p ,parameters )
130132 elif ac .metadata .Signal .signal_type == 'EELS' :
131- ac .add_elements (parameters .eds ['elements' ])
132133 if 'high-loss' in ac .metadata .General .title :
133134 store_spectrum (p ,ac ,'EELS-HL' )
134135 elif 'low-loss' in ac .metadata .General .title :
0 commit comments