CompactionAnalyzer 1.0.4__tar.gz → 1.0.5__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.4 → compactionanalyzer-1.0.5}/CompactionAnalyzer/CompactionFunctions.py +36 -40
- {compactionanalyzer-1.0.4 → compactionanalyzer-1.0.5}/CompactionAnalyzer.egg-info/PKG-INFO +1 -1
- {compactionanalyzer-1.0.4 → compactionanalyzer-1.0.5}/PKG-INFO +1 -1
- {compactionanalyzer-1.0.4 → compactionanalyzer-1.0.5}/README.md +4 -3
- {compactionanalyzer-1.0.4 → compactionanalyzer-1.0.5}/setup.py +1 -1
- {compactionanalyzer-1.0.4 → compactionanalyzer-1.0.5}/CompactionAnalyzer/GUI_old_use_saenopy_instead.py +0 -0
- {compactionanalyzer-1.0.4 → compactionanalyzer-1.0.5}/CompactionAnalyzer/QExtendedGraphicsView.py +0 -0
- {compactionanalyzer-1.0.4 → compactionanalyzer-1.0.5}/CompactionAnalyzer/QtShortCuts.py +0 -0
- {compactionanalyzer-1.0.4 → compactionanalyzer-1.0.5}/CompactionAnalyzer/StructureTensor.py +0 -0
- {compactionanalyzer-1.0.4 → compactionanalyzer-1.0.5}/CompactionAnalyzer/__init__.py +0 -0
- {compactionanalyzer-1.0.4 → compactionanalyzer-1.0.5}/CompactionAnalyzer/plotting.py +0 -0
- {compactionanalyzer-1.0.4 → compactionanalyzer-1.0.5}/CompactionAnalyzer/utilities.py +0 -0
- {compactionanalyzer-1.0.4 → compactionanalyzer-1.0.5}/CompactionAnalyzer.egg-info/SOURCES.txt +0 -0
- {compactionanalyzer-1.0.4 → compactionanalyzer-1.0.5}/CompactionAnalyzer.egg-info/dependency_links.txt +0 -0
- {compactionanalyzer-1.0.4 → compactionanalyzer-1.0.5}/CompactionAnalyzer.egg-info/requires.txt +0 -0
- {compactionanalyzer-1.0.4 → compactionanalyzer-1.0.5}/CompactionAnalyzer.egg-info/top_level.txt +0 -0
- {compactionanalyzer-1.0.4 → compactionanalyzer-1.0.5}/LICENSE +0 -0
- {compactionanalyzer-1.0.4 → compactionanalyzer-1.0.5}/setup.cfg +0 -0
{compactionanalyzer-1.0.4 → compactionanalyzer-1.0.5}/CompactionAnalyzer/CompactionFunctions.py
RENAMED
|
@@ -146,7 +146,10 @@ def segment_cell(img, thres=1, seg_gaus1 = 0.5, seg_gaus2=100, seg_iter=1,show_s
|
|
|
146
146
|
height = img.shape[0]
|
|
147
147
|
width = img.shape[1]
|
|
148
148
|
|
|
149
|
-
|
|
149
|
+
## if 3 channels convert to grey
|
|
150
|
+
if len(img.shape) == 3 :
|
|
151
|
+
img = color.rgb2gray(img)
|
|
152
|
+
|
|
150
153
|
# local gaussian (or single gaussian if gaus2 == None)
|
|
151
154
|
if seg_gaus2 is not None:
|
|
152
155
|
img = np.abs(gaussian(img, sigma=seg_gaus1) - gaussian(img, sigma=seg_gaus2))
|
|
@@ -257,7 +260,8 @@ def StuctureAnalysisMain(fiber_list,
|
|
|
257
260
|
manual_segmention = False , # segmentation of mask by manual clicking the cell outline
|
|
258
261
|
plotting = True , # creates and saves individual figures additionally to the excel files
|
|
259
262
|
dpi = 200 , # resolution of figures
|
|
260
|
-
SaveNumpy =
|
|
263
|
+
SaveNumpy = True , # saves numpy arrays for later analysis
|
|
264
|
+
SaveExcel = True , # saves Excel files for later analysis
|
|
261
265
|
norm1=1,norm2 = 99 , # contrast spreading for input images between norm1- and norm2-percentile; values below norm1-percentile are set to zero and
|
|
262
266
|
# values above norm2-percentile are set to 1
|
|
263
267
|
### use norm1= 0,norm2 = 100 if no contras enhancement desired
|
|
@@ -267,7 +271,13 @@ def StuctureAnalysisMain(fiber_list,
|
|
|
267
271
|
segmention_min_area = 1000, # small bjects below this px-area are removed during cell segmentation
|
|
268
272
|
load_segmentation = False, # if True enter the path of the segementation.npy - file in path_seg
|
|
269
273
|
path_seg = None, # to load a mask
|
|
270
|
-
ignore_cell_outline=False
|
|
274
|
+
ignore_cell_outline=False, # if True the cell area is not set to nan and orientation are calculted everywhere - still the cell center is calculated from segmention
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
mode_saenopy=False): # only used for the Saenopy Version to return data files directly after single run
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
|
|
271
281
|
"""
|
|
272
282
|
Main analysis
|
|
273
283
|
|
|
@@ -488,7 +498,8 @@ def StuctureAnalysisMain(fiber_list,
|
|
|
488
498
|
results_total['Orientation (weighted by intensity and coherency)'].append(cos_dev_total3)
|
|
489
499
|
|
|
490
500
|
excel_total = pd.DataFrame.from_dict(results_total)
|
|
491
|
-
|
|
501
|
+
if SaveExcel:
|
|
502
|
+
excel_total.to_excel(os.path.join(out_list[n],"results_total.xlsx"))
|
|
492
503
|
|
|
493
504
|
|
|
494
505
|
"""
|
|
@@ -543,14 +554,18 @@ def StuctureAnalysisMain(fiber_list,
|
|
|
543
554
|
|
|
544
555
|
# create excel sheet with results for angle analysis
|
|
545
556
|
excel_angles= pd.DataFrame.from_dict(results_angle)
|
|
546
|
-
|
|
547
|
-
|
|
557
|
+
if SaveExcel:
|
|
558
|
+
excel_angles.to_excel(os.path.join(out_list[n],"results_angles.xlsx"))
|
|
548
559
|
|
|
560
|
+
|
|
549
561
|
"""
|
|
550
562
|
Distance Evaluation
|
|
551
563
|
"""
|
|
552
564
|
|
|
553
|
-
|
|
565
|
+
|
|
566
|
+
# def distance_analysis(shells,shell_width,dist_surface,scale,angle_dev, ori, orientation_dev, weight_image,im_fiber_g):
|
|
567
|
+
|
|
568
|
+
# initialize result dictionary
|
|
554
569
|
results_distance = {'Shell_mid (px)': [], 'Shell_mid (µm)': [], 'Intensity (accumulated)': [],
|
|
555
570
|
'Intensity (individual)': [], 'Intensity Norm (individual)': [],
|
|
556
571
|
'Intensity Norm (accumulated)': [], 'Angle (accumulated)': [], 'Angle (individual)': [], 'Angle (individual-weightInt)': [],
|
|
@@ -562,7 +577,7 @@ def StuctureAnalysisMain(fiber_list,
|
|
|
562
577
|
'Angle disttocenter (accumulated)': [], 'Angle disttocenter (individual)': [],
|
|
563
578
|
'Orientation disttocenter (accumulated)': [], 'Orientation disttocenter (individual)': [],
|
|
564
579
|
'Angle disttocenter (individual)': []
|
|
565
|
-
|
|
580
|
+
}
|
|
566
581
|
|
|
567
582
|
mask_shells = {'Mask_shell': [], 'Mask_shell_center': [] }
|
|
568
583
|
# shell distances
|
|
@@ -595,7 +610,7 @@ def StuctureAnalysisMain(fiber_list,
|
|
|
595
610
|
results_distance['Orientation (individual-weightInt)'].append(np.nanmean(orientation_dev[mask_shell]*ori[mask_shell]*weight_image[mask_shell]/np.nanmean(ori[mask_shell]*weight_image[mask_shell]) ))
|
|
596
611
|
|
|
597
612
|
|
|
598
|
-
|
|
613
|
+
# mean intensity
|
|
599
614
|
results_distance['Intensity (accumulated)'].append(np.nanmean(im_fiber_g[mask_shell_lower])) # accumulation of lower shells
|
|
600
615
|
results_distance['Intensity (individual)'].append(np.nanmean(im_fiber_g[mask_shell]) ) # exclusively in certain shell
|
|
601
616
|
|
|
@@ -629,7 +644,8 @@ def StuctureAnalysisMain(fiber_list,
|
|
|
629
644
|
results_distance['Intensity Norm disttocenter (accumulated)'].extend(list(norm_accum_int_c) )
|
|
630
645
|
# create excel sheet with results for angle analysis
|
|
631
646
|
excel_distance = pd.DataFrame.from_dict(results_distance)
|
|
632
|
-
|
|
647
|
+
if SaveExcel:
|
|
648
|
+
excel_distance.to_excel(os.path.join(out_list[n],"results_distance.xlsx"))
|
|
633
649
|
|
|
634
650
|
|
|
635
651
|
|
|
@@ -658,11 +674,11 @@ def StuctureAnalysisMain(fiber_list,
|
|
|
658
674
|
#np.save(os.path.join(numpy_out, "mask_surface_shells.npy"),mask_shells['Mask_shell'])
|
|
659
675
|
#np.save(os.path.join(numpy_out, "mask_spherical_shells.npy"),mask_shells['Mask_shell_center'])
|
|
660
676
|
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
677
|
+
# check the shapes --> everything is the same format
|
|
678
|
+
# print(segmention["mask"][edge:-edge,edge:-edge].shape)
|
|
679
|
+
# print(orientation_dev.shape)
|
|
680
|
+
# print(normalize(im_fiber_n[edge:-edge,edge:-edge]).shape)
|
|
681
|
+
# print(angle_no_reference.shape)
|
|
666
682
|
|
|
667
683
|
|
|
668
684
|
"""
|
|
@@ -679,25 +695,7 @@ def StuctureAnalysisMain(fiber_list,
|
|
|
679
695
|
plot_angle_dev(angle_map = orientation_dev, vmin=-1,vmax=1,
|
|
680
696
|
vec0=min_evec[:,:,0] ,vec1=min_evec[:,:,1] ,coherency_map=ori,
|
|
681
697
|
path_png= os.path.join(figures,"Orientation.png"),label="Orientation",dpi=dpi,cmap="coolwarm")
|
|
682
|
-
|
|
683
|
-
# plot_angle_dev(angle_map = angle_dev, vmin=0,vmax=90,
|
|
684
|
-
# vec0=min_evec[:,:,0] ,vec1=min_evec[:,:,1] ,coherency_map=ori,
|
|
685
|
-
# path_png= os.path.join(figures,"Angle_deviation.png"),label="Angle Deviation",dpi=dpi,cmap="viridis_r")
|
|
686
|
-
|
|
687
|
-
# # do not show the weighted ones here, as only the mean has the same range again and here angles can be smaller/large
|
|
688
|
-
# plot_angle_dev(angle_map = angle_dev_weighted2,
|
|
689
|
-
# vec0=min_evec[:,:,0] ,vec1=min_evec[:,:,1] ,coherency_map=ori,
|
|
690
|
-
# path_png= os.path.join(figures,"Angle_deviation_weighted.png"),label="Angle Deviation",dpi=dpi,cmap="viridis_r")
|
|
691
|
-
# plot_angle_dev(angle_map = orientation_dev_weighted2 ,
|
|
692
|
-
# vec0=min_evec[:,:,0] ,vec1=min_evec[:,:,1] ,coherency_map=ori,
|
|
693
|
-
# path_png= os.path.join(figures,"Orientation_weighted.png"),label="Orientation",dpi=dpi,cmap="viridis")
|
|
694
|
-
|
|
695
|
-
# # pure coherency and pure orientation
|
|
696
|
-
# plot_coherency(ori,path_png= os.path.join(figures,"coherency_noquiver.png"),
|
|
697
|
-
# label="Coherency",vmin=0,vmax=1,cmap="turbo",dpi=dpi)
|
|
698
|
-
# plot_coherency(orientation_dev,
|
|
699
|
-
# path_png= os.path.join(figures,"Orientation_noquiver.png"),
|
|
700
|
-
# label="Orientation",vmin=-1,vmax=1,cmap="coolwarm",dpi=dpi)
|
|
698
|
+
|
|
701
699
|
|
|
702
700
|
|
|
703
701
|
if cell_list == None:
|
|
@@ -723,8 +721,6 @@ def StuctureAnalysisMain(fiber_list,
|
|
|
723
721
|
orientation_dev, cmap_angle="coolwarm",
|
|
724
722
|
path_png= os.path.join(figures,"Orientation_overlay.png"),
|
|
725
723
|
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
724
|
omin=-1, omax=1,scale=scale)
|
|
729
725
|
|
|
730
726
|
else:
|
|
@@ -768,7 +764,6 @@ def StuctureAnalysisMain(fiber_list,
|
|
|
768
764
|
|
|
769
765
|
|
|
770
766
|
plt.close("all")
|
|
771
|
-
|
|
772
767
|
|
|
773
768
|
# Polar plots
|
|
774
769
|
plot_polar(results_angle['Angles Plotting'], results_angle['Coherency (weighted by intensity)'],
|
|
@@ -804,7 +799,6 @@ def StuctureAnalysisMain(fiber_list,
|
|
|
804
799
|
path_png=os.path.join(figures,"fiber_structure.png"),dpi=dpi ,scale=scale)
|
|
805
800
|
|
|
806
801
|
|
|
807
|
-
|
|
808
802
|
plt.close("all")
|
|
809
803
|
### DISTANCE PLOTS
|
|
810
804
|
# plot shells - deactived as it consumes a lot of time
|
|
@@ -822,8 +816,10 @@ def StuctureAnalysisMain(fiber_list,
|
|
|
822
816
|
plot_cell(im_cell_n, path_png=os.path.join(figures,"cell-raw.png"), scale=scale, dpi=dpi)
|
|
823
817
|
plot_cell(normalize(im_fiber_n[edge:-edge,edge:-edge]), path_png=os.path.join(figures,"fiber-raw.png"), scale=scale, dpi=dpi)
|
|
824
818
|
|
|
825
|
-
plt.close("all")
|
|
826
|
-
|
|
819
|
+
plt.close("all")
|
|
820
|
+
|
|
821
|
+
if mode_saenopy == True: # only evaluates a single item at each call and returns the arrays
|
|
822
|
+
return angle_no_reference, orientation_dev, ori, min_evec, excel_total, excel_angles, excel_distance
|
|
827
823
|
return
|
|
828
824
|
|
|
829
825
|
|
|
@@ -16,7 +16,7 @@ Python package to quantify the tissue compaction (as a measure of the contractil
|
|
|
16
16
|
* Evaluating the directionality of fibers towards the cell center.
|
|
17
17
|
* Evaluating the increased fiber intensity around the cell.
|
|
18
18
|
|
|
19
|
-
Further, the package can be used to evaluate the strength of allignment (coherency) regardless of the allignment direction, or the allignment orientation towards the x-axis (instead of the cell center). For this, see the point "Save
|
|
19
|
+
Further, the package can be used to evaluate the strength of allignment (coherency) regardless of the allignment direction, or the allignment orientation towards the x-axis (instead of the cell center). For this, see the point "Save Numpy Files" below.
|
|
20
20
|
|
|
21
21
|
<img src="../master//docs/images/Fig1-rawtostructure.png" width="1000" />
|
|
22
22
|
|
|
@@ -47,7 +47,7 @@ CompactionAnalyzer is included within the [saenopy package](https://github.com/r
|
|
|
47
47
|
|
|
48
48
|
|
|
49
49
|
|
|
50
|
-
##
|
|
50
|
+
## Read More
|
|
51
51
|
If you'd like to learn more about the mehtod, have a look at our paper:
|
|
52
52
|
|
|
53
53
|
*Böhringer D, Bauer A, Moravec I, Bischof L, Kah D, Mark C, Grundy TJ, Görlach E, O'Neill GM, Budday S, Strissel PL, Strick R, Malandrino A, Gerum R, Mak M, Rausch M, Fabry B*. **Fiber alignment in 3D collagen networks as a biophysical marker for cell contractility**. Matrix Biology (2023). [doi: 10.1016/j.matbio.2023.11.004](https://www.sciencedirect.com/science/article/pii/S0945053X23001166?via%3Dihub)
|
|
@@ -109,6 +109,7 @@ segmention_method="otsu" # use "otsu", "entropy" or "yen" as segmentatio
|
|
|
109
109
|
segmention_min_area = 1000 # small bjects below this px-area are removed during cell segmentation
|
|
110
110
|
load_segmentation = False # if True enter the path of the segementation.npy - file in path_seg
|
|
111
111
|
path_seg = None # to load a mask
|
|
112
|
+
ignore_cell_outline= False # if True also values at the cell-occupied areas are included in the analysis
|
|
112
113
|
```
|
|
113
114
|
|
|
114
115
|
|
|
@@ -152,7 +153,7 @@ We receive a compromised excel sheet that returns the global analysis for all ce
|
|
|
152
153
|
|
|
153
154
|
<img src="../master/docs/images/Fig3-combineexcel.png" width="800" />
|
|
154
155
|
|
|
155
|
-
##
|
|
156
|
+
## Save Numpy Files
|
|
156
157
|
|
|
157
158
|
If you want to save the angle or coherency maps for different kind of analysis, you can specify the parameter `SaveNumpy = True`.
|
|
158
159
|
Each output folder will then contain among other properties the following npy-files:
|
|
@@ -4,7 +4,7 @@ from setuptools import setup
|
|
|
4
4
|
setup(
|
|
5
5
|
name='CompactionAnalyzer',
|
|
6
6
|
packages=['CompactionAnalyzer'],
|
|
7
|
-
version='1.0.
|
|
7
|
+
version='1.0.5',
|
|
8
8
|
description='A python package to analyze matrix fiber alignment around cells (proxy for cellular forces)',
|
|
9
9
|
url='',
|
|
10
10
|
download_url = '',
|
|
File without changes
|
{compactionanalyzer-1.0.4 → compactionanalyzer-1.0.5}/CompactionAnalyzer/QExtendedGraphicsView.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{compactionanalyzer-1.0.4 → compactionanalyzer-1.0.5}/CompactionAnalyzer.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{compactionanalyzer-1.0.4 → compactionanalyzer-1.0.5}/CompactionAnalyzer.egg-info/requires.txt
RENAMED
|
File without changes
|
{compactionanalyzer-1.0.4 → compactionanalyzer-1.0.5}/CompactionAnalyzer.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|