CompactionAnalyzer 1.0.2__tar.gz → 1.0.7__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.2 → compactionanalyzer-1.0.7}/CompactionAnalyzer/CompactionFunctions.py +278 -173
- {CompactionAnalyzer-1.0.2 → compactionanalyzer-1.0.7}/CompactionAnalyzer/QtShortCuts.py +527 -58
- {CompactionAnalyzer-1.0.2 → compactionanalyzer-1.0.7}/CompactionAnalyzer/StructureTensor.py +4 -1
- compactionanalyzer-1.0.7/CompactionAnalyzer/__init__.py +7 -0
- {CompactionAnalyzer-1.0.2 → compactionanalyzer-1.0.7}/CompactionAnalyzer/plotting.py +40 -22
- {CompactionAnalyzer-1.0.2 → compactionanalyzer-1.0.7}/CompactionAnalyzer/utilities.py +7 -5
- compactionanalyzer-1.0.7/CompactionAnalyzer.egg-info/PKG-INFO +27 -0
- {CompactionAnalyzer-1.0.2 → compactionanalyzer-1.0.7}/CompactionAnalyzer.egg-info/SOURCES.txt +1 -1
- compactionanalyzer-1.0.7/CompactionAnalyzer.egg-info/requires.txt +10 -0
- compactionanalyzer-1.0.7/PKG-INFO +27 -0
- {CompactionAnalyzer-1.0.2 → compactionanalyzer-1.0.7}/README.md +71 -20
- {CompactionAnalyzer-1.0.2 → compactionanalyzer-1.0.7}/setup.py +8 -5
- CompactionAnalyzer-1.0.2/CompactionAnalyzer/__init__.py +0 -7
- CompactionAnalyzer-1.0.2/CompactionAnalyzer.egg-info/PKG-INFO +0 -11
- CompactionAnalyzer-1.0.2/CompactionAnalyzer.egg-info/requires.txt +0 -5
- CompactionAnalyzer-1.0.2/PKG-INFO +0 -11
- /CompactionAnalyzer-1.0.2/CompactionAnalyzer/GUI.py → /compactionanalyzer-1.0.7/CompactionAnalyzer/GUI_old_use_saenopy_instead.py +0 -0
- {CompactionAnalyzer-1.0.2 → compactionanalyzer-1.0.7}/CompactionAnalyzer/QExtendedGraphicsView.py +0 -0
- {CompactionAnalyzer-1.0.2 → compactionanalyzer-1.0.7}/CompactionAnalyzer.egg-info/dependency_links.txt +0 -0
- {CompactionAnalyzer-1.0.2 → compactionanalyzer-1.0.7}/CompactionAnalyzer.egg-info/top_level.txt +0 -0
- {CompactionAnalyzer-1.0.2 → compactionanalyzer-1.0.7}/LICENSE +0 -0
- {CompactionAnalyzer-1.0.2 → compactionanalyzer-1.0.7}/setup.cfg +0 -0
{CompactionAnalyzer-1.0.2 → compactionanalyzer-1.0.7}/CompactionAnalyzer/CompactionFunctions.py
RENAMED
|
@@ -2,12 +2,17 @@ import numpy as np
|
|
|
2
2
|
from skimage import io
|
|
3
3
|
from PIL import Image
|
|
4
4
|
from skimage.filters import gaussian, threshold_otsu, threshold_yen
|
|
5
|
-
import scipy.ndimage.morphology as scipy_morph
|
|
6
|
-
import scipy.ndimage.measurements as scipy_meas
|
|
7
5
|
from skimage.morphology import remove_small_objects
|
|
8
6
|
import imageio
|
|
9
7
|
from skimage import color
|
|
10
|
-
|
|
8
|
+
try:
|
|
9
|
+
from scipy.ndimage import distance_transform_edt
|
|
10
|
+
import scipy.ndimage as scipy_morph
|
|
11
|
+
import scipy.ndimage as scipy_meas
|
|
12
|
+
except ImportError:
|
|
13
|
+
from scipy.ndimage.morphology import distance_transform_edt
|
|
14
|
+
import scipy.ndimage.morphology as scipy_morph
|
|
15
|
+
import scipy.ndimage.measurements as scipy_meas
|
|
11
16
|
import matplotlib.pyplot as plt
|
|
12
17
|
import os
|
|
13
18
|
import pandas as pd
|
|
@@ -69,6 +74,15 @@ def custom_mask(img,show_segmentation=True):
|
|
|
69
74
|
dict: Dictionary with keys: mask, radius, centroid (x/y)
|
|
70
75
|
"""
|
|
71
76
|
from roipoly import RoiPoly
|
|
77
|
+
import matplotlib
|
|
78
|
+
|
|
79
|
+
# switch backend for roipoly
|
|
80
|
+
try:
|
|
81
|
+
mpl_backend = matplotlib.get_backend()
|
|
82
|
+
matplotlib.use('Qt5Agg')
|
|
83
|
+
except:
|
|
84
|
+
print ("Switched to Qt5Agg Backend for Roipoly")
|
|
85
|
+
|
|
72
86
|
# need to install RoiPoly package via pip to use this function
|
|
73
87
|
height = img.shape[0]
|
|
74
88
|
width = img.shape[1]
|
|
@@ -93,7 +107,15 @@ def custom_mask(img,show_segmentation=True):
|
|
|
93
107
|
# if show_segmentation:
|
|
94
108
|
# plt.figure()
|
|
95
109
|
# plt.subplot(121), plt.imshow(img)
|
|
96
|
-
# plt.subplot(122), plt.imshow(mask)
|
|
110
|
+
# plt.subplot(122), plt.imshow(mask)
|
|
111
|
+
|
|
112
|
+
# switch to original backend
|
|
113
|
+
try:
|
|
114
|
+
matplotlib.use(mpl_backend)
|
|
115
|
+
print ("Switched Back")
|
|
116
|
+
except:
|
|
117
|
+
print ("Could not switched back")
|
|
118
|
+
|
|
97
119
|
return {'mask': mask, 'radius': radius, 'centroid': (cx, cy)}
|
|
98
120
|
|
|
99
121
|
def regional_maxima(img):
|
|
@@ -124,7 +146,10 @@ def segment_cell(img, thres=1, seg_gaus1 = 0.5, seg_gaus2=100, seg_iter=1,show_s
|
|
|
124
146
|
height = img.shape[0]
|
|
125
147
|
width = img.shape[1]
|
|
126
148
|
|
|
127
|
-
|
|
149
|
+
## if 3 channels convert to grey
|
|
150
|
+
if len(img.shape) == 3 :
|
|
151
|
+
img = color.rgb2gray(img)
|
|
152
|
+
|
|
128
153
|
# local gaussian (or single gaussian if gaus2 == None)
|
|
129
154
|
if seg_gaus2 is not None:
|
|
130
155
|
img = np.abs(gaussian(img, sigma=seg_gaus1) - gaussian(img, sigma=seg_gaus2))
|
|
@@ -195,6 +220,24 @@ def segment_cell(img, thres=1, seg_gaus1 = 0.5, seg_gaus2=100, seg_iter=1,show_s
|
|
|
195
220
|
return {'mask': mask, 'radius': radius, 'centroid': (cx, cy)}
|
|
196
221
|
|
|
197
222
|
|
|
223
|
+
def create_centered_circle(image_shape):
|
|
224
|
+
# Extract the height and width of the image
|
|
225
|
+
height, width = image_shape[:2]
|
|
226
|
+
# Calculate the center of the image
|
|
227
|
+
center_y, center_x = height // 2, width // 2
|
|
228
|
+
# Calculate the radius of the circle (1/4 of the image height or width)
|
|
229
|
+
radius = min(height, width) // 10
|
|
230
|
+
# Create a 2D array of zeros (background)
|
|
231
|
+
circle_array = np.zeros((height, width), dtype=int)
|
|
232
|
+
# Iterate over each point in the 2D array
|
|
233
|
+
for y in range(height):
|
|
234
|
+
for x in range(width):
|
|
235
|
+
# Calculate the distance from the center
|
|
236
|
+
distance = np.sqrt((y - center_y) ** 2 + (x - center_x) ** 2)
|
|
237
|
+
# If the distance is less than or equal to the radius, set it to 1 (circle)
|
|
238
|
+
if distance <= radius:
|
|
239
|
+
circle_array[y, x] = 1
|
|
240
|
+
return circle_array
|
|
198
241
|
|
|
199
242
|
|
|
200
243
|
def StuctureAnalysisMain(fiber_list,
|
|
@@ -204,10 +247,11 @@ def StuctureAnalysisMain(fiber_list,
|
|
|
204
247
|
sigma_tensor = None , # sigma of applied gauss filter / window for structure tensor analysis in px
|
|
205
248
|
# should be in the order of the objects to analyze !!
|
|
206
249
|
# 7 um for collagen
|
|
207
|
-
edge =
|
|
250
|
+
edge = 15 , # Cutt of pixels at the edge since values at the border cannot be trusted
|
|
208
251
|
segmention_thres = 1.0 , # for cell segemetntion, thres 1 equals normal otsu threshold , user also can specify gaus1 + gaus2 in segmentation if needed
|
|
209
252
|
seg_gaus1=0.5, seg_gaus2 = 100 , # 2 gaus filters used as bandpassfilter for local contrast enhancement; For seg_gaus2 = None a single gauss filter is applied
|
|
210
253
|
max_dist = None, # optional: specify the maximal distance around cell center for analysis (in px)
|
|
254
|
+
min_dist = None, # optional: specify the minimals distance around cell center for analysis (in px)
|
|
211
255
|
regional_max_correction = True,# background correction using regional maxima approach
|
|
212
256
|
show_segmentation = False , # display the segmentation output
|
|
213
257
|
sigma_first_blur = 0.5 , # slight first bluring of whole image before appplying the structure tensor
|
|
@@ -216,16 +260,24 @@ def StuctureAnalysisMain(fiber_list,
|
|
|
216
260
|
manual_segmention = False , # segmentation of mask by manual clicking the cell outline
|
|
217
261
|
plotting = True , # creates and saves individual figures additionally to the excel files
|
|
218
262
|
dpi = 200 , # resolution of figures
|
|
219
|
-
SaveNumpy =
|
|
263
|
+
SaveNumpy = True , # saves numpy arrays for later analysis
|
|
264
|
+
SaveExcel = True , # saves Excel files for later analysis
|
|
220
265
|
norm1=1,norm2 = 99 , # contrast spreading for input images between norm1- and norm2-percentile; values below norm1-percentile are set to zero and
|
|
221
266
|
# values above norm2-percentile are set to 1
|
|
267
|
+
### use norm1= 0,norm2 = 100 if no contras enhancement desired
|
|
222
268
|
seg_invert=False, # if segmentation is inverted dark objects are detected inseated of bright objects
|
|
223
269
|
seg_iter = 1, # number of repetitions of binary closing, dilation and filling holes steps
|
|
224
270
|
segmention_method="otsu", # use "otsu", "entropy" or "yen" as segmentation method
|
|
225
271
|
segmention_min_area = 1000, # small bjects below this px-area are removed during cell segmentation
|
|
226
272
|
load_segmentation = False, # if True enter the path of the segementation.npy - file in path_seg
|
|
227
273
|
path_seg = None, # to load a mask
|
|
228
|
-
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
|
+
|
|
229
281
|
"""
|
|
230
282
|
Main analysis
|
|
231
283
|
|
|
@@ -240,8 +292,16 @@ def StuctureAnalysisMain(fiber_list,
|
|
|
240
292
|
None.
|
|
241
293
|
|
|
242
294
|
"""
|
|
243
|
-
plt.ioff()
|
|
244
|
-
|
|
295
|
+
# plt.ioff()
|
|
296
|
+
# plt.ion()
|
|
297
|
+
|
|
298
|
+
# if no cell images are specified we conduct the analyis on the full image
|
|
299
|
+
# for this, we create dummy images of an artificial cell and set ignore_cell_outline to True
|
|
300
|
+
# Might be usefull to look at quantities such as fiber coherency or angle towards x-axis
|
|
301
|
+
if cell_list == None:
|
|
302
|
+
ignore_cell_outline= True
|
|
303
|
+
dummy_cell = create_centered_circle(imageio.v2.imread(fiber_list[0]).shape)
|
|
304
|
+
|
|
245
305
|
|
|
246
306
|
# if not specified use 7um for tensor analysis and 5um shells
|
|
247
307
|
if not sigma_tensor:
|
|
@@ -269,30 +329,34 @@ def StuctureAnalysisMain(fiber_list,
|
|
|
269
329
|
'SaveNumpy': [SaveNumpy], 'norm1': [norm1], 'norm2': [norm2],
|
|
270
330
|
'seg_invert': [seg_invert], 'seg_iter': [seg_iter], 'segmention_method': [segmention_method],
|
|
271
331
|
'load_segmentation': [load_segmentation], 'path_seg': [path_seg],
|
|
272
|
-
'max_dist': [max_dist]
|
|
332
|
+
'max_dist': [max_dist], 'min_dist': [min_dist]
|
|
273
333
|
|
|
274
334
|
},
|
|
275
335
|
'Data' : {'fiber_list': [fiber_list], 'cell_list': [cell_list], 'out_list': [out_list]}
|
|
276
336
|
}
|
|
277
337
|
with open(os.path.join(out_list[n],"parameters.yml"), 'w') as yaml_file:
|
|
278
338
|
yaml.dump(dict_file, yaml_file, default_flow_style=False)
|
|
279
|
-
|
|
280
339
|
|
|
281
|
-
# load images
|
|
282
|
-
|
|
283
|
-
|
|
340
|
+
# load images
|
|
341
|
+
im_fiber = imageio.v2.imread(fiber_list[n]) #color.rgb2gray()
|
|
342
|
+
if cell_list == None:
|
|
343
|
+
im_cell = dummy_cell
|
|
344
|
+
else:
|
|
345
|
+
im_cell = imageio.v2.imread(cell_list[n])
|
|
346
|
+
|
|
284
347
|
|
|
285
348
|
## if 3 channels convert to grey
|
|
286
|
-
if len(im_cell.shape) == 3 :
|
|
349
|
+
if len(im_cell.shape) == 3 :
|
|
287
350
|
im_cell = color.rgb2gray(im_cell)
|
|
288
351
|
if len(im_fiber.shape) == 3 :
|
|
289
|
-
im_fiber = color.rgb2gray(im_fiber)
|
|
290
|
-
|
|
352
|
+
im_fiber = color.rgb2gray(im_fiber)
|
|
353
|
+
|
|
354
|
+
|
|
291
355
|
# # applying normalizing/ contrast spreading
|
|
292
356
|
im_cell_n = normalize(im_cell, norm1, norm2)
|
|
293
357
|
im_fiber_n = normalize(im_fiber, norm1, norm2)
|
|
294
358
|
im_fiber_g = gaussian(im_fiber_n, sigma=sigma_first_blur) # blur fiber image slightly (test with local gauss - similar)
|
|
295
|
-
|
|
359
|
+
|
|
296
360
|
|
|
297
361
|
# segment cell (either manual or automatically)
|
|
298
362
|
if manual_segmention==True:
|
|
@@ -326,10 +390,13 @@ def StuctureAnalysisMain(fiber_list,
|
|
|
326
390
|
# Structure Tensor Orientation
|
|
327
391
|
# get structure tensor
|
|
328
392
|
ori, max_evec, min_evec, max_eval, min_eval = analyze_local(im_fiber_g_forstructure, sigma=sigma_tensor, size=0, filter_type="gaussian")
|
|
393
|
+
|
|
329
394
|
# cut off edges as specified
|
|
330
395
|
if edge != 0:
|
|
331
396
|
ori, max_evec, min_evec, max_eval, min_eval = ori[edge:-edge,edge:-edge], max_evec[edge:-edge,edge:-edge], min_evec[edge:-edge,edge:-edge], \
|
|
332
397
|
max_eval[edge:-edge,edge:-edge], min_eval[edge:-edge,edge:-edge]
|
|
398
|
+
|
|
399
|
+
|
|
333
400
|
"""
|
|
334
401
|
coordinates
|
|
335
402
|
"""
|
|
@@ -342,31 +409,32 @@ def StuctureAnalysisMain(fiber_list,
|
|
|
342
409
|
dx_norm = (dx/distance)
|
|
343
410
|
dy_norm = (dy/distance)
|
|
344
411
|
dist_surface = distance_transform_edt(~segmention["mask"])[edge:-edge,edge:-edge] # dist to surface
|
|
345
|
-
|
|
346
|
-
|
|
412
|
+
# calculate an angle without the deviation/reference to the cell position
|
|
413
|
+
angle_no_reference = ((np.arctan2(min_evec[:,:,0],min_evec[:,:,1])*360/(2*np.pi))%180)-90 # -90 to +90° towards x-axis
|
|
414
|
+
|
|
415
|
+
|
|
347
416
|
"""
|
|
348
417
|
total image analysis
|
|
349
418
|
"""
|
|
350
419
|
# Angular deviation from orietation to center vector (projection to only have positive deviation angle values since negative/positive deviation does not matter here)
|
|
351
420
|
angle_dev = np.arccos(np.abs(dx_norm * min_evec[:,:,0] + dy_norm*min_evec[:,:,1])) * 360/(2*np.pi)
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
421
|
+
## compute the orientation
|
|
422
|
+
orientation_dev = 1 - (2 * np.arccos(np.abs(dx_norm * min_evec[:,:,0] + dy_norm*min_evec[:,:,1]))/ (0.5* np.pi))
|
|
423
|
+
|
|
424
|
+
|
|
357
425
|
### set values to nan if max distance is specified
|
|
358
426
|
## for following analysis then only orientation within a certtain distance to the cell are used
|
|
359
427
|
if max_dist:
|
|
360
|
-
angle_dev[distance
|
|
361
|
-
ori[distance
|
|
362
|
-
angle[distance
|
|
428
|
+
angle_dev[distance>max_dist] = np.nan
|
|
429
|
+
ori[distance>max_dist] = np.nan
|
|
430
|
+
angle[distance>max_dist] = np.nan # also for angular evaluation
|
|
363
431
|
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
432
|
+
if min_dist:
|
|
433
|
+
angle_dev[distance<min_dist] = np.nan
|
|
434
|
+
ori[distance<min_dist] = np.nan
|
|
435
|
+
angle[distance<max_dist] = np.nan # also for angular evaluation
|
|
436
|
+
|
|
437
|
+
|
|
370
438
|
# weighting by coherence and image intensity
|
|
371
439
|
im_fiber_g = im_fiber_g[edge:-edge,edge:-edge]
|
|
372
440
|
# could also use non filtered image
|
|
@@ -374,14 +442,18 @@ def StuctureAnalysisMain(fiber_list,
|
|
|
374
442
|
# use a threshold in the intensity image// only coherence and orientation vectors
|
|
375
443
|
# corresponding to pixels in the intesity iamage above a threshold are considered.
|
|
376
444
|
weight_image = gaussian(im_fiber_g,sigma=15)
|
|
445
|
+
|
|
446
|
+
# construct weighted array so that the mean value of these arrays later
|
|
447
|
+
# result in the weighted average of these
|
|
448
|
+
# weight by coherency
|
|
449
|
+
angle_dev_weighted = (angle_dev * ori) / np.nanmean(ori)
|
|
450
|
+
orientation_dev_weighted = (orientation_dev * ori) / np.nanmean(ori)
|
|
451
|
+
# weight by coherency & intensity
|
|
377
452
|
angle_dev_weighted2 = (angle_dev_weighted *weight_image) / np.nanmean(weight_image)
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
# also weighting the coherency like this
|
|
453
|
+
orientation_dev_weighted2 = (orientation_dev *weight_image*ori) / np.nanmean(weight_image*ori)
|
|
454
|
+
# weighting coherency by intensity
|
|
382
455
|
ori_weight2 = (ori * weight_image) / np.nanmean(weight_image)
|
|
383
|
-
|
|
384
|
-
|
|
456
|
+
|
|
385
457
|
# GRADIENT towards center
|
|
386
458
|
grad_y = np.gradient(im_fiber_g, axis=0)
|
|
387
459
|
grad_x = np.gradient(im_fiber_g, axis=1)
|
|
@@ -402,9 +474,7 @@ def StuctureAnalysisMain(fiber_list,
|
|
|
402
474
|
alpha_dev_total1 = np.nanmean(angle_dev[(~segmention["mask"][edge:-edge,edge:-edge])])
|
|
403
475
|
alpha_dev_total2 = np.nanmean(angle_dev_weighted[(~segmention["mask"][edge:-edge, edge:-edge])])
|
|
404
476
|
alpha_dev_total3 = np.nanmean(angle_dev_weighted2[(~segmention["mask"][edge:-edge, edge:-edge])])
|
|
405
|
-
|
|
406
|
-
# cos_dev_total2 = np.nanmean(np.cos(2*angle_dev_weighted[(~segmention["mask"][edge:-edge, edge:-edge])]*np.pi/180))
|
|
407
|
-
# cos_dev_total3 = np.nanmean(np.cos(2*angle_dev_weighted2[(~segmention["mask"][edge:-edge, edge:-edge])]*np.pi/180))
|
|
477
|
+
|
|
408
478
|
cos_dev_total1 = np.nanmean(orientation_dev[(~segmention["mask"][edge:-edge,edge:-edge]) ])
|
|
409
479
|
cos_dev_total2 = np.nanmean(orientation_dev_weighted[(~segmention["mask"][edge:-edge,edge:-edge]) ])
|
|
410
480
|
cos_dev_total3 = np.nanmean(orientation_dev_weighted2[(~segmention["mask"][edge:-edge,edge:-edge]) ])
|
|
@@ -428,7 +498,8 @@ def StuctureAnalysisMain(fiber_list,
|
|
|
428
498
|
results_total['Orientation (weighted by intensity and coherency)'].append(cos_dev_total3)
|
|
429
499
|
|
|
430
500
|
excel_total = pd.DataFrame.from_dict(results_total)
|
|
431
|
-
|
|
501
|
+
if SaveExcel:
|
|
502
|
+
excel_total.to_excel(os.path.join(out_list[n],"results_total.xlsx"))
|
|
432
503
|
|
|
433
504
|
|
|
434
505
|
"""
|
|
@@ -483,14 +554,18 @@ def StuctureAnalysisMain(fiber_list,
|
|
|
483
554
|
|
|
484
555
|
# create excel sheet with results for angle analysis
|
|
485
556
|
excel_angles= pd.DataFrame.from_dict(results_angle)
|
|
486
|
-
|
|
487
|
-
|
|
557
|
+
if SaveExcel:
|
|
558
|
+
excel_angles.to_excel(os.path.join(out_list[n],"results_angles.xlsx"))
|
|
488
559
|
|
|
560
|
+
|
|
489
561
|
"""
|
|
490
562
|
Distance Evaluation
|
|
491
563
|
"""
|
|
492
564
|
|
|
493
|
-
|
|
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
|
|
494
569
|
results_distance = {'Shell_mid (px)': [], 'Shell_mid (µm)': [], 'Intensity (accumulated)': [],
|
|
495
570
|
'Intensity (individual)': [], 'Intensity Norm (individual)': [],
|
|
496
571
|
'Intensity Norm (accumulated)': [], 'Angle (accumulated)': [], 'Angle (individual)': [], 'Angle (individual-weightInt)': [],
|
|
@@ -502,7 +577,7 @@ def StuctureAnalysisMain(fiber_list,
|
|
|
502
577
|
'Angle disttocenter (accumulated)': [], 'Angle disttocenter (individual)': [],
|
|
503
578
|
'Orientation disttocenter (accumulated)': [], 'Orientation disttocenter (individual)': [],
|
|
504
579
|
'Angle disttocenter (individual)': []
|
|
505
|
-
|
|
580
|
+
}
|
|
506
581
|
|
|
507
582
|
mask_shells = {'Mask_shell': [], 'Mask_shell_center': [] }
|
|
508
583
|
# shell distances
|
|
@@ -535,7 +610,7 @@ def StuctureAnalysisMain(fiber_list,
|
|
|
535
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]) ))
|
|
536
611
|
|
|
537
612
|
|
|
538
|
-
|
|
613
|
+
# mean intensity
|
|
539
614
|
results_distance['Intensity (accumulated)'].append(np.nanmean(im_fiber_g[mask_shell_lower])) # accumulation of lower shells
|
|
540
615
|
results_distance['Intensity (individual)'].append(np.nanmean(im_fiber_g[mask_shell]) ) # exclusively in certain shell
|
|
541
616
|
|
|
@@ -569,152 +644,161 @@ def StuctureAnalysisMain(fiber_list,
|
|
|
569
644
|
results_distance['Intensity Norm disttocenter (accumulated)'].extend(list(norm_accum_int_c) )
|
|
570
645
|
# create excel sheet with results for angle analysis
|
|
571
646
|
excel_distance = pd.DataFrame.from_dict(results_distance)
|
|
572
|
-
|
|
647
|
+
if SaveExcel:
|
|
648
|
+
excel_distance.to_excel(os.path.join(out_list[n],"results_distance.xlsx"))
|
|
573
649
|
|
|
574
|
-
|
|
575
|
-
# Halflife values - Leave for now..
|
|
576
|
-
# # Calculate value where ntensity drops 25%
|
|
577
|
-
# distintdrop = np.abs(np.array(results_distance['Intensity Norm (individual)'])-0.75)
|
|
578
|
-
# # distance where int drops to 75%
|
|
579
|
-
# halflife_int = midofshells[np.where(distintdrop == np.nanmin(distintdrop))[1]]
|
|
580
|
-
# # if decrease is not within range (minimum equals last value) then set to nan
|
|
581
|
-
# if halflife_int == midofshells[-1]:
|
|
582
|
-
# halflife_int = np.nan
|
|
583
|
-
# # # Calculate value where orientation drops to 75% within maxorientation(min) to 45° (random) range
|
|
584
|
-
# # difference to 45 degree instead of min-max range
|
|
585
|
-
# # calculate halflife of maximal orientation over distance
|
|
586
|
-
# # difference to 45 degree for all
|
|
587
|
-
# diffdist = np.array(dist_angle_individ)-45
|
|
588
|
-
# # maximal orientation
|
|
589
|
-
# diffmax = np.nanmin(diffdist)
|
|
590
|
-
# diffmax_pos = np.where(diffmax==diffdist)[0][0]
|
|
591
|
-
# # difference angle drops to 75%
|
|
592
|
-
# diff2 = np.abs(diffdist-(0.75*diffmax))
|
|
593
|
-
# diff2[:diffmax_pos] = np.nan # only look at distances on the right side /further out
|
|
594
|
-
# halflife_ori = midofshells[np.where(diff2 == np.nanmin(diff2))]
|
|
595
|
-
# # if decrease is not within range (minimum equals last value) then set to nan
|
|
596
|
-
# if halflife_ori == midofshells[-1]:
|
|
597
|
-
# halflife_ori = np.nan
|
|
598
|
-
# try:
|
|
599
|
-
# np.savetxt(os.path.join(out_list[n],"meanangle_within10shells.txt"), [dist_angle_accum[9]])
|
|
600
|
-
# except:
|
|
601
|
-
# pass
|
|
650
|
+
|
|
602
651
|
|
|
603
652
|
if SaveNumpy:
|
|
604
653
|
#create output folder if not existing
|
|
605
|
-
numpy_out = os.path.join(out_list[n],
|
|
654
|
+
numpy_out = os.path.join(out_list[n], "NumpyArrays" )
|
|
655
|
+
print (numpy_out)
|
|
606
656
|
if not os.path.exists(numpy_out):
|
|
607
657
|
os.makedirs(numpy_out)
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
np.save(os.path.join(numpy_out, "
|
|
611
|
-
np.save(os.path.join(numpy_out, "
|
|
612
|
-
np.save(os.path.join(numpy_out, "AngleMap(
|
|
658
|
+
# save data array all with the size of the evaluated arrays
|
|
659
|
+
# that are "edge" - pixels smaller to get rid of boundary artefacts
|
|
660
|
+
np.save(os.path.join(numpy_out, "segmention.npy" ),segmention["mask"][edge:-edge,edge:-edge])
|
|
661
|
+
np.save(os.path.join(numpy_out, "AngleDeviationMap.npy" ),angle_dev )
|
|
662
|
+
#np.save(os.path.join(numpy_out, "AngleMap(weight_int).npy" ),angle_dev_weighted)
|
|
663
|
+
np.save(os.path.join(numpy_out, "AngleDeviationMap(weight_int_coh).npy"),angle_dev_weighted2 )
|
|
664
|
+
np.save(os.path.join(numpy_out, "AngleMap_NoReference.npy"), angle_no_reference )
|
|
613
665
|
np.save(os.path.join(numpy_out, "OrientationMap.npy" ),orientation_dev )
|
|
614
|
-
np.save(os.path.join(numpy_out, "OrientationMap_weight_int.npy" ),orientation_dev_weighted)
|
|
666
|
+
#np.save(os.path.join(numpy_out, "OrientationMap_weight_int.npy" ),orientation_dev_weighted)
|
|
615
667
|
np.save(os.path.join(numpy_out, "OrientationMap_weight_intcoh.npy" ),orientation_dev_weighted2 )
|
|
616
668
|
np.save(os.path.join(numpy_out, "FiberImageCrop.npy" ),normalize(im_fiber_n[edge:-edge,edge:-edge]) )
|
|
617
669
|
np.save(os.path.join(numpy_out, "CoherencyMap.npy" ),ori )
|
|
618
|
-
np.save(os.path.join(numpy_out, "CoherencyMap(weighted_int).npy" ),ori_weight2)
|
|
670
|
+
#np.save(os.path.join(numpy_out, "CoherencyMap(weighted_int).npy" ),ori_weight2)
|
|
619
671
|
np.save(os.path.join(numpy_out, "Vector_min_ax0.npy"),min_evec[:,:,0])
|
|
620
672
|
np.save(os.path.join(numpy_out, "Vector_min_ax1.npy"),min_evec[:,:,1])
|
|
621
|
-
np.save(os.path.join(numpy_out, "
|
|
622
|
-
np.save(os.path.join(numpy_out, "
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
673
|
+
np.save(os.path.join(numpy_out, "center.npy"),center_small)
|
|
674
|
+
#np.save(os.path.join(numpy_out, "mask_surface_shells.npy"),mask_shells['Mask_shell'])
|
|
675
|
+
#np.save(os.path.join(numpy_out, "mask_spherical_shells.npy"),mask_shells['Mask_shell_center'])
|
|
676
|
+
|
|
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)
|
|
682
|
+
|
|
683
|
+
|
|
627
684
|
"""
|
|
628
|
-
|
|
685
|
+
Plotting results
|
|
629
686
|
"""
|
|
630
687
|
|
|
631
688
|
if plotting:
|
|
632
689
|
#create output folder if not existing
|
|
633
690
|
figures = os.path.join(out_list[n],"Figures")
|
|
691
|
+
print (figures)
|
|
634
692
|
if not os.path.exists(figures):
|
|
635
693
|
os.makedirs(figures)
|
|
636
|
-
|
|
637
|
-
# plot orientation and angle deviation maps together with orientation structure
|
|
638
|
-
plot_angle_dev(angle_map = angle_dev,
|
|
639
|
-
vec0=min_evec[:,:,0] ,vec1=min_evec[:,:,1] ,coherency_map=ori,
|
|
640
|
-
path_png= os.path.join(figures,"Angle_deviation.png"),label="Angle Deviation",dpi=dpi,cmap="viridis_r")
|
|
641
|
-
plot_angle_dev(angle_map = angle_dev_weighted2,
|
|
642
|
-
vec0=min_evec[:,:,0] ,vec1=min_evec[:,:,1] ,coherency_map=ori,
|
|
643
|
-
path_png= os.path.join(figures,"Angle_deviation_weighted.png"),label="Angle Deviation",dpi=dpi,cmap="viridis_r")
|
|
644
|
-
plot_angle_dev(angle_map = orientation_dev_weighted2 ,
|
|
645
|
-
vec0=min_evec[:,:,0] ,vec1=min_evec[:,:,1] ,coherency_map=ori,
|
|
646
|
-
path_png= os.path.join(figures,"Orientation_weighted.png"),label="Orientation",dpi=dpi,cmap="viridis")
|
|
647
|
-
plot_angle_dev(angle_map = orientation_dev,
|
|
648
|
-
vec0=min_evec[:,:,0] ,vec1=min_evec[:,:,1] ,coherency_map=ori,
|
|
649
|
-
path_png= os.path.join(figures,"Orientation.png"),label="Orientation",dpi=dpi,cmap="viridis")
|
|
650
|
-
plt.close("all")
|
|
651
|
-
# pure coherency and pure orientation
|
|
652
|
-
plot_coherency(ori,path_png= os.path.join(figures,"coherency_noquiver.png"))
|
|
653
|
-
plot_coherency(orientation_dev_weighted2,
|
|
654
|
-
path_png= os.path.join(figures,"Orientation_weighted_noquiver.png"),
|
|
655
|
-
label="Orientation",dpi=dpi)
|
|
656
|
-
plt.close("all")
|
|
657
694
|
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
695
|
+
plot_angle_dev(angle_map = orientation_dev, vmin=-1,vmax=1,
|
|
696
|
+
vec0=min_evec[:,:,0] ,vec1=min_evec[:,:,1] ,coherency_map=ori,
|
|
697
|
+
path_png= os.path.join(figures,"Orientation.png"),label="Orientation",dpi=dpi,cmap="coolwarm")
|
|
698
|
+
|
|
699
|
+
|
|
700
|
+
|
|
701
|
+
if cell_list == None:
|
|
702
|
+
plot_fancy_overlay(im_fiber_n[edge:-edge,edge:-edge],
|
|
703
|
+
None,
|
|
704
|
+
angle_no_reference, cmap_angle="gist_rainbow",
|
|
705
|
+
path_png= os.path.join(figures,"Angle_NoReference_overlay_nocell.png"),
|
|
706
|
+
label="Angle (x-axis)",dpi=dpi,
|
|
707
|
+
# ,cmap_cell="Greys_r",cmap_fiber="Greys_r", ### use default values here
|
|
708
|
+
# cmap_angle="viridis", alpha_ori =0.8, alpha_cell = 0.4, alpha_fiber = 0.4,
|
|
709
|
+
omin=-90, omax=90,
|
|
710
|
+
scale=scale)
|
|
711
|
+
plot_fancy_overlay(im_fiber_n[edge:-edge,edge:-edge],
|
|
712
|
+
None,
|
|
713
|
+
ori, cmap_angle="turbo",
|
|
714
|
+
path_png= os.path.join(figures,"Coherency_overlay_nocell.png"),
|
|
715
|
+
label="Coherency",dpi=dpi,
|
|
716
|
+
# ,cmap_cell="Greys_r",cmap_fiber="Greys_r", ### use default values here
|
|
717
|
+
# cmap_angle="viridis", alpha_ori =0.8, alpha_cell = 0.4, alpha_fiber = 0.4,
|
|
718
|
+
omin=0, omax=1,scale=scale)
|
|
719
|
+
plot_fancy_overlay(im_fiber_n[edge:-edge,edge:-edge],
|
|
720
|
+
im_cell_n[edge:-edge,edge:-edge],
|
|
721
|
+
orientation_dev, cmap_angle="coolwarm",
|
|
722
|
+
path_png= os.path.join(figures,"Orientation_overlay.png"),
|
|
723
|
+
label="Orientation",dpi=dpi,
|
|
724
|
+
omin=-1, omax=1,scale=scale)
|
|
670
725
|
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
726
|
+
else:
|
|
727
|
+
### more fancy overlay plot of cell & fiber & orientation (notweighted)
|
|
728
|
+
plot_fancy_overlay(im_fiber_n[edge:-edge,edge:-edge],
|
|
729
|
+
im_cell_n[edge:-edge,edge:-edge],
|
|
730
|
+
orientation_dev, cmap_angle="coolwarm",
|
|
731
|
+
path_png= os.path.join(figures,"Orientation_overlay.png"),
|
|
732
|
+
label="Orientation",dpi=dpi,
|
|
733
|
+
# ,cmap_cell="Greys_r",cmap_fiber="Greys_r", ### use default values here
|
|
734
|
+
# cmap_angle="viridis", alpha_ori =0.8, alpha_cell = 0.4, alpha_fiber = 0.4,
|
|
735
|
+
omin=-1, omax=1,scale=scale)
|
|
736
|
+
|
|
737
|
+
plot_fancy_overlay(im_fiber_n[edge:-edge,edge:-edge],
|
|
738
|
+
im_cell_n[edge:-edge,edge:-edge],
|
|
739
|
+
ori, cmap_angle="turbo",
|
|
740
|
+
path_png= os.path.join(figures,"Coherency_overlay.png"),
|
|
741
|
+
label="Coherency",dpi=dpi,
|
|
742
|
+
# ,cmap_cell="Greys_r",cmap_fiber="Greys_r", ### use default values here
|
|
743
|
+
# cmap_angle="viridis", alpha_ori =0.8, alpha_cell = 0.4, alpha_fiber = 0.4,
|
|
744
|
+
omin=0, omax=1,scale=scale)
|
|
745
|
+
|
|
746
|
+
plot_fancy_overlay(im_fiber_n[edge:-edge,edge:-edge],
|
|
747
|
+
im_cell_n[edge:-edge,edge:-edge],
|
|
748
|
+
angle_dev, cmap_angle="viridis_r",
|
|
749
|
+
path_png= os.path.join(figures,"Angle_Deviation_overlay.png"),
|
|
750
|
+
label="Angle Deviation",dpi=dpi,
|
|
751
|
+
# ,cmap_cell="Greys_r",cmap_fiber="Greys_r", ### use default values here
|
|
752
|
+
# cmap_angle="viridis", alpha_ori =0.8, alpha_cell = 0.4, alpha_fiber = 0.4,
|
|
753
|
+
omin=0, omax=90,scale=scale)
|
|
754
|
+
|
|
755
|
+
plot_fancy_overlay(im_fiber_n[edge:-edge,edge:-edge],
|
|
756
|
+
im_cell_n[edge:-edge,edge:-edge],
|
|
757
|
+
angle_no_reference, cmap_angle="gist_rainbow",
|
|
758
|
+
path_png= os.path.join(figures,"Angle_NoReference_overlay.png"),
|
|
759
|
+
label="Angle (x-axis)",dpi=dpi,
|
|
760
|
+
# ,cmap_cell="Greys_r",cmap_fiber="Greys_r", ### use default values here
|
|
761
|
+
# cmap_angle="viridis", alpha_ori =0.8, alpha_cell = 0.4, alpha_fiber = 0.4,
|
|
762
|
+
omin=-90, omax=90,
|
|
763
|
+
scale=scale)
|
|
764
|
+
|
|
674
765
|
|
|
675
|
-
|
|
766
|
+
plt.close("all")
|
|
767
|
+
|
|
768
|
+
# Polar plots
|
|
676
769
|
plot_polar(results_angle['Angles Plotting'], results_angle['Coherency (weighted by intensity)'],
|
|
677
770
|
path_png= os.path.join(figures,"polar_coherency_double.png"), label = "Coherency (weighted)",
|
|
678
|
-
something2 = results_angle['Coherency'], label2 = "Coherency",dpi=dpi)
|
|
679
|
-
|
|
680
|
-
plot_polar(results_angle['Angles Plotting'], results_angle['Mean Intensity'],
|
|
681
|
-
path_png= os.path.join(figures,"polar_intensity.png"), label = "Mean Intensity",dpi=dpi)
|
|
771
|
+
something2 = results_angle['Coherency'], label2 = "Coherency",dpi=dpi, vmin=0,vmax=1)
|
|
682
772
|
|
|
683
773
|
plot_polar(results_angle['Angles Plotting'], results_angle['Orientation (weighted by intensity and coherency)'],
|
|
684
|
-
|
|
774
|
+
path_png= os.path.join(figures,"polar_orientation_double.png"), label = "Orientation (weighted)",
|
|
775
|
+
something2 = results_angle['Orientation'], label2 = "Orientation",dpi=dpi, vmin=-1,vmax=1)
|
|
685
776
|
|
|
686
|
-
plot_polar(results_angle['Angles Plotting'], results_angle['Orientation'],
|
|
687
|
-
path_png= os.path.join(figures,"Orientation_polar.png"), label = "Orientation",dpi=dpi)
|
|
688
|
-
plt.close("all")
|
|
689
777
|
# summarizing triple plot
|
|
690
778
|
plot_triple(results_angle,results_total , path_png= os.path.join(figures,"Triple_plot.png") ,dpi=dpi)
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
path_png=os.path.join(figures,"overlay2.png"),dpi=dpi ,scale=scale)
|
|
715
|
-
##
|
|
716
|
-
|
|
717
|
-
|
|
779
|
+
|
|
780
|
+
if cell_list is not None:
|
|
781
|
+
|
|
782
|
+
# image fiber + segmention
|
|
783
|
+
plot_fiber_seg(fiber_image=normalize(im_fiber_n[edge:-edge,edge:-edge]) ,
|
|
784
|
+
c0=center_small[0],c1=center_small[1],
|
|
785
|
+
segmention=segmention["mask"][edge:-edge,edge:-edge],
|
|
786
|
+
path_png=os.path.join(figures,"fiber_celloutline.png"),dpi=dpi,scale=scale )
|
|
787
|
+
# plot overlaywith fiber image
|
|
788
|
+
plot_overlay(fiber_image=normalize(im_fiber_n[edge:-edge,edge:-edge]) ,
|
|
789
|
+
c0=center_small[0],c1=center_small[1], vec0=min_evec[:,:,0],
|
|
790
|
+
vec1=min_evec[:,:,1], coherency_map=ori, show_n=15,
|
|
791
|
+
segmention=segmention["mask"][edge:-edge,edge:-edge],
|
|
792
|
+
path_png=os.path.join(figures,"fiber_cell_structure.png"),dpi=dpi ,scale=scale)
|
|
793
|
+
else:
|
|
794
|
+
# plot overlaywith fiber image
|
|
795
|
+
plot_overlay(fiber_image=normalize(im_fiber_n[edge:-edge,edge:-edge]) ,
|
|
796
|
+
c0=center_small[0],c1=center_small[1], vec0=min_evec[:,:,0],
|
|
797
|
+
vec1=min_evec[:,:,1], coherency_map=ori, show_n=15,
|
|
798
|
+
segmention=None,
|
|
799
|
+
path_png=os.path.join(figures,"fiber_structure.png"),dpi=dpi ,scale=scale)
|
|
800
|
+
|
|
801
|
+
|
|
718
802
|
plt.close("all")
|
|
719
803
|
### DISTANCE PLOTS
|
|
720
804
|
# plot shells - deactived as it consumes a lot of time
|
|
@@ -726,13 +810,34 @@ def StuctureAnalysisMain(fiber_list,
|
|
|
726
810
|
|
|
727
811
|
plot_distance(results_distance,string_plot = "Intensity Norm (individual)",
|
|
728
812
|
path_png=os.path.join(figures,"Intensity_distance.png"),dpi=dpi)
|
|
729
|
-
|
|
813
|
+
|
|
814
|
+
|
|
730
815
|
# save raw cell image
|
|
731
816
|
plot_cell(im_cell_n, path_png=os.path.join(figures,"cell-raw.png"), scale=scale, dpi=dpi)
|
|
817
|
+
plot_cell(normalize(im_fiber_n[edge:-edge,edge:-edge]), path_png=os.path.join(figures,"fiber-raw.png"), scale=scale, dpi=dpi)
|
|
732
818
|
|
|
733
|
-
plt.close("all")
|
|
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
|
|
823
|
+
|
|
824
|
+
# np.save(os.path.join(numpy_out, "segmention.npy" ),segmention["mask"][edge:-edge,edge:-edge])
|
|
825
|
+
# np.save(os.path.join(numpy_out, "AngleDeviationMap.npy" ),angle_dev )
|
|
826
|
+
# #np.save(os.path.join(numpy_out, "AngleMap(weight_int).npy" ),angle_dev_weighted)
|
|
827
|
+
# np.save(os.path.join(numpy_out, "AngleDeviationMap(weight_int_coh).npy"),angle_dev_weighted2 )
|
|
828
|
+
# np.save(os.path.join(numpy_out, "AngleMap_NoReference.npy"), angle_no_reference )
|
|
829
|
+
# np.save(os.path.join(numpy_out, "OrientationMap.npy" ),orientation_dev )
|
|
830
|
+
# #np.save(os.path.join(numpy_out, "OrientationMap_weight_int.npy" ),orientation_dev_weighted)
|
|
831
|
+
# np.save(os.path.join(numpy_out, "OrientationMap_weight_intcoh.npy" ),orientation_dev_weighted2 )
|
|
832
|
+
# np.save(os.path.join(numpy_out, "FiberImageCrop.npy" ),normalize(im_fiber_n[edge:-edge,edge:-edge]) )
|
|
833
|
+
# np.save(os.path.join(numpy_out, "CoherencyMap.npy" ),ori )
|
|
834
|
+
# #np.save(os.path.join(numpy_out, "CoherencyMap(weighted_int).npy" ),ori_weight2)
|
|
835
|
+
# np.save(os.path.join(numpy_out, "Vector_min_ax0.npy"),min_evec[:,:,0])
|
|
836
|
+
# np.save(os.path.join(numpy_out, "Vector_min_ax1.npy"),min_evec[:,:,1])
|
|
837
|
+
# np.save(os.path.join(numpy_out, "center.npy"),center_small)
|
|
838
|
+
|
|
839
|
+
|
|
734
840
|
|
|
735
|
-
|
|
736
841
|
return
|
|
737
842
|
|
|
738
843
|
|
|
@@ -758,10 +863,10 @@ def SummarizeResultsTotal(data, output_folder= None):
|
|
|
758
863
|
'Overall weighted Oriantation (std all cells)': []}
|
|
759
864
|
|
|
760
865
|
for i, path in enumerate(list_total):
|
|
761
|
-
results_total_combined['Orientation (weighted by coherency)'].append(float(pd.read_excel(list_total[i])['Orientation (weighted by coherency)']))
|
|
762
|
-
results_total_combined['Orientation (weighted by intensity and coherency)'].append(float(pd.read_excel(list_total[i])['Orientation (weighted by intensity and coherency)']))
|
|
763
|
-
results_total_combined['Mean Angle (weighted by coherency)'].append(float(pd.read_excel(list_total[i])['Mean Angle (weighted by coherency)']))
|
|
764
|
-
results_total_combined['Mean Angle (weighted by intensity and coherency)'].append(float(pd.read_excel(list_total[i])['Mean Angle (weighted by intensity and coherency)']))
|
|
866
|
+
results_total_combined['Orientation (weighted by coherency)'].append(float(pd.read_excel(list_total[i])['Orientation (weighted by coherency)'][0]))
|
|
867
|
+
results_total_combined['Orientation (weighted by intensity and coherency)'].append(float(pd.read_excel(list_total[i])['Orientation (weighted by intensity and coherency)'][0]))
|
|
868
|
+
results_total_combined['Mean Angle (weighted by coherency)'].append(float(pd.read_excel(list_total[i])['Mean Angle (weighted by coherency)'][0]))
|
|
869
|
+
results_total_combined['Mean Angle (weighted by intensity and coherency)'].append(float(pd.read_excel(list_total[i])['Mean Angle (weighted by intensity and coherency)'][0]))
|
|
765
870
|
results_total_combined['Path'].append(str(list_total[i]))
|
|
766
871
|
|
|
767
872
|
ovreall_orientation = np.nanmean(results_total_combined['Orientation (weighted by intensity and coherency)'])
|