CompactionAnalyzer 1.0.3__tar.gz → 1.0.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {compactionanalyzer-1.0.3 → compactionanalyzer-1.0.4}/CompactionAnalyzer/CompactionFunctions.py +140 -84
- {compactionanalyzer-1.0.3 → compactionanalyzer-1.0.4}/CompactionAnalyzer/plotting.py +9 -6
- {compactionanalyzer-1.0.3 → compactionanalyzer-1.0.4}/CompactionAnalyzer/utilities.py +7 -5
- {compactionanalyzer-1.0.3 → compactionanalyzer-1.0.4}/CompactionAnalyzer.egg-info/PKG-INFO +2 -2
- {compactionanalyzer-1.0.3 → compactionanalyzer-1.0.4}/PKG-INFO +2 -2
- {compactionanalyzer-1.0.3 → compactionanalyzer-1.0.4}/README.md +14 -2
- {compactionanalyzer-1.0.3 → compactionanalyzer-1.0.4}/setup.py +2 -2
- {compactionanalyzer-1.0.3 → compactionanalyzer-1.0.4}/CompactionAnalyzer/GUI_old_use_saenopy_instead.py +0 -0
- {compactionanalyzer-1.0.3 → compactionanalyzer-1.0.4}/CompactionAnalyzer/QExtendedGraphicsView.py +0 -0
- {compactionanalyzer-1.0.3 → compactionanalyzer-1.0.4}/CompactionAnalyzer/QtShortCuts.py +0 -0
- {compactionanalyzer-1.0.3 → compactionanalyzer-1.0.4}/CompactionAnalyzer/StructureTensor.py +0 -0
- {compactionanalyzer-1.0.3 → compactionanalyzer-1.0.4}/CompactionAnalyzer/__init__.py +0 -0
- {compactionanalyzer-1.0.3 → compactionanalyzer-1.0.4}/CompactionAnalyzer.egg-info/SOURCES.txt +0 -0
- {compactionanalyzer-1.0.3 → compactionanalyzer-1.0.4}/CompactionAnalyzer.egg-info/dependency_links.txt +0 -0
- {compactionanalyzer-1.0.3 → compactionanalyzer-1.0.4}/CompactionAnalyzer.egg-info/requires.txt +0 -0
- {compactionanalyzer-1.0.3 → compactionanalyzer-1.0.4}/CompactionAnalyzer.egg-info/top_level.txt +0 -0
- {compactionanalyzer-1.0.3 → compactionanalyzer-1.0.4}/LICENSE +0 -0
- {compactionanalyzer-1.0.3 → compactionanalyzer-1.0.4}/setup.cfg +0 -0
{compactionanalyzer-1.0.3 → compactionanalyzer-1.0.4}/CompactionAnalyzer/CompactionFunctions.py
RENAMED
|
@@ -217,6 +217,24 @@ def segment_cell(img, thres=1, seg_gaus1 = 0.5, seg_gaus2=100, seg_iter=1,show_s
|
|
|
217
217
|
return {'mask': mask, 'radius': radius, 'centroid': (cx, cy)}
|
|
218
218
|
|
|
219
219
|
|
|
220
|
+
def create_centered_circle(image_shape):
|
|
221
|
+
# Extract the height and width of the image
|
|
222
|
+
height, width = image_shape[:2]
|
|
223
|
+
# Calculate the center of the image
|
|
224
|
+
center_y, center_x = height // 2, width // 2
|
|
225
|
+
# Calculate the radius of the circle (1/4 of the image height or width)
|
|
226
|
+
radius = min(height, width) // 10
|
|
227
|
+
# Create a 2D array of zeros (background)
|
|
228
|
+
circle_array = np.zeros((height, width), dtype=int)
|
|
229
|
+
# Iterate over each point in the 2D array
|
|
230
|
+
for y in range(height):
|
|
231
|
+
for x in range(width):
|
|
232
|
+
# Calculate the distance from the center
|
|
233
|
+
distance = np.sqrt((y - center_y) ** 2 + (x - center_x) ** 2)
|
|
234
|
+
# If the distance is less than or equal to the radius, set it to 1 (circle)
|
|
235
|
+
if distance <= radius:
|
|
236
|
+
circle_array[y, x] = 1
|
|
237
|
+
return circle_array
|
|
220
238
|
|
|
221
239
|
|
|
222
240
|
def StuctureAnalysisMain(fiber_list,
|
|
@@ -264,8 +282,16 @@ def StuctureAnalysisMain(fiber_list,
|
|
|
264
282
|
None.
|
|
265
283
|
|
|
266
284
|
"""
|
|
267
|
-
plt.ioff()
|
|
268
|
-
|
|
285
|
+
# plt.ioff()
|
|
286
|
+
# plt.ion()
|
|
287
|
+
|
|
288
|
+
# if no cell images are specified we conduct the analyis on the full image
|
|
289
|
+
# for this, we create dummy images of an artificial cell and set ignore_cell_outline to True
|
|
290
|
+
# Might be usefull to look at quantities such as fiber coherency or angle towards x-axis
|
|
291
|
+
if cell_list == None:
|
|
292
|
+
ignore_cell_outline= True
|
|
293
|
+
dummy_cell = create_centered_circle(imageio.v2.imread(fiber_list[0]).shape)
|
|
294
|
+
|
|
269
295
|
|
|
270
296
|
# if not specified use 7um for tensor analysis and 5um shells
|
|
271
297
|
if not sigma_tensor:
|
|
@@ -300,17 +326,21 @@ def StuctureAnalysisMain(fiber_list,
|
|
|
300
326
|
}
|
|
301
327
|
with open(os.path.join(out_list[n],"parameters.yml"), 'w') as yaml_file:
|
|
302
328
|
yaml.dump(dict_file, yaml_file, default_flow_style=False)
|
|
303
|
-
|
|
304
329
|
|
|
305
|
-
# load images
|
|
306
|
-
|
|
307
|
-
|
|
330
|
+
# load images
|
|
331
|
+
im_fiber = imageio.v2.imread(fiber_list[n]) #color.rgb2gray()
|
|
332
|
+
if cell_list == None:
|
|
333
|
+
im_cell = dummy_cell
|
|
334
|
+
else:
|
|
335
|
+
im_cell = imageio.v2.imread(cell_list[n])
|
|
336
|
+
|
|
308
337
|
|
|
309
338
|
## if 3 channels convert to grey
|
|
310
|
-
if len(im_cell.shape) == 3 :
|
|
339
|
+
if len(im_cell.shape) == 3 :
|
|
311
340
|
im_cell = color.rgb2gray(im_cell)
|
|
312
341
|
if len(im_fiber.shape) == 3 :
|
|
313
|
-
im_fiber = color.rgb2gray(im_fiber)
|
|
342
|
+
im_fiber = color.rgb2gray(im_fiber)
|
|
343
|
+
|
|
314
344
|
|
|
315
345
|
# # applying normalizing/ contrast spreading
|
|
316
346
|
im_cell_n = normalize(im_cell, norm1, norm2)
|
|
@@ -370,8 +400,8 @@ def StuctureAnalysisMain(fiber_list,
|
|
|
370
400
|
dy_norm = (dy/distance)
|
|
371
401
|
dist_surface = distance_transform_edt(~segmention["mask"])[edge:-edge,edge:-edge] # dist to surface
|
|
372
402
|
# calculate an angle without the deviation/reference to the cell position
|
|
373
|
-
angle_no_reference = np.arctan2(min_evec[:,:,0],min_evec[:,:,1])*360/(2*np.pi)
|
|
374
|
-
|
|
403
|
+
angle_no_reference = np.abs(np.arctan2(min_evec[:,:,0],min_evec[:,:,1])*360/(2*np.pi))-90 # -90 to +90° towards x-axis
|
|
404
|
+
|
|
375
405
|
|
|
376
406
|
"""
|
|
377
407
|
total image analysis
|
|
@@ -609,8 +639,9 @@ def StuctureAnalysisMain(fiber_list,
|
|
|
609
639
|
print (numpy_out)
|
|
610
640
|
if not os.path.exists(numpy_out):
|
|
611
641
|
os.makedirs(numpy_out)
|
|
612
|
-
|
|
613
|
-
|
|
642
|
+
# save data array all with the size of the evaluated arrays
|
|
643
|
+
# that are "edge" - pixels smaller to get rid of boundary artefacts
|
|
644
|
+
np.save(os.path.join(numpy_out, "segmention.npy" ),segmention["mask"][edge:-edge,edge:-edge])
|
|
614
645
|
np.save(os.path.join(numpy_out, "AngleDeviationMap.npy" ),angle_dev )
|
|
615
646
|
#np.save(os.path.join(numpy_out, "AngleMap(weight_int).npy" ),angle_dev_weighted)
|
|
616
647
|
np.save(os.path.join(numpy_out, "AngleDeviationMap(weight_int_coh).npy"),angle_dev_weighted2 )
|
|
@@ -623,8 +654,15 @@ def StuctureAnalysisMain(fiber_list,
|
|
|
623
654
|
#np.save(os.path.join(numpy_out, "CoherencyMap(weighted_int).npy" ),ori_weight2)
|
|
624
655
|
np.save(os.path.join(numpy_out, "Vector_min_ax0.npy"),min_evec[:,:,0])
|
|
625
656
|
np.save(os.path.join(numpy_out, "Vector_min_ax1.npy"),min_evec[:,:,1])
|
|
657
|
+
np.save(os.path.join(numpy_out, "center.npy"),center_small)
|
|
626
658
|
#np.save(os.path.join(numpy_out, "mask_surface_shells.npy"),mask_shells['Mask_shell'])
|
|
627
659
|
#np.save(os.path.join(numpy_out, "mask_spherical_shells.npy"),mask_shells['Mask_shell_center'])
|
|
660
|
+
|
|
661
|
+
# check the shapes --> everything is the same format
|
|
662
|
+
# print(segmention["mask"][edge:-edge,edge:-edge].shape)
|
|
663
|
+
# print(orientation_dev.shape)
|
|
664
|
+
# print(normalize(im_fiber_n[edge:-edge,edge:-edge]).shape)
|
|
665
|
+
# print(angle_no_reference.shape)
|
|
628
666
|
|
|
629
667
|
|
|
630
668
|
"""
|
|
@@ -661,46 +699,74 @@ def StuctureAnalysisMain(fiber_list,
|
|
|
661
699
|
# path_png= os.path.join(figures,"Orientation_noquiver.png"),
|
|
662
700
|
# label="Orientation",vmin=-1,vmax=1,cmap="coolwarm",dpi=dpi)
|
|
663
701
|
|
|
702
|
+
|
|
703
|
+
if cell_list == None:
|
|
704
|
+
plot_fancy_overlay(im_fiber_n[edge:-edge,edge:-edge],
|
|
705
|
+
None,
|
|
706
|
+
angle_no_reference, cmap_angle="gist_rainbow",
|
|
707
|
+
path_png= os.path.join(figures,"Angle_NoReference_overlay_nocell.png"),
|
|
708
|
+
label="Angle (x-axis)",dpi=dpi,
|
|
709
|
+
# ,cmap_cell="Greys_r",cmap_fiber="Greys_r", ### use default values here
|
|
710
|
+
# cmap_angle="viridis", alpha_ori =0.8, alpha_cell = 0.4, alpha_fiber = 0.4,
|
|
711
|
+
omin=-90, omax=90,
|
|
712
|
+
scale=scale)
|
|
713
|
+
plot_fancy_overlay(im_fiber_n[edge:-edge,edge:-edge],
|
|
714
|
+
None,
|
|
715
|
+
ori, cmap_angle="turbo",
|
|
716
|
+
path_png= os.path.join(figures,"Coherency_overlay_nocell.png"),
|
|
717
|
+
label="Coherency",dpi=dpi,
|
|
718
|
+
# ,cmap_cell="Greys_r",cmap_fiber="Greys_r", ### use default values here
|
|
719
|
+
# cmap_angle="viridis", alpha_ori =0.8, alpha_cell = 0.4, alpha_fiber = 0.4,
|
|
720
|
+
omin=0, omax=1,scale=scale)
|
|
721
|
+
plot_fancy_overlay(im_fiber_n[edge:-edge,edge:-edge],
|
|
722
|
+
im_cell_n[edge:-edge,edge:-edge],
|
|
723
|
+
orientation_dev, cmap_angle="coolwarm",
|
|
724
|
+
path_png= os.path.join(figures,"Orientation_overlay.png"),
|
|
725
|
+
label="Orientation",dpi=dpi,
|
|
726
|
+
# ,cmap_cell="Greys_r",cmap_fiber="Greys_r", ### use default values here
|
|
727
|
+
# cmap_angle="viridis", alpha_ori =0.8, alpha_cell = 0.4, alpha_fiber = 0.4,
|
|
728
|
+
omin=-1, omax=1,scale=scale)
|
|
664
729
|
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
730
|
+
else:
|
|
731
|
+
### more fancy overlay plot of cell & fiber & orientation (notweighted)
|
|
732
|
+
plot_fancy_overlay(im_fiber_n[edge:-edge,edge:-edge],
|
|
733
|
+
im_cell_n[edge:-edge,edge:-edge],
|
|
734
|
+
orientation_dev, cmap_angle="coolwarm",
|
|
735
|
+
path_png= os.path.join(figures,"Orientation_overlay.png"),
|
|
736
|
+
label="Orientation",dpi=dpi,
|
|
737
|
+
# ,cmap_cell="Greys_r",cmap_fiber="Greys_r", ### use default values here
|
|
738
|
+
# cmap_angle="viridis", alpha_ori =0.8, alpha_cell = 0.4, alpha_fiber = 0.4,
|
|
739
|
+
omin=-1, omax=1,scale=scale)
|
|
740
|
+
|
|
741
|
+
plot_fancy_overlay(im_fiber_n[edge:-edge,edge:-edge],
|
|
742
|
+
im_cell_n[edge:-edge,edge:-edge],
|
|
743
|
+
ori, cmap_angle="turbo",
|
|
744
|
+
path_png= os.path.join(figures,"Coherency_overlay.png"),
|
|
745
|
+
label="Coherency",dpi=dpi,
|
|
746
|
+
# ,cmap_cell="Greys_r",cmap_fiber="Greys_r", ### use default values here
|
|
747
|
+
# cmap_angle="viridis", alpha_ori =0.8, alpha_cell = 0.4, alpha_fiber = 0.4,
|
|
748
|
+
omin=0, omax=1,scale=scale)
|
|
749
|
+
|
|
750
|
+
plot_fancy_overlay(im_fiber_n[edge:-edge,edge:-edge],
|
|
751
|
+
im_cell_n[edge:-edge,edge:-edge],
|
|
752
|
+
angle_dev, cmap_angle="viridis_r",
|
|
753
|
+
path_png= os.path.join(figures,"Angle_Deviation_overlay.png"),
|
|
754
|
+
label="Angle Deviation",dpi=dpi,
|
|
755
|
+
# ,cmap_cell="Greys_r",cmap_fiber="Greys_r", ### use default values here
|
|
756
|
+
# cmap_angle="viridis", alpha_ori =0.8, alpha_cell = 0.4, alpha_fiber = 0.4,
|
|
757
|
+
omin=0, omax=90,scale=scale)
|
|
758
|
+
|
|
759
|
+
plot_fancy_overlay(im_fiber_n[edge:-edge,edge:-edge],
|
|
760
|
+
im_cell_n[edge:-edge,edge:-edge],
|
|
761
|
+
angle_no_reference, cmap_angle="gist_rainbow",
|
|
762
|
+
path_png= os.path.join(figures,"Angle_NoReference_overlay.png"),
|
|
763
|
+
label="Angle (x-axis)",dpi=dpi,
|
|
764
|
+
# ,cmap_cell="Greys_r",cmap_fiber="Greys_r", ### use default values here
|
|
765
|
+
# cmap_angle="viridis", alpha_ori =0.8, alpha_cell = 0.4, alpha_fiber = 0.4,
|
|
766
|
+
omin=-90, omax=90,
|
|
767
|
+
scale=scale)
|
|
768
|
+
|
|
702
769
|
|
|
703
|
-
|
|
704
770
|
plt.close("all")
|
|
705
771
|
|
|
706
772
|
|
|
@@ -713,42 +779,31 @@ def StuctureAnalysisMain(fiber_list,
|
|
|
713
779
|
path_png= os.path.join(figures,"polar_orientation_double.png"), label = "Orientation (weighted)",
|
|
714
780
|
something2 = results_angle['Orientation'], label2 = "Orientation",dpi=dpi, vmin=-1,vmax=1)
|
|
715
781
|
|
|
716
|
-
# plot_polar(results_angle['Angles Plotting'], results_angle['Coherency (weighted by intensity)'],
|
|
717
|
-
# path_png= os.path.join(figures,"polar_coherency_weighted.png"), label = "Coherency (weighted)",dpi=dpi)
|
|
718
|
-
|
|
719
|
-
# plot_polar(results_angle['Angles Plotting'], results_angle['Mean Intensity'],
|
|
720
|
-
# path_png= os.path.join(figures,"polar_intensity.png"), label = "Mean Intensity",dpi=dpi)
|
|
721
|
-
|
|
722
|
-
# plot_polar(results_angle['Angles Plotting'], results_angle['Orientation (weighted by intensity and coherency)'],
|
|
723
|
-
# path_png= os.path.join(figures,"Orientation_weighted_polar.png"), label = "Orientation",dpi=dpi)
|
|
724
|
-
|
|
725
|
-
# plot_polar(results_angle['Angles Plotting'], results_angle['Orientation'],
|
|
726
|
-
# path_png= os.path.join(figures,"Orientation_polar.png"), label = "Orientation",dpi=dpi)
|
|
727
|
-
# quiver plots with center overlay
|
|
728
|
-
# quiv_coherency_center(vec0=min_evec[:,:,0] ,vec1=min_evec[:,:,1] ,coherency_map=ori,
|
|
729
|
-
# center0=center_small[0],center1 = center_small[1],
|
|
730
|
-
# path_png= os.path.join(figures,"quiv_coherency_center.png"),dpi=dpi )
|
|
731
|
-
|
|
732
782
|
# summarizing triple plot
|
|
733
783
|
plot_triple(results_angle,results_total , path_png= os.path.join(figures,"Triple_plot.png") ,dpi=dpi)
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
784
|
+
|
|
785
|
+
if cell_list is not None:
|
|
786
|
+
|
|
787
|
+
# image fiber + segmention
|
|
788
|
+
plot_fiber_seg(fiber_image=normalize(im_fiber_n[edge:-edge,edge:-edge]) ,
|
|
789
|
+
c0=center_small[0],c1=center_small[1],
|
|
790
|
+
segmention=segmention["mask"][edge:-edge,edge:-edge],
|
|
791
|
+
path_png=os.path.join(figures,"fiber_celloutline.png"),dpi=dpi,scale=scale )
|
|
792
|
+
# plot overlaywith fiber image
|
|
793
|
+
plot_overlay(fiber_image=normalize(im_fiber_n[edge:-edge,edge:-edge]) ,
|
|
794
|
+
c0=center_small[0],c1=center_small[1], vec0=min_evec[:,:,0],
|
|
795
|
+
vec1=min_evec[:,:,1], coherency_map=ori, show_n=15,
|
|
796
|
+
segmention=segmention["mask"][edge:-edge,edge:-edge],
|
|
797
|
+
path_png=os.path.join(figures,"fiber_cell_structure.png"),dpi=dpi ,scale=scale)
|
|
798
|
+
else:
|
|
799
|
+
# plot overlaywith fiber image
|
|
800
|
+
plot_overlay(fiber_image=normalize(im_fiber_n[edge:-edge,edge:-edge]) ,
|
|
801
|
+
c0=center_small[0],c1=center_small[1], vec0=min_evec[:,:,0],
|
|
802
|
+
vec1=min_evec[:,:,1], coherency_map=ori, show_n=15,
|
|
803
|
+
segmention=None,
|
|
804
|
+
path_png=os.path.join(figures,"fiber_structure.png"),dpi=dpi ,scale=scale)
|
|
805
|
+
|
|
806
|
+
|
|
752
807
|
|
|
753
808
|
plt.close("all")
|
|
754
809
|
### DISTANCE PLOTS
|
|
@@ -765,6 +820,7 @@ def StuctureAnalysisMain(fiber_list,
|
|
|
765
820
|
|
|
766
821
|
# save raw cell image
|
|
767
822
|
plot_cell(im_cell_n, path_png=os.path.join(figures,"cell-raw.png"), scale=scale, dpi=dpi)
|
|
823
|
+
plot_cell(normalize(im_fiber_n[edge:-edge,edge:-edge]), path_png=os.path.join(figures,"fiber-raw.png"), scale=scale, dpi=dpi)
|
|
768
824
|
|
|
769
825
|
plt.close("all")
|
|
770
826
|
|
|
@@ -4,7 +4,7 @@ import matplotlib.pyplot as plt
|
|
|
4
4
|
import matplotlib
|
|
5
5
|
from matplotlib_scalebar.scalebar import ScaleBar
|
|
6
6
|
import warnings
|
|
7
|
-
matplotlib.pyplot.switch_backend("agg")
|
|
7
|
+
#matplotlib.pyplot.switch_backend("agg")
|
|
8
8
|
|
|
9
9
|
def scale_for_quiver(ar1, ar2, dims, scale_ratio=0.2, return_scale=False):
|
|
10
10
|
scale = scale_ratio * np.max(dims) / np.nanmax(np.sqrt((ar1) ** 2 + (ar2) ** 2))
|
|
@@ -161,7 +161,8 @@ def plot_fancy_overlay(fiber, cell, field,path_png,label="field",dpi=300,cmap_ce
|
|
|
161
161
|
fig =plt.figure()
|
|
162
162
|
plt.imshow(field,cmap=cmap_angle,vmin=omin,vmax=omax,alpha=alpha_ori);cbar =plt.colorbar()
|
|
163
163
|
plt.imshow(fiber, cmap=cmap_fiber,alpha=alpha_fiber)
|
|
164
|
-
|
|
164
|
+
if cell is not None:
|
|
165
|
+
plt.imshow(cell, cmap=cmap_cell,alpha=alpha_cell)
|
|
165
166
|
plt.axis('off');
|
|
166
167
|
cbar.set_label(label,fontsize=12)
|
|
167
168
|
if scale is not None:
|
|
@@ -242,7 +243,8 @@ def plot_fiber_seg(fiber_image,c0,c1,segmention, path_png,dpi=200, scale=None ):
|
|
|
242
243
|
cmap.set_over('k', alpha=1)
|
|
243
244
|
# plot mask and center
|
|
244
245
|
plt.imshow(fiber_image, origin="upper")
|
|
245
|
-
|
|
246
|
+
if segmention is not None:
|
|
247
|
+
plt.imshow(segmention, cmap=cmap, norm = my_norm, origin="upper")
|
|
246
248
|
plt.scatter(c0,c1, c= "w");plt.axis('off');
|
|
247
249
|
if scale is not None:
|
|
248
250
|
scalebar = ScaleBar(scale, "um", length_fraction=0.1, location="lower right", box_alpha=0 ,
|
|
@@ -266,8 +268,9 @@ def plot_overlay(fiber_image , c0,c1, vec0,vec1, coherency_map,
|
|
|
266
268
|
# plot mask and center
|
|
267
269
|
show_quiver (vec0 * coherency_map, vec1 * coherency_map, filter=[f, show_n],alpha=0 , scale_ratio=0.08,width=0.002, plot_cbar=False, cbar_str="coherency", cmap="viridis")
|
|
268
270
|
plt.imshow(fiber_image, origin="upper")
|
|
269
|
-
|
|
270
|
-
|
|
271
|
+
if segmention is not None:
|
|
272
|
+
plt.imshow(segmention, cmap=cmap, norm = my_norm, origin="upper", zorder=100)
|
|
273
|
+
plt.scatter(c0,c1, c= "w", zorder=200)
|
|
271
274
|
if scale is not None:
|
|
272
275
|
scalebar = ScaleBar(scale, "um", length_fraction=0.1, location="lower right", box_alpha=0 ,
|
|
273
276
|
color="k")
|
|
@@ -304,7 +307,7 @@ def plot_distance(results_distance,path_png,string_plot = "Orientation (individu
|
|
|
304
307
|
return fig
|
|
305
308
|
|
|
306
309
|
def plot_cell(im_cell_n, path_png,scale=None,dpi=200):
|
|
307
|
-
fig = plt.figure(); plt.imshow(im_cell_n);plt.axis("off"),plt.tight_layout()
|
|
310
|
+
fig = plt.figure(); plt.imshow(im_cell_n, cmap="viridis");plt.axis("off"),plt.tight_layout()
|
|
308
311
|
if scale is not None:
|
|
309
312
|
scalebar = ScaleBar(scale, "um", length_fraction=0.1, location="lower right", box_alpha=0 ,
|
|
310
313
|
color="k")
|
|
@@ -29,16 +29,18 @@ def generate_lists(fiber_list_string, cell_list_string, output_main = "Output"):
|
|
|
29
29
|
|
|
30
30
|
# read in images (must be in same order)
|
|
31
31
|
fiber_list = natsorted(glob.glob(fiber_list_string))
|
|
32
|
-
|
|
32
|
+
if cell_list_string is not None:
|
|
33
|
+
cell_list = natsorted(glob.glob(cell_list_string)) #check that order is same to fiber
|
|
34
|
+
else:
|
|
35
|
+
cell_list = None
|
|
33
36
|
# get base path (before * in glob - even works without any *)
|
|
34
|
-
base = os.path.split(
|
|
37
|
+
base = os.path.split(fiber_list_string[:fiber_list_string.find("*")])[0]
|
|
35
38
|
# get the rest of the path
|
|
36
|
-
rest_paths =[os.path.split(os.path.relpath(p, base))[0] for p in (
|
|
39
|
+
rest_paths =[os.path.split(os.path.relpath(p, base))[0] for p in (fiber_list)]
|
|
37
40
|
# get the file name
|
|
38
|
-
names = [os.path.splitext(os.path.split(p)[1])[0] for p in
|
|
41
|
+
names = [os.path.splitext(os.path.split(p)[1])[0] for p in fiber_list]
|
|
39
42
|
# put together accordingly in the output_main folder
|
|
40
43
|
out_list = [os.path.join(output_main,rest_path, name) for name, rest_path in zip(names, rest_paths)]
|
|
41
|
-
|
|
42
44
|
return fiber_list,cell_list, out_list
|
|
43
45
|
|
|
44
46
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: CompactionAnalyzer
|
|
3
|
-
Version: 1.0.
|
|
4
|
-
Summary: A
|
|
3
|
+
Version: 1.0.4
|
|
4
|
+
Summary: A python package to analyze matrix fiber alignment around cells (proxy for cellular forces)
|
|
5
5
|
Home-page:
|
|
6
6
|
Download-URL:
|
|
7
7
|
Author: David Böhringer, Andreas Bauer
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: CompactionAnalyzer
|
|
3
|
-
Version: 1.0.
|
|
4
|
-
Summary: A
|
|
3
|
+
Version: 1.0.4
|
|
4
|
+
Summary: A python package to analyze matrix fiber alignment around cells (proxy for cellular forces)
|
|
5
5
|
Home-page:
|
|
6
6
|
Download-URL:
|
|
7
7
|
Author: David Böhringer, Andreas Bauer
|
|
@@ -159,11 +159,23 @@ Each output folder will then contain among other properties the following npy-fi
|
|
|
159
159
|
|
|
160
160
|
<img src="../master//docs/images/npy-files-1.png" width="800" />
|
|
161
161
|
|
|
162
|
-
`FiberImageCrop.npy` contains the original input fiber image resized to the size of the output analysis maps. These files have (depending on the argument `edge`) less pixels because the image edges should be excluded to avoid orientation analysis artifacts (default: 15px). `OrientationMap.npy` includes the orientation to the cell center (between -1 and 1) as explained above. `CoherencyMap.npy` can be used as a measure of anisotropy or orientation strength within the image (between 0 and 1), regardless of the specific direction of the orientation. This can be advantageous when the direction varies, such as in images containing multiple cells with stained stress fibers oriented in different directions. Quantifying the average coherence of these stress fibers in the cell occupied area can still provide insight into the strength of
|
|
162
|
+
`FiberImageCrop.npy` contains the original input fiber image resized to the size of the output analysis maps. These files have (depending on the argument `edge`) less pixels because the image edges should be excluded to avoid orientation analysis artifacts (default: 15px). `OrientationMap.npy` includes the orientation to the cell center (between -1 and 1) as explained above. `CoherencyMap.npy` can be used as a measure of anisotropy or orientation strength within the image (between 0 and 1), regardless of the specific direction of the orientation. This can be advantageous when the direction varies, such as in images containing multiple cells with stained stress fibers oriented in different directions. Quantifying the average coherence of these stress fibers in the cell occupied area can still provide insight into the strength of the allignment.
|
|
163
163
|
|
|
164
164
|
<img src="../master//docs/images/npy-files-2.png" width="800" />
|
|
165
165
|
|
|
166
|
-
`AngleDeviationMap.npy` includes the deviation of the raw angles with respect to the cell center. These angles are used to calculate the orientation map
|
|
166
|
+
`AngleDeviationMap.npy` includes the deviation of the raw angles with respect to the cell center. These angles are used to calculate the orientation map. The raw angles with respect to the x-axis (but with no respect to the cell center) are included in `AngleMap_NoReference.npy` (between -90 and 90 degree). They are calculated from the structure vectory in x- and y- direction stored in `Vector_min_ax1.npy` and `Vector_min_ax0.npy`. `segmentation.npy` contains the segmented cell mask, where no analysis is performed in the normal procedure. To compute and store all these numpy fields even in places where the cell is segmented, you can use the argument `ignore_cell_outline=True` in the analysis pipeline. This will compute these maps within the entire image.
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
If you want to calculate the fiber coherency `CoherencyMap.npy` or the angle towards the x-axis `AngleMap_NoReference.npy` (between -90 and 90 degree) without an image of the cell you can start the analysis by setting `cell_list_string = None`:
|
|
170
|
+
|
|
171
|
+
```python
|
|
172
|
+
fiber_list, cell_list, out_list = generate_lists(fiber_list_string, None, output_main =output_folder)
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
This option will start the analysis without the second image pair of cell images and automatically compute all maps within the entire image using the `ignore_cell_outline=True` argument. The typical orientation map is calculated with respect to the image center.
|
|
176
|
+
|
|
177
|
+
<img src="../master//docs/images/npy-files-3.png" width="800" />
|
|
178
|
+
|
|
167
179
|
|
|
168
180
|
## Graphical User Interface (GUI)
|
|
169
181
|
|
|
@@ -4,8 +4,8 @@ from setuptools import setup
|
|
|
4
4
|
setup(
|
|
5
5
|
name='CompactionAnalyzer',
|
|
6
6
|
packages=['CompactionAnalyzer'],
|
|
7
|
-
version='1.0.
|
|
8
|
-
description='A
|
|
7
|
+
version='1.0.4',
|
|
8
|
+
description='A python package to analyze matrix fiber alignment around cells (proxy for cellular forces)',
|
|
9
9
|
url='',
|
|
10
10
|
download_url = '',
|
|
11
11
|
author='David Böhringer, Andreas Bauer',
|
|
File without changes
|
{compactionanalyzer-1.0.3 → compactionanalyzer-1.0.4}/CompactionAnalyzer/QExtendedGraphicsView.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{compactionanalyzer-1.0.3 → compactionanalyzer-1.0.4}/CompactionAnalyzer.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{compactionanalyzer-1.0.3 → compactionanalyzer-1.0.4}/CompactionAnalyzer.egg-info/requires.txt
RENAMED
|
File without changes
|
{compactionanalyzer-1.0.3 → compactionanalyzer-1.0.4}/CompactionAnalyzer.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|