PlusLib
2.9.0
Software library for tracked ultrasound image acquisition, calibration, and processing.
PlusDoc
scripts
ModifyTimestamp.py
Go to the documentation of this file.
1
import
os
2
3
def
modifyTimestamp
(f):
4
os.rename( f, f+
"~"
)
5
destination = open( f,
"w"
)
6
source = open( f+
"~"
,
"r"
)
7
for
line
in
source:
8
if
line.find(
"_Timestamp = "
) != -1:
9
indexOfSeq = line.find(
"Seq_Frame"
)
10
frameNum =
int
(line[indexOfSeq+9:indexOfSeq+13])
11
if
frameNum < 10:
12
frameNumStr =
'000{0}'
.format(str(frameNum))
13
else
:
14
frameNumStr =
'00{0}'
.format(str(frameNum))
15
newString =
"Seq_Frame"
+ frameNumStr +
"_Timestamp = "
+ str(frameNum*0.5) +
"\n"
16
17
destination.write(newString)
18
else
:
19
destination.write(line)
20
source.close()
21
destination.close()
22
os.unlink(f+
"~"
)
23
return
24
25
if
__name__ ==
'__main__'
:
26
modifyTimestamp
(
"C:\devel\PlusBuild-bin-x32\PlusLib\data\TestImages\SingleWallCalibrationTest.mha"
)
int
int
Definition:
phidget22.h:3069
ModifyTimestamp.modifyTimestamp
def modifyTimestamp(f)
Definition:
ModifyTimestamp.py:3
Generated on Fri Nov 15 2024 01:47:32 for PlusLib by
1.8.15