Add a function to show segmented particle images/masks as montage#51
Add a function to show segmented particle images/masks as montage#51YichiWang wants to merge 28 commits intoePSIC-DLS:masterfrom
Conversation
This reverts commit 6ec6344.
Set default store_im to ture to store segmented particles after call ps.ParticleAnalysis
eg. particles.show(). The displayed particles were normalize_boxing. Next step should enable option to display all particle images without normalize_boxing
This reverts commit 67ddc5b.
Allow segmented particle images output as a list of 2D numpy arrays (without hyperspy metadata). e.g. particles = ps.ParticleAnalysis(image, params) particles.normalize_boxing() pim_ls = particles.show(output=True)
This reverts commit ed2a093.
This reverts commit 1924709.
e.g.
particle_list.show('mask')
or particle_list.show('Image')
Codecov Report
@@ Coverage Diff @@
## master #51 +/- ##
==========================================
- Coverage 80.99% 78.32% -2.67%
==========================================
Files 13 13
Lines 784 812 +28
==========================================
+ Hits 635 636 +1
- Misses 149 176 +27
|
Allow show segmented particles in a montage with adjustable number of columns. e.g. particle_list.show(cols=1). Default montage try to display all particles into a square arrangement.
Plus correct particle only image 'p_im'
…lculating image intensity default is True, i.e. perform background subtraction
Default is perform background subtraction for intensity calculation and for stored particle image.
With particle.store['pad']=None and particle.store['store_im']=True, the saved particle image is masked from original survey image and have save dimension as survey image and saved mask.
Main: Use np.ma.masked_array to mask particle image, so intensity std do not calculate the background area. Others: 1. all intensity are background subtracted intensity. 2. Background value are saved as property.
|
This has broken things for me. The first particle has an image stored correctly but all others just have zeros. I'm not sure I follow all of your changes in terms of the background subtraction and the boxing/padding. Are you sure this is all correct? |
Few more functions. This is a standalone script and not merged with ParticleSpy yet. -find boundary pixel in a clock-wise seqeunce -calculate boundary curvature (signed) use least squre circle fit. -average boundary curvature by given angle interval so at same direction boundary curvatures of two particle with different size (i.e. different boundary pixels) are comparable. Normalised boundary curvature by particle's equivalent diameter is not implemented yet.
This reverts commit e19dbd8.
This reverts commit 1436108.
| pad = params.store['pad'] | ||
|
|
||
| if params.store['bkg_sub']==True: | ||
| image.data = image.data - particle.properties['background']['value'] |
There was a problem hiding this comment.
This will change the image out of the function and so will subtract the value every loop.
|
|
||
| if params.store['p_only']==True: | ||
| image = image*particle.mask | ||
| image.data = image.data*particle.mask |
There was a problem hiding this comment.
This will change the image outside of the function and so results in everything other than the first particle being zero.
| p_boxed = image.isig[(box_y_min):(box_y_max),(box_x_min):(box_x_max)] | ||
| else: | ||
| p_boxed = image.isig[(box_y_min):(box_y_max),(box_x_min):(box_x_max)] | ||
| p_boxed = image |
There was a problem hiding this comment.
I'm not sure why you've changed this. This will store the full image and not just the particle.
Plus some .pyc cache files and parameter.h5 file were manually chosen to be ignored because they cannot be ignored automatically on my PC.