pingmapper 5.0.14__py3-none-any.whl → 5.0.16__py3-none-any.whl
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.
- pingmapper/class_portstarObj.py +29 -2
- pingmapper/class_sonObj.py +0 -98
- pingmapper/funcs_model.py +35 -2
- pingmapper/gui_main.py +0 -6
- pingmapper/main_mapSubstrate.py +0 -8
- pingmapper/main_readFiles.py +78 -121
- pingmapper/main_rectify.py +0 -8
- pingmapper/version.py +1 -1
- {pingmapper-5.0.14.dist-info → pingmapper-5.0.16.dist-info}/METADATA +1 -1
- pingmapper-5.0.16.dist-info/RECORD +23 -0
- pingmapper-5.0.14.dist-info/RECORD +0 -23
- {pingmapper-5.0.14.data → pingmapper-5.0.16.data}/data/pingmapper_config/default_params.json +0 -0
- {pingmapper-5.0.14.dist-info → pingmapper-5.0.16.dist-info}/WHEEL +0 -0
- {pingmapper-5.0.14.dist-info → pingmapper-5.0.16.dist-info}/licenses/LICENSE +0 -0
- {pingmapper-5.0.14.dist-info → pingmapper-5.0.16.dist-info}/top_level.txt +0 -0
pingmapper/class_portstarObj.py
CHANGED
|
@@ -63,10 +63,29 @@ try:
|
|
|
63
63
|
from doodleverse_utils.imports import *
|
|
64
64
|
from doodleverse_utils.model_imports import *
|
|
65
65
|
from doodleverse_utils.prediction_imports import *
|
|
66
|
-
except ImportError:
|
|
66
|
+
except ImportError as e:
|
|
67
|
+
import traceback
|
|
68
|
+
print('\n' + '='*80)
|
|
67
69
|
print('Could not import Doodleverse Utils. Please install these packages to use PING-Mapper.')
|
|
68
70
|
print('They are not needed for GhostVision. Trying to continue...')
|
|
69
|
-
|
|
71
|
+
print('\nDetailed error information:')
|
|
72
|
+
print('-'*80)
|
|
73
|
+
print(f'Error Type: {type(e).__name__}')
|
|
74
|
+
print(f'Error Message: {str(e)}')
|
|
75
|
+
print('-'*80)
|
|
76
|
+
traceback.print_exc()
|
|
77
|
+
print('='*80 + '\n')
|
|
78
|
+
except Exception as e:
|
|
79
|
+
import traceback
|
|
80
|
+
print('\n' + '='*80)
|
|
81
|
+
print('Unexpected error while importing Doodleverse Utils.')
|
|
82
|
+
print('Detailed error information:')
|
|
83
|
+
print('-'*80)
|
|
84
|
+
print(f'Error Type: {type(e).__name__}')
|
|
85
|
+
print(f'Error Message: {str(e)}')
|
|
86
|
+
print('-'*80)
|
|
87
|
+
traceback.print_exc()
|
|
88
|
+
print('='*80 + '\n')
|
|
70
89
|
|
|
71
90
|
import geopandas as gpd
|
|
72
91
|
|
|
@@ -874,6 +893,14 @@ class portstarObj(object):
|
|
|
874
893
|
--------------------
|
|
875
894
|
self._depthZheng() or self._depthThreshold()
|
|
876
895
|
'''
|
|
896
|
+
|
|
897
|
+
# Check if depth detection dependencies are available
|
|
898
|
+
if not DEPTH_DETECTION_AVAILABLE:
|
|
899
|
+
raise ImportError(
|
|
900
|
+
"TensorFlow, Transformers, and/or Doodleverse Utils are not installed. "
|
|
901
|
+
"These packages are required for automatic depth detection. "
|
|
902
|
+
"Please install them using: pip install tensorflow transformers doodleverse-utils"
|
|
903
|
+
)
|
|
877
904
|
|
|
878
905
|
# Open model configuration file
|
|
879
906
|
with open(self.configfile) as f:
|
pingmapper/class_sonObj.py
CHANGED
|
@@ -1453,104 +1453,6 @@ class sonObj(object):
|
|
|
1453
1453
|
|
|
1454
1454
|
return
|
|
1455
1455
|
|
|
1456
|
-
# ======================================================================
|
|
1457
|
-
def _exportMovWin(self,
|
|
1458
|
-
i : int,
|
|
1459
|
-
stride : int,
|
|
1460
|
-
tileType: list,
|
|
1461
|
-
pingMax: int,
|
|
1462
|
-
depMax: int):
|
|
1463
|
-
|
|
1464
|
-
'''
|
|
1465
|
-
'''
|
|
1466
|
-
|
|
1467
|
-
# Set chunk index
|
|
1468
|
-
a_idx = i-1
|
|
1469
|
-
b_idx = i
|
|
1470
|
-
|
|
1471
|
-
# Iterate each tile type
|
|
1472
|
-
for t in tileType:
|
|
1473
|
-
if t == 'wco':
|
|
1474
|
-
cropMax = depMax
|
|
1475
|
-
else:
|
|
1476
|
-
cropMax = pingMax
|
|
1477
|
-
inDir = os.path.join(self.outDir, t)
|
|
1478
|
-
outDir = os.path.join(self.outDir, t+'_mw')
|
|
1479
|
-
|
|
1480
|
-
if not os.path.exists(outDir):
|
|
1481
|
-
try:
|
|
1482
|
-
os.mkdir(outDir)
|
|
1483
|
-
except:
|
|
1484
|
-
pass
|
|
1485
|
-
|
|
1486
|
-
# Find the images
|
|
1487
|
-
images = os.listdir(inDir)
|
|
1488
|
-
images.sort()
|
|
1489
|
-
|
|
1490
|
-
# Get each image
|
|
1491
|
-
a_img = images[a_idx]
|
|
1492
|
-
b_img = images[b_idx]
|
|
1493
|
-
|
|
1494
|
-
# Get image name
|
|
1495
|
-
img_name = a_img.split('.')[0]
|
|
1496
|
-
|
|
1497
|
-
# Open each image
|
|
1498
|
-
a_img = imread(os.path.join(inDir, a_img))
|
|
1499
|
-
b_img = imread(os.path.join(inDir, b_img))
|
|
1500
|
-
|
|
1501
|
-
def resize_to_pingMax(img, cropMax):
|
|
1502
|
-
ndims = img.ndim
|
|
1503
|
-
current_size = img.shape[0]
|
|
1504
|
-
if current_size < cropMax:
|
|
1505
|
-
# Pad with zeros
|
|
1506
|
-
if ndims == 2:
|
|
1507
|
-
padding = ((0, cropMax - current_size), (0, 0))
|
|
1508
|
-
else:
|
|
1509
|
-
padding = ((0, cropMax - current_size), (0, 0), (0,0))
|
|
1510
|
-
resized_img = np.pad(img, padding, mode='constant', constant_values=0)
|
|
1511
|
-
elif current_size > cropMax:
|
|
1512
|
-
# Truncate the array
|
|
1513
|
-
resized_img = img[:cropMax, :]
|
|
1514
|
-
else:
|
|
1515
|
-
# No change needed
|
|
1516
|
-
resized_img = img
|
|
1517
|
-
return resized_img
|
|
1518
|
-
|
|
1519
|
-
# Resize a_img and b_img
|
|
1520
|
-
a_img = resize_to_pingMax(a_img, cropMax)
|
|
1521
|
-
b_img = resize_to_pingMax(b_img, cropMax)
|
|
1522
|
-
|
|
1523
|
-
# Set stride based on first image
|
|
1524
|
-
# stride = int(round(a_img.shape[1] * stride, 0))
|
|
1525
|
-
if stride == 0:
|
|
1526
|
-
to_stride = 1
|
|
1527
|
-
else:
|
|
1528
|
-
to_stride = int(round(self.nchunk * stride, 0))
|
|
1529
|
-
|
|
1530
|
-
# Set window size based on first image
|
|
1531
|
-
# winSize = a_img.shape[1]
|
|
1532
|
-
winSize = self.nchunk
|
|
1533
|
-
|
|
1534
|
-
# Concatenate images
|
|
1535
|
-
movWin = np.concatenate((a_img, b_img), axis=1)
|
|
1536
|
-
|
|
1537
|
-
# Last window idx
|
|
1538
|
-
lastWinIDX = self.nchunk
|
|
1539
|
-
|
|
1540
|
-
win = 0
|
|
1541
|
-
# Iterate each window
|
|
1542
|
-
while win < lastWinIDX:
|
|
1543
|
-
window = movWin[:, win:win+winSize]
|
|
1544
|
-
|
|
1545
|
-
zero = self._addZero(win)
|
|
1546
|
-
|
|
1547
|
-
# Save window
|
|
1548
|
-
imsave(os.path.join(outDir, img_name+'_'+zero+str(win)+'.jpg'), window)
|
|
1549
|
-
|
|
1550
|
-
win += to_stride
|
|
1551
|
-
|
|
1552
|
-
return
|
|
1553
|
-
|
|
1554
1456
|
|
|
1555
1457
|
|
|
1556
1458
|
############################################################################
|
pingmapper/funcs_model.py
CHANGED
|
@@ -59,6 +59,9 @@ import itertools
|
|
|
59
59
|
# from doodleverse_utils.model_imports import *
|
|
60
60
|
# from doodleverse_utils.prediction_imports import *
|
|
61
61
|
|
|
62
|
+
# Flag to track if depth detection dependencies are available
|
|
63
|
+
DEPTH_DETECTION_AVAILABLE = False
|
|
64
|
+
|
|
62
65
|
try:
|
|
63
66
|
import tensorflow as tf
|
|
64
67
|
import tensorflow.keras.backend as K
|
|
@@ -74,10 +77,33 @@ try:
|
|
|
74
77
|
from doodleverse_utils.imports import *
|
|
75
78
|
from doodleverse_utils.model_imports import *
|
|
76
79
|
from doodleverse_utils.prediction_imports import *
|
|
77
|
-
|
|
80
|
+
|
|
81
|
+
DEPTH_DETECTION_AVAILABLE = True
|
|
82
|
+
except ImportError as e:
|
|
83
|
+
import traceback
|
|
84
|
+
print('\n' + '='*80)
|
|
78
85
|
print('Could not import Tensorflow and/or Transformers. Please install these packages to use PING-Mapper.')
|
|
79
86
|
print('They are not needed for GhostVision. Trying to continue...')
|
|
80
|
-
|
|
87
|
+
print('\nDetailed error information:')
|
|
88
|
+
print('-'*80)
|
|
89
|
+
print(f'Error Type: {type(e).__name__}')
|
|
90
|
+
print(f'Error Message: {str(e)}')
|
|
91
|
+
print('-'*80)
|
|
92
|
+
traceback.print_exc()
|
|
93
|
+
print('='*80 + '\n')
|
|
94
|
+
DEPTH_DETECTION_AVAILABLE = False
|
|
95
|
+
except Exception as e:
|
|
96
|
+
import traceback
|
|
97
|
+
print('\n' + '='*80)
|
|
98
|
+
print('Unexpected error while importing depth detection dependencies.')
|
|
99
|
+
print('Detailed error information:')
|
|
100
|
+
print('-'*80)
|
|
101
|
+
print(f'Error Type: {type(e).__name__}')
|
|
102
|
+
print(f'Error Message: {str(e)}')
|
|
103
|
+
print('-'*80)
|
|
104
|
+
traceback.print_exc()
|
|
105
|
+
print('='*80 + '\n')
|
|
106
|
+
DEPTH_DETECTION_AVAILABLE = False
|
|
81
107
|
|
|
82
108
|
################################################################################
|
|
83
109
|
# model_imports.py from segmentation_gym #
|
|
@@ -113,6 +139,13 @@ def initModel(weights, configfile, USE_GPU=False):
|
|
|
113
139
|
--------------------
|
|
114
140
|
self._detectDepth()
|
|
115
141
|
'''
|
|
142
|
+
|
|
143
|
+
if not DEPTH_DETECTION_AVAILABLE:
|
|
144
|
+
raise ImportError(
|
|
145
|
+
"TensorFlow, Transformers, and/or Doodleverse Utils are not installed. "
|
|
146
|
+
"These packages are required for automatic depth detection. "
|
|
147
|
+
"Please install them using: pip install tensorflow transformers doodleverse-utils"
|
|
148
|
+
)
|
|
116
149
|
|
|
117
150
|
SEED=42
|
|
118
151
|
np.random.seed(SEED)
|
pingmapper/gui_main.py
CHANGED
|
@@ -10,12 +10,6 @@ SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
|
|
|
10
10
|
PACKAGE_DIR = os.path.dirname(SCRIPT_DIR)
|
|
11
11
|
sys.path.append(PACKAGE_DIR)
|
|
12
12
|
|
|
13
|
-
# # For Debug
|
|
14
|
-
# from funcs_common import *
|
|
15
|
-
# from main_readFiles import read_master_func
|
|
16
|
-
# from main_rectify import rectify_master_func
|
|
17
|
-
# from main_mapSubstrate import map_master_func
|
|
18
|
-
|
|
19
13
|
from pingmapper.funcs_common import *
|
|
20
14
|
from pingmapper.main_readFiles import read_master_func
|
|
21
15
|
from pingmapper.main_rectify import rectify_master_func
|
pingmapper/main_mapSubstrate.py
CHANGED
|
@@ -35,12 +35,6 @@ SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
|
|
|
35
35
|
PACKAGE_DIR = os.path.dirname(SCRIPT_DIR)
|
|
36
36
|
sys.path.append(PACKAGE_DIR)
|
|
37
37
|
|
|
38
|
-
# # For debug
|
|
39
|
-
# from funcs_common import *
|
|
40
|
-
# from class_mapSubstrateObj import mapSubObj
|
|
41
|
-
# from class_portstarObj import portstarObj
|
|
42
|
-
# from funcs_model import *
|
|
43
|
-
|
|
44
38
|
from pingmapper.funcs_common import *
|
|
45
39
|
from pingmapper.class_mapSubstrateObj import mapSubObj
|
|
46
40
|
from pingmapper.class_portstarObj import portstarObj
|
|
@@ -85,8 +79,6 @@ def map_master_func(logfilename='',
|
|
|
85
79
|
mask_wc=False,
|
|
86
80
|
spdCor=False,
|
|
87
81
|
maxCrop=False,
|
|
88
|
-
moving_window=False,
|
|
89
|
-
window_stride=0.1,
|
|
90
82
|
USE_GPU=False,
|
|
91
83
|
remShadow=0,
|
|
92
84
|
detectDep=0,
|
pingmapper/main_readFiles.py
CHANGED
|
@@ -36,12 +36,8 @@ SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
|
|
|
36
36
|
PACKAGE_DIR = os.path.dirname(SCRIPT_DIR)
|
|
37
37
|
sys.path.append(PACKAGE_DIR)
|
|
38
38
|
|
|
39
|
-
# # For debug
|
|
40
|
-
# from funcs_common import *
|
|
41
|
-
# from class_sonObj import sonObj
|
|
42
|
-
# from class_portstarObj import portstarObj
|
|
43
|
-
|
|
44
39
|
from pingmapper.funcs_common import *
|
|
40
|
+
from pingmapper.funcs_model import DEPTH_DETECTION_AVAILABLE
|
|
45
41
|
from pingmapper.class_sonObj import sonObj
|
|
46
42
|
from pingmapper.class_portstarObj import portstarObj
|
|
47
43
|
|
|
@@ -49,10 +45,29 @@ import shutil
|
|
|
49
45
|
|
|
50
46
|
try:
|
|
51
47
|
from doodleverse_utils.imports import *
|
|
52
|
-
except ImportError:
|
|
48
|
+
except ImportError as e:
|
|
49
|
+
import traceback
|
|
50
|
+
print('\n' + '='*80)
|
|
53
51
|
print('Could not import Doodleverse Utils. Please install these packages to use PING-Mapper.')
|
|
54
52
|
print('They are not needed for GhostVision. Trying to continue...')
|
|
55
|
-
|
|
53
|
+
print('\nDetailed error information:')
|
|
54
|
+
print('-'*80)
|
|
55
|
+
print(f'Error Type: {type(e).__name__}')
|
|
56
|
+
print(f'Error Message: {str(e)}')
|
|
57
|
+
print('-'*80)
|
|
58
|
+
traceback.print_exc()
|
|
59
|
+
print('='*80 + '\n')
|
|
60
|
+
except Exception as e:
|
|
61
|
+
import traceback
|
|
62
|
+
print('\n' + '='*80)
|
|
63
|
+
print('Unexpected error while importing Doodleverse Utils.')
|
|
64
|
+
print('Detailed error information:')
|
|
65
|
+
print('-'*80)
|
|
66
|
+
print(f'Error Type: {type(e).__name__}')
|
|
67
|
+
print(f'Error Message: {str(e)}')
|
|
68
|
+
print('-'*80)
|
|
69
|
+
traceback.print_exc()
|
|
70
|
+
print('='*80 + '\n')
|
|
56
71
|
|
|
57
72
|
from scipy.signal import savgol_filter
|
|
58
73
|
|
|
@@ -101,8 +116,6 @@ def read_master_func(logfilename='',
|
|
|
101
116
|
mask_wc=False,
|
|
102
117
|
spdCor=False,
|
|
103
118
|
maxCrop=False,
|
|
104
|
-
moving_window=False,
|
|
105
|
-
window_stride=0.1,
|
|
106
119
|
USE_GPU=False,
|
|
107
120
|
remShadow=0,
|
|
108
121
|
detectDep=0,
|
|
@@ -839,7 +852,7 @@ def read_master_func(logfilename='',
|
|
|
839
852
|
elif (att == "inst_dep_m") and (attAvg == 0): # Automatically detect depth if no instrument depth
|
|
840
853
|
valid=False
|
|
841
854
|
invalid[son.beam+"."+att] = False
|
|
842
|
-
detectDep=
|
|
855
|
+
detectDep=1
|
|
843
856
|
else:
|
|
844
857
|
valid=False
|
|
845
858
|
invalid[son.beam+"."+att] = False
|
|
@@ -997,45 +1010,53 @@ def read_master_func(logfilename='',
|
|
|
997
1010
|
del son
|
|
998
1011
|
|
|
999
1012
|
chunks = np.unique(chunks).astype(int)
|
|
1000
|
-
|
|
1001
1013
|
# # Automatically estimate depth
|
|
1002
1014
|
if detectDep > 0:
|
|
1003
|
-
|
|
1015
|
+
# Check if depth detection dependencies are available
|
|
1016
|
+
if not DEPTH_DETECTION_AVAILABLE:
|
|
1017
|
+
print('\n\nCannot estimate depth automatically:')
|
|
1018
|
+
print('TensorFlow, Transformers, and/or Doodleverse Utils are not installed.')
|
|
1019
|
+
print('These packages are required for automatic depth detection.')
|
|
1020
|
+
print('Please install them using: pip install tensorflow transformers doodleverse-utils')
|
|
1021
|
+
print('Skipping automatic depth estimation...\n')
|
|
1022
|
+
detectDep = 0
|
|
1023
|
+
else:
|
|
1024
|
+
print('\n\nAutomatically estimating depth for', len(chunks), 'chunks:')
|
|
1004
1025
|
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1026
|
+
#Dictionary to store chunk : np.array(depth estimate)
|
|
1027
|
+
psObj.portDepDetect = {}
|
|
1028
|
+
psObj.starDepDetect = {}
|
|
1008
1029
|
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1030
|
+
# Estimate depth using:
|
|
1031
|
+
# Zheng et al. 2021
|
|
1032
|
+
# Load model weights and configuration file
|
|
1033
|
+
if detectDep == 1:
|
|
1013
1034
|
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1035
|
+
# Store configuration file and model weights
|
|
1036
|
+
# These were downloaded at the beginning of the script
|
|
1037
|
+
depthModelVer = 'Bedpick_Zheng2021_Segmentation_unet_v1.0'
|
|
1038
|
+
psObj.configfile = os.path.join(modelDir, depthModelVer, 'config', depthModelVer+'.json')
|
|
1039
|
+
psObj.weights = os.path.join(modelDir, depthModelVer, 'weights', depthModelVer+'_fullmodel.h5')
|
|
1040
|
+
print('\n\tUsing Zheng et al. 2021 method. Loading model:', os.path.basename(psObj.weights))
|
|
1020
1041
|
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1042
|
+
# With binary thresholding
|
|
1043
|
+
elif detectDep == 2:
|
|
1044
|
+
print('\n\tUsing binary thresholding...')
|
|
1024
1045
|
|
|
1025
|
-
|
|
1026
|
-
|
|
1046
|
+
# Parallel estimate depth for each chunk using appropriate method
|
|
1047
|
+
r = Parallel(n_jobs=np.min([len(chunks), threadCnt]))(delayed(psObj._detectDepth)(detectDep, int(chunk), USE_GPU, tileFile) for chunk in tqdm(chunks))
|
|
1027
1048
|
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1049
|
+
# store the depth predictions in the class
|
|
1050
|
+
for ret in r:
|
|
1051
|
+
psObj.portDepDetect[ret[2]] = ret[0]
|
|
1052
|
+
psObj.starDepDetect[ret[2]] = ret[1]
|
|
1053
|
+
del ret
|
|
1054
|
+
del r
|
|
1034
1055
|
|
|
1035
|
-
|
|
1036
|
-
|
|
1056
|
+
# Flag indicating depth autmatically estimated
|
|
1057
|
+
autoBed = True
|
|
1037
1058
|
|
|
1038
|
-
|
|
1059
|
+
saveDepth = True
|
|
1039
1060
|
|
|
1040
1061
|
# Don't estimate depth, use instrument depth estimate (sonar derived)
|
|
1041
1062
|
elif detectDep == 0:
|
|
@@ -1067,9 +1088,10 @@ def read_master_func(logfilename='',
|
|
|
1067
1088
|
|
|
1068
1089
|
sonDF['dep_m_Method'] = 'Instrument Depth'
|
|
1069
1090
|
sonDF['dep_m_smth'] = False
|
|
1070
|
-
sonDF['dep_m_adjBy'] = adjDep
|
|
1071
|
-
|
|
1091
|
+
sonDF['dep_m_adjBy'] = adjDep
|
|
1092
|
+
|
|
1072
1093
|
dep = sonDF['inst_dep_m']
|
|
1094
|
+
|
|
1073
1095
|
if smthDep:
|
|
1074
1096
|
dep = savgol_filter(dep, 51, 3)
|
|
1075
1097
|
|
|
@@ -1077,11 +1099,23 @@ def read_master_func(logfilename='',
|
|
|
1077
1099
|
dep[dep==0] = np.nan
|
|
1078
1100
|
dep = np.asarray(dep)
|
|
1079
1101
|
nans = np.isnan(dep)
|
|
1080
|
-
dep[nans] = np.interp(np.flatnonzero(nans), np.flatnonzero(~nans), dep[~nans])
|
|
1081
1102
|
|
|
1082
|
-
|
|
1103
|
+
# Only interpolate if there are valid (non-NaN) values
|
|
1104
|
+
if np.any(~nans):
|
|
1105
|
+
# There are some valid values, so we can interpolate
|
|
1106
|
+
dep[nans] = np.interp(np.flatnonzero(nans), np.flatnonzero(~nans), dep[~nans])
|
|
1107
|
+
|
|
1108
|
+
sonDF['dep_m'] = dep + adjDep
|
|
1109
|
+
|
|
1110
|
+
sonDF.to_csv(son.sonMetaFile, index=False, float_format='%.14f')
|
|
1111
|
+
else:
|
|
1112
|
+
# All values are NaN - cannot interpolate
|
|
1113
|
+
print("\nWarning: All instrument depth values are NaN or zero. Cannot interpolate depth.")
|
|
1114
|
+
print("This may indicate missing depth data in the sonar file.")
|
|
1115
|
+
|
|
1116
|
+
# sonDF['dep_m'] = dep + adjDep
|
|
1083
1117
|
|
|
1084
|
-
sonDF.to_csv(son.sonMetaFile, index=False, float_format='%.14f')
|
|
1118
|
+
# sonDF.to_csv(son.sonMetaFile, index=False, float_format='%.14f')
|
|
1085
1119
|
del sonDF, son.sonMetaDF
|
|
1086
1120
|
son._cleanup()
|
|
1087
1121
|
|
|
@@ -1433,83 +1467,6 @@ def read_master_func(logfilename='',
|
|
|
1433
1467
|
# son._exportTilesSpd(i, tileFile=imgType, spdCor=spdCor, mask_shdw=mask_shdw, maxCrop=maxCrop)
|
|
1434
1468
|
# sys.exit()
|
|
1435
1469
|
|
|
1436
|
-
if moving_window and not spdCor:
|
|
1437
|
-
|
|
1438
|
-
# Crop all images to most common range
|
|
1439
|
-
son._loadSonMeta()
|
|
1440
|
-
sDF = son.sonMetaDF
|
|
1441
|
-
|
|
1442
|
-
rangeCnt = np.unique(sDF['ping_cnt'], return_counts=True)
|
|
1443
|
-
pingMaxi = np.argmax(rangeCnt[1])
|
|
1444
|
-
pingMax = int(rangeCnt[0][pingMaxi])
|
|
1445
|
-
|
|
1446
|
-
depCnt = np.unique(sDF['dep_m'], return_counts=True)
|
|
1447
|
-
depMaxi = np.argmax(depCnt[1])
|
|
1448
|
-
depMax = int(depCnt[0][depMaxi]/sDF['pixM'][0])
|
|
1449
|
-
depMax += 50
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
# Remove first chunk
|
|
1453
|
-
chunks.sort()
|
|
1454
|
-
chunks = chunks[1:]
|
|
1455
|
-
|
|
1456
|
-
# Get types of files exported
|
|
1457
|
-
tileType = []
|
|
1458
|
-
if son.wcp:
|
|
1459
|
-
tileType.append('wcp')
|
|
1460
|
-
if son.wcm:
|
|
1461
|
-
tileType.append('wcm')
|
|
1462
|
-
if son.wcr_src:
|
|
1463
|
-
tileType.append('src')
|
|
1464
|
-
if son.wco:
|
|
1465
|
-
tileType.append('wco')
|
|
1466
|
-
|
|
1467
|
-
Parallel(n_jobs= np.min([len(chunks), threadCnt]))(delayed(son._exportMovWin)(i, stride=window_stride, tileType=tileType, pingMax=pingMax, depMax=depMax) for i in tqdm(chunks))
|
|
1468
|
-
|
|
1469
|
-
# son._exportMovWin(chunks,
|
|
1470
|
-
# stride=window_stride,
|
|
1471
|
-
# tileType=tileType)
|
|
1472
|
-
|
|
1473
|
-
for t in tileType:
|
|
1474
|
-
shutil.rmtree(os.path.join(son.outDir, t))
|
|
1475
|
-
|
|
1476
|
-
# Create a movie
|
|
1477
|
-
if tileFile == '.mp4' and moving_window and not spdCor:
|
|
1478
|
-
for t in tileType:
|
|
1479
|
-
inDir = os.path.join(son.outDir, t+'_mw')
|
|
1480
|
-
|
|
1481
|
-
imgs = os.listdir(inDir)
|
|
1482
|
-
imgs.sort()
|
|
1483
|
-
|
|
1484
|
-
frame = cv2.imread(os.path.join(inDir, imgs[0]))
|
|
1485
|
-
height, width, layers = frame.shape
|
|
1486
|
-
|
|
1487
|
-
outName = '_'.join(imgs[0].split('_')[:-2])
|
|
1488
|
-
vidPath = os.path.join(inDir, outName+tileFile)
|
|
1489
|
-
|
|
1490
|
-
video = cv2.VideoWriter(vidPath, cv2.VideoWriter_fourcc(*'mp4v'), 3, (width, height))
|
|
1491
|
-
for image in imgs:
|
|
1492
|
-
frame = cv2.imread(os.path.join(inDir, image))
|
|
1493
|
-
|
|
1494
|
-
# Pad end
|
|
1495
|
-
if frame.shape[1] < nchunk:
|
|
1496
|
-
n_dims = frame.ndim
|
|
1497
|
-
if n_dims == 2:
|
|
1498
|
-
padding = ((0,0), (0, nchunk-frame.shape[1]))
|
|
1499
|
-
else:
|
|
1500
|
-
padding = ((0,0), (0, nchunk-frame.shape[1]), (0,0))
|
|
1501
|
-
frame = np.pad(frame, padding, mode='constant', constant_values=0)
|
|
1502
|
-
|
|
1503
|
-
video.write(frame)
|
|
1504
|
-
|
|
1505
|
-
video.release()
|
|
1506
|
-
|
|
1507
|
-
# Removs
|
|
1508
|
-
for image in imgs:
|
|
1509
|
-
os.remove(os.path.join(inDir, image))
|
|
1510
|
-
|
|
1511
|
-
# shutil.rmtree(os.path.join(son.outDir, t))
|
|
1512
|
-
|
|
1513
1470
|
son._pickleSon()
|
|
1514
1471
|
|
|
1515
1472
|
|
pingmapper/main_rectify.py
CHANGED
|
@@ -38,12 +38,6 @@ SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
|
|
|
38
38
|
PACKAGE_DIR = os.path.dirname(SCRIPT_DIR)
|
|
39
39
|
sys.path.append(PACKAGE_DIR)
|
|
40
40
|
|
|
41
|
-
# # For Debug
|
|
42
|
-
# from funcs_common import *
|
|
43
|
-
# from class_rectObj import rectObj
|
|
44
|
-
# from class_portstarObj import portstarObj
|
|
45
|
-
# from funcs_rectify import smoothTrackline
|
|
46
|
-
|
|
47
41
|
from pingmapper.funcs_common import *
|
|
48
42
|
from pingmapper.class_rectObj import rectObj
|
|
49
43
|
from pingmapper.class_portstarObj import portstarObj
|
|
@@ -90,8 +84,6 @@ def rectify_master_func(logfilename='',
|
|
|
90
84
|
mask_wc=False,
|
|
91
85
|
spdCor=False,
|
|
92
86
|
maxCrop=False,
|
|
93
|
-
moving_window=False,
|
|
94
|
-
window_stride=0.1,
|
|
95
87
|
USE_GPU=False,
|
|
96
88
|
remShadow=0,
|
|
97
89
|
detectDep=0,
|
pingmapper/version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = '5.0.
|
|
1
|
+
__version__ = '5.0.16'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pingmapper
|
|
3
|
-
Version: 5.0.
|
|
3
|
+
Version: 5.0.16
|
|
4
4
|
Summary: Open-source interface for processing recreation-grade side scan sonar datasets and reproducibly mapping benthic habitat
|
|
5
5
|
Author: Cameron Bodine, Daniel Buscombe
|
|
6
6
|
Author-email: bodine.cs@gmail.email
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
pingmapper/__init__.py,sha256=8zLGg-DfQhnDl2Ky0n-zXpN-8e-g7iR0AcaI4l4Vvpk,32
|
|
2
|
+
pingmapper/__main__.py,sha256=dgFUyR5ZtgcrSOkq0EdLj_OZVdBKzsP0iHw2V0791wM,1367
|
|
3
|
+
pingmapper/class_mapSubstrateObj.py,sha256=txB9YqXfVgDFi628jo2F1RtEw1lCNR8wYpkhy94bn0U,37036
|
|
4
|
+
pingmapper/class_portstarObj.py,sha256=LSdOypJT2USyM31NxBiY3EwWv-IxdoSr_SCCoEEVluc,108002
|
|
5
|
+
pingmapper/class_rectObj.py,sha256=JSfSIa5hckvcB8uFMkBMa0Vz4J6aGPWq346RzowfiMQ,96327
|
|
6
|
+
pingmapper/class_sonObj.py,sha256=YLAn2TPQeX1R8I4IxG2ri--bp3RMZHVM4F_Nhr3h3ww,78263
|
|
7
|
+
pingmapper/class_sonObj_nadirgaptest.py,sha256=DSFgjEgpwPgDZslw0vXGGBNFYlcoUa2Ufbr8i_Uqdhc,76915
|
|
8
|
+
pingmapper/funcs_common.py,sha256=0uZErbrWZ_jhOLOc-CT--8OX4eHF9qE_E5Wwy60aSvQ,15300
|
|
9
|
+
pingmapper/funcs_model.py,sha256=K3dLDSqS7_4e0tzNy0jD9ms6Q7N14XrPFHMFUYmA6nI,9854
|
|
10
|
+
pingmapper/funcs_rectify.py,sha256=bAFWbNr4dyOuQzF1j4Je-K4zxfJZUjISc0nYrOot8Ng,12418
|
|
11
|
+
pingmapper/gui_main.py,sha256=yW50qv2pNM4C10_W2-uj881EAl9SX6h67GwxPSn-l9U,34682
|
|
12
|
+
pingmapper/main_mapSubstrate.py,sha256=l16mSGiAyeOD2gUyFdTXcyRQhrOMJ_vy-wQzyAWHXzM,20967
|
|
13
|
+
pingmapper/main_readFiles.py,sha256=WmuDzOL5XnPKtkFb7Y9wPfzY0RmdATBi9Q2DTwjxT8U,56117
|
|
14
|
+
pingmapper/main_rectify.py,sha256=QEcnQBNRrp31Vl2EsInDW8J_rG-_fVNMcmkuL9o1waw,19953
|
|
15
|
+
pingmapper/test_PINGMapper.py,sha256=-SYMsdK-tTodXp5dCFSWPn-KRN7-OjX6OwjQ2-8hQg0,14176
|
|
16
|
+
pingmapper/test_time.py,sha256=uHT0mtLDP1J6w-snoELyk4UzZ2LrDeF6jGgJJVloalg,750
|
|
17
|
+
pingmapper/version.py,sha256=fE94lNPi9fbu0LzNLyP7Ayj3pfFHkUrC276eqo_kiZI,22
|
|
18
|
+
pingmapper-5.0.16.data/data/pingmapper_config/default_params.json,sha256=NCFcjj7MF0y7ur7ufX3qwmoPjav1ICEpsi8tzVJaqRw,1305
|
|
19
|
+
pingmapper-5.0.16.dist-info/licenses/LICENSE,sha256=lowDp_th1CGR0Z224a-jYRi-oNFe_0fdldL3USXhX-k,1095
|
|
20
|
+
pingmapper-5.0.16.dist-info/METADATA,sha256=2VVrSBaoaldHbG72cF02WKH0nAIJ4ddG3FEZpA3GdPc,9203
|
|
21
|
+
pingmapper-5.0.16.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
22
|
+
pingmapper-5.0.16.dist-info/top_level.txt,sha256=RlV4sDoE3uIIDzNMOjN2t012Ia_jsblNVojJvg4q84w,11
|
|
23
|
+
pingmapper-5.0.16.dist-info/RECORD,,
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
pingmapper/__init__.py,sha256=8zLGg-DfQhnDl2Ky0n-zXpN-8e-g7iR0AcaI4l4Vvpk,32
|
|
2
|
-
pingmapper/__main__.py,sha256=dgFUyR5ZtgcrSOkq0EdLj_OZVdBKzsP0iHw2V0791wM,1367
|
|
3
|
-
pingmapper/class_mapSubstrateObj.py,sha256=txB9YqXfVgDFi628jo2F1RtEw1lCNR8wYpkhy94bn0U,37036
|
|
4
|
-
pingmapper/class_portstarObj.py,sha256=vrk7zVdg0apQEashg2cxcG2EfUgNu01f6SSwyCadwiA,106951
|
|
5
|
-
pingmapper/class_rectObj.py,sha256=JSfSIa5hckvcB8uFMkBMa0Vz4J6aGPWq346RzowfiMQ,96327
|
|
6
|
-
pingmapper/class_sonObj.py,sha256=BhC3s-mGA-8P_5VGdN4jqjhhgLlusjyyJs5Wi_knaqg,81398
|
|
7
|
-
pingmapper/class_sonObj_nadirgaptest.py,sha256=DSFgjEgpwPgDZslw0vXGGBNFYlcoUa2Ufbr8i_Uqdhc,76915
|
|
8
|
-
pingmapper/funcs_common.py,sha256=0uZErbrWZ_jhOLOc-CT--8OX4eHF9qE_E5Wwy60aSvQ,15300
|
|
9
|
-
pingmapper/funcs_model.py,sha256=tvAISiYLOD9vO10xitrUq8qKmtIQVvN1NC4FQqbrqv8,8661
|
|
10
|
-
pingmapper/funcs_rectify.py,sha256=bAFWbNr4dyOuQzF1j4Je-K4zxfJZUjISc0nYrOot8Ng,12418
|
|
11
|
-
pingmapper/gui_main.py,sha256=6mu8GhewwJGcsFRBU5tbGiaunZzEgQdCjOzRok76e_0,34873
|
|
12
|
-
pingmapper/main_mapSubstrate.py,sha256=E7jYmKHATXSk5XWhPR-pWH0288wurhX5ph94Gp_v0eg,21217
|
|
13
|
-
pingmapper/main_readFiles.py,sha256=1J0m2Hu4tJ0tBn6CHE1qKWszcGDE4rRljA-2_Fp9bnQ,57784
|
|
14
|
-
pingmapper/main_rectify.py,sha256=uOKHHYrjVa3PVtU26G_fL9hTV7sZkvIzEgk3VJd3tVA,20217
|
|
15
|
-
pingmapper/test_PINGMapper.py,sha256=-SYMsdK-tTodXp5dCFSWPn-KRN7-OjX6OwjQ2-8hQg0,14176
|
|
16
|
-
pingmapper/test_time.py,sha256=uHT0mtLDP1J6w-snoELyk4UzZ2LrDeF6jGgJJVloalg,750
|
|
17
|
-
pingmapper/version.py,sha256=oJb4eGr3rE1lNQqvMcsFJQgH8FvMgC3n0GkjM9cDd9o,22
|
|
18
|
-
pingmapper-5.0.14.data/data/pingmapper_config/default_params.json,sha256=NCFcjj7MF0y7ur7ufX3qwmoPjav1ICEpsi8tzVJaqRw,1305
|
|
19
|
-
pingmapper-5.0.14.dist-info/licenses/LICENSE,sha256=lowDp_th1CGR0Z224a-jYRi-oNFe_0fdldL3USXhX-k,1095
|
|
20
|
-
pingmapper-5.0.14.dist-info/METADATA,sha256=bC7k6TtRJNWMDSj9yb39xh0nvmlG8BU4dTT8fZDree0,9203
|
|
21
|
-
pingmapper-5.0.14.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
22
|
-
pingmapper-5.0.14.dist-info/top_level.txt,sha256=RlV4sDoE3uIIDzNMOjN2t012Ia_jsblNVojJvg4q84w,11
|
|
23
|
-
pingmapper-5.0.14.dist-info/RECORD,,
|
{pingmapper-5.0.14.data → pingmapper-5.0.16.data}/data/pingmapper_config/default_params.json
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|