Y
yuyaxuan0
Hey guys,
I have a python script that will call an external exe file. Code is kind of like this:
import sys
import os
from helper_functions import strContains
if (len(sys.argv) != 4):
print('Usage of script: export_mirax_data <pathToSourceMiraxData> <pathToResultData> <tileSize>')
else:
print('Script to export mirax data')
print('---------------------------')
# default parameters for exporting
zoomLevel = 0 # 0 (original) - 9 (whole slide on one image)
tileHeight = 2048 # has to be a multiple of 256
tileWidth = 2048 # has to be a multiple of 256
fileFormat = "png" # jpg, png and bmp are allowed
mapFileFormat = "png" # xml, png and bmp are allowed
# implicitly needed parameters
MiraxSlideExporter = "MrxSlideExport.exe"
slicePath = sys.argv[1]
pathToResultData = sys.argv[2]
tileHeight = sys.argv[3]
tileWidth = sys.argv[3]
# slices = os.listdir(pathToSourceMiraxData)
# sys.argv[1]
# sys.argv[2]
# create command-line for system-call of mirax-slide-exporter
# -e exports the slide
# -i saves slide information in outputfolder
# -a optional
# -n only tiles which contain information are exported
# -s + pathToSourceMiraxData + \
cmdForExportingSlicesToTiles = \
MiraxSlideExporter + \
" -i " + \
" -e " + \
" -z " + str(zoomLevel) + \
" -t " + str(tileHeight) + " " + str(tileWidth) + \
" -f " + str(fileFormat) + \
" -m " + str(mapFileFormat) + \
" "
#cmd = "D:\\programs\\MIRAX_SlideAC_SDK\\Bin\\MrxSlideExport.exe -s D:\\fit\\projects\\bayer\\KidneyLiver\\MiraxScanner\\Slides\\L10 -e -o D:\\fit\\projects\\bayer\\KidneyLiver\\MiraxScanner\\Output\\L10 -z 5 -f png"
#os.system(cmd)
#msg = os.popen(cmd, mode='r', buffering=-1) # does not work
#print(msg)
# run through slices in given source-path
cmd = cmdForExportingSlicesToTiles + " -s " + slicePath + " -o " + pathToResultData
print(cmd)
os.system(cmd)
So the problem is that is says it doesn't have sufficient memory.
The weired thing is that if I just ran the exe file directly in cmd console, it's working without any memory problem. I am wondering whether if it's some kind of python issue limits the memory that we can use??
I have a python script that will call an external exe file. Code is kind of like this:
import sys
import os
from helper_functions import strContains
if (len(sys.argv) != 4):
print('Usage of script: export_mirax_data <pathToSourceMiraxData> <pathToResultData> <tileSize>')
else:
print('Script to export mirax data')
print('---------------------------')
# default parameters for exporting
zoomLevel = 0 # 0 (original) - 9 (whole slide on one image)
tileHeight = 2048 # has to be a multiple of 256
tileWidth = 2048 # has to be a multiple of 256
fileFormat = "png" # jpg, png and bmp are allowed
mapFileFormat = "png" # xml, png and bmp are allowed
# implicitly needed parameters
MiraxSlideExporter = "MrxSlideExport.exe"
slicePath = sys.argv[1]
pathToResultData = sys.argv[2]
tileHeight = sys.argv[3]
tileWidth = sys.argv[3]
# slices = os.listdir(pathToSourceMiraxData)
# sys.argv[1]
# sys.argv[2]
# create command-line for system-call of mirax-slide-exporter
# -e exports the slide
# -i saves slide information in outputfolder
# -a optional
# -n only tiles which contain information are exported
# -s + pathToSourceMiraxData + \
cmdForExportingSlicesToTiles = \
MiraxSlideExporter + \
" -i " + \
" -e " + \
" -z " + str(zoomLevel) + \
" -t " + str(tileHeight) + " " + str(tileWidth) + \
" -f " + str(fileFormat) + \
" -m " + str(mapFileFormat) + \
" "
#cmd = "D:\\programs\\MIRAX_SlideAC_SDK\\Bin\\MrxSlideExport.exe -s D:\\fit\\projects\\bayer\\KidneyLiver\\MiraxScanner\\Slides\\L10 -e -o D:\\fit\\projects\\bayer\\KidneyLiver\\MiraxScanner\\Output\\L10 -z 5 -f png"
#os.system(cmd)
#msg = os.popen(cmd, mode='r', buffering=-1) # does not work
#print(msg)
# run through slices in given source-path
cmd = cmdForExportingSlicesToTiles + " -s " + slicePath + " -o " + pathToResultData
print(cmd)
os.system(cmd)
So the problem is that is says it doesn't have sufficient memory.
The weired thing is that if I just ran the exe file directly in cmd console, it's working without any memory problem. I am wondering whether if it's some kind of python issue limits the memory that we can use??