scantime = time.strftime('%Y-%m-%d %X', time.localtime(time.time()))
时间: 2024-02-28 11:44:03 浏览: 43
这段代码的作用是获取当前时间并格式化为字符串,格式为年-月-日 时:分:秒。其中,time.time() 表示当前时间的时间戳(距离1970年1月1日0时0分0秒的秒数),time.localtime() 将时间戳转换为本地时间(即当前所在时区的时间),并返回一个时间元组,time.strftime() 将时间元组转换为指定格式的字符串。最后,将格式化后的时间字符串赋值给变量 scantime。
相关问题
SELECT piats.id, piats.company.name, piats.type, piats.relatedBill, piats.relatedBill2, piats.piats, piats.item.code, piats.item.name, piats.unit.unit, piats.unit.convertFigure, piats.pallet, piats.receiver, piats.scanTime, piats.beExport, piats.exportCnt, piats.exportTime, piats.exportUserName, piats.updateInfo.creator, piats.updateInfo.createdTime, piats.updateInfo.lastOperator, piats.updateInfo.updateTime, piats.udiDi, piats.udiPi FROM com.vtradex.wms.server.model.piats.WmsPiats piats left join WmsPickTicket pick on pick.code = piats.relatedBill left join WmsASN asn on asn.code = piats.relatedBill left join piats.unit where 1=1 and (case when pick.warehouse is null then asn.warehouse else pick.warehouse end) = 1 ORDER BY piats.id DESC; 报错unexpected token: on 怎么修改
根据您提供的 SQL 语句,我发现您的 left join 子句中的表名后面没有指定 ON 条件,导致报错。您可以修改为以下代码:
```
SELECT piats.id, piats.company.name, piats.type, piats.relatedBill, piats.relatedBill2, piats.piats,
piats.item.code, piats.item.name, piats.unit.unit, piats.unit.convertFigure, piats.pallet, piats.receiver,
piats.scanTime, piats.beExport, piats.exportCnt, piats.exportTime, piats.exportUserName,
piats.updateInfo.creator, piats.updateInfo.createdTime, piats.updateInfo.lastOperator,
piats.updateInfo.updateTime, piats.udiDi, piats.udiPi
FROM com.vtradex.wms.server.model.piats.WmsPiats piats
left join WmsPickTicket pick on pick.code = piats.relatedBill
left join WmsASN asn on asn.code = piats.relatedBill
left join piats.unit unit on unit.id = piats.unit.id
where 1=1 and (case when pick.warehouse is null then asn.warehouse else pick.warehouse end) = 1
ORDER BY piats.id DESC;
```
在 left join 子句中,我增加了对 piats.unit 表连接的 ON 条件,并且修改了 where 子句的条件。希望可以帮助到您。
帮我详细解释一下这段代码 GTV_indexes = [] GTVs_sum = np.zeros((512,512)) # Find the cuts containning GTV contours minXY = 600 maxXY = -1 for time in times: path = folder+patient+'\\'+str(int(time)) # Find the filenames starting with CT minXY1,maxXY1,GTV_index = findContours(path,isPlot=False) GTV_indexes=np.append(GTV_indexes,GTV_index) if minXY>minXY1: minXY = minXY1 elif maxXY<maxXY1: maxXY = maxXY1 print('minXY={}'.format(minXY),'maxXY={}'.format(maxXY)) GTV_indexes = np.array(GTV_indexes) GTV_indexes = np.unique(GTV_indexes).astype(int) print('Cuts including GTVs: {}'.format(GTV_indexes)) writeToFile(GTV_indexes,folder+patient+'\\GTV_indexs.txt') #将DICOM文件的拍摄时间与呼吸曲线对应 #CT scanning time # 由vxp文件获取开始扫描的时刻 vxpPath = folder+patient+'\\0006863819_20200730_090003.vxp' injectTime = getInjectionTime(vxpPath) print('Initial injection time of CT from vxp file:{}'.format(injectTime)) # 得到GTV cut的扫描时刻 scanTimes = np.ones((len(times),len(cuts))) print('scan time of each phase CT') for i,time in enumerate(times,start=0): for j,cut in enumerate(cuts,start=0): filename = folder+patient+'\\'+str(int(time))+'\\CT.{}'.format(patient)+'.Image {}.dcm'.format(int(cut)) scanTime = getScanTime(filename) scanTimes[i,j] = scanTime scanTimes = scanTimes-scanTimes.min()+injectTime # 画出呼吸曲线,并得到相应的呼吸幅度 amplitudes = getBreathingCurve(vxpPath,scanTimes,isplot=1) writeToFile(scanTimes,folder+patient+'\\scanTimes.txt') writeToFile(amplitudes,folder+patient+'\\amplitudes.txt')
这段代码主要是用于处理医学图像数据,以下是代码的具体解释:
- GTV_indexes = []: 定义了一个名为GTV_indexes的空列表,用于存储包含GTV轮廓的切片序号。
- GTVs_sum = np.zeros((512,512)): 定义了一个512x512的全零数组,用于存储GTV轮廓在所有切片上的像素和。
- for time in times: 遍历所有的时间点,其中times是一个包含多个时间点的列表。
- path = folder+patient+'\\'+str(int(time)): 构建了DICOM文件的路径,其中folder和patient是两个字符串变量。
- minXY1,maxXY1,GTV_index = findContours(path,isPlot=False): 调用了findContours函数,该函数用于在DICOM图像中找到GTV轮廓,返回最小和最大切片序号以及包含GTV轮廓的切片序号。
- GTV_indexes=np.append(GTV_indexes,GTV_index): 将包含GTV轮廓的切片序号添加到GTV_indexes列表中。
- if minXY>minXY1: minXY = minXY1 elif maxXY<maxXY1: maxXY = maxXY1: 更新minXY和maxXY变量的值,以记录包含GTV轮廓的最小和最大切片序号。
- GTV_indexes = np.array(GTV_indexes) GTV_indexes = np.unique(GTV_indexes).astype(int): 将GTV_indexes列表转换成numpy数组,并去除重复值,最终得到包含GTV轮廓的切片序号列表。
- print('Cuts including GTVs: {}'.format(GTV_indexes)) writeToFile(GTV_indexes,folder+patient+'\\GTV_indexs.txt'): 打印出包含GTV轮廓的切片序号列表,并将其写入文件GTV_indexs.txt中。
- vxpPath = folder+patient+'\\0006863819_20200730_090003.vxp': 获取vxp文件的路径。
- injectTime = getInjectionTime(vxpPath): 调用getInjectionTime函数,该函数用于从vxp文件中获取CT扫描开始的时间点。
- scanTimes = np.ones((len(times),len(cuts))): 定义了一个大小为(len(times), len(cuts))的全1数组,用于存储每个切片的扫描时间。
- for i,time in enumerate(times,start=0): 遍历时间点列表,并枚举每个时间点的下标i。
- for j,cut in enumerate(cuts,start=0): 遍历切片列表,并枚举每个切片的下标j。
- filename = folder+patient+'\\'+str(int(time))+'\\CT.{}'.format(patient)+'.Image {}.dcm'.format(int(cut)): 构建了DICOM文件的路径。
- scanTime = getScanTime(filename): 调用getScanTime函数,该函数用于从DICOM文件中获取扫描时间。
- scanTimes[i,j] = scanTime: 将扫描时间赋值给scanTimes数组的第i行第j列。
- scanTimes = scanTimes-scanTimes.min()+injectTime: 将所有扫描时间减去最小扫描时间,并加上注射时间,以得到相对于注射时间的扫描时间。
- amplitudes = getBreathingCurve(vxpPath,scanTimes,isplot=1): 调用getBreathingCurve函数,该函数用于从vxp文件中获取呼吸曲线,并返回呼吸幅度列表。
- writeToFile(scanTimes,folder+patient+'\\scanTimes.txt')和writeToFile(amplitudes,folder+patient+'\\amplitudes.txt'): 将扫描时间和呼吸幅度分别写入文件scanTimes.txt和amplitudes.txt中。
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![7z](https://img-home.csdnimg.cn/images/20210720083312.png)