import scipy.io as scio
import os
import ctypes
import datetime
import numpy as np
start = datetime.datetime.now()
cur_path = os.path.dirname(r'C:UsersAdministratorDesktopcode_and_datacodeHessianFilter\')
dll_path = os.path.join(cur_path,'HessianFilter.dll')
print dll_path
dll = ctypes.windll.LoadLibrary(dll_path)
matPath = r'C:UsersAdministratorDesktopcode_and_datadataNodule19664.mat'
imgData = scio.loadmat(matPath)
imgDataArray = imgData['imagetest1']
widthSrc,heightSrc,sliceNumSrc = imgDataArray.shape
imgDataArray_p = (((ctypes.c_floatsliceNumSrc)heightSrc)*widthSrc)()
for i in range(widthSrc):
for j in range(heightSrc):
for k in range(sliceNumSrc):
imgDataArray_p[i][j][k] = ctypes.c_float(imgDataArray[i][j][k])
imgDataP = ctypes.POINTER(ctypes.c_float)(imgDataArray_p)
print '---------->'
HessianDot = (ctypes.c_float(widthSrcheightSrc*sliceNumSrc))()
HessianLine = (ctypes.c_float(widthSrcheightSrc*sliceNumSrc))()
HessianDot_p = ctypes.POINTER(ctypes.c_float)(HessianDot)
HessianLine_p = ctypes.POINTER(ctypes.c_float)(HessianLine)
sigma = ctypes.c_float(8)
imgSize = [widthSrc,heightSrc,sliceNumSrc]
imageSize = (ctypes.c_floatlen(imgSize))(imgSize)
imageSizeP = ctypes.POINTER(ctypes.c_float)(imageSize)
dll.RunHessianMultiThread(ctypes.byref(imgDataArray_p),sigma,ctypes.byref(imageSizeP),ctypes.byref(HessianDot_p),ctypes.byref(HessianLine_p),4)
print '--调用后-点数据--'
print HessianDot_p
print HessianDot_p[0:24]
print '--调用后-线数据--'
print HessianLine_p
print HessianLine_p[0:24]
print '<---------Over------------->nn'
print datetime.datetime.now()-start
import scipy.io as scio
import os
import ctypes
import datetime
import numpy as np
start = datetime.datetime.now()
cur_path = os.path.dirname(r'C:UsersAdministratorDesktopcode_and_datacodeHessianFilter')
dll_path = os.path.join(cur_path,'HessianFilter.dll')
print dll_path
dll = ctypes.windll.LoadLibrary(dll_path)
matPath = r'C:UsersAdministratorDesktopcode_and_datadataNodule19664.mat'
imgData = scio.loadmat(matPath)
imgDataArray = imgData['imagetest1']
widthSrc,heightSrc,sliceNumSrc = imgDataArray.shape
imgDataArray_p = (((ctypes.c_floatsliceNumSrc)heightSrc)*widthSrc)()
for i in range(widthSrc):
for j in range(heightSrc):
for k in range(sliceNumSrc):
imgDataArray_pi[k] = ctypes.c_float(imgDataArrayi[k])
imgDataP = ctypes.POINTER(ctypes.c_float)(imgDataArray_p)
print '---------->'
HessianDot = (ctypes.c_float(widthSrcheightSrc*sliceNumSrc))()
HessianLine = (ctypes.c_float(widthSrcheightSrc*sliceNumSrc))()
HessianDot_p = ctypes.POINTER(ctypes.c_float)(HessianDot)
HessianLine_p = ctypes.POINTER(ctypes.c_float)(HessianLine)
sigma = ctypes.c_float(8)
imgSize = [widthSrc,heightSrc,sliceNumSrc]
imageSize = (ctypes.c_floatlen(imgSize))(imgSize)
imageSizeP = ctypes.POINTER(ctypes.c_float)(imageSize)
dll.RunHessianMultiThread(ctypes.byref(imgDataArray_p),sigma,ctypes.byref(imageSizeP),ctypes.byref(HessianDot_p),ctypes.byref(HessianLine_p),4)
print '--调用后-点数据--'
print HessianDot_p
print HessianDot_p[0:24]
print '--调用后-线数据--'
print HessianLine_p
print HessianLine_p[0:24]
print '<---------Over------------->nn'
print datetime.datetime.now()-start
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。