Commit cc61e72e authored by Adrian Nievergelt's avatar Adrian Nievergelt

added pixel size factor

parent 5056bd13
...@@ -37,6 +37,7 @@ parser.add_argument('-b', '--binning', nargs='?', type=int, default=1, help='Out ...@@ -37,6 +37,7 @@ parser.add_argument('-b', '--binning', nargs='?', type=int, default=1, help='Out
parser.add_argument('-dw', '--doseWeight', action='store_true', help='Do dose-weighting on alignment.') parser.add_argument('-dw', '--doseWeight', action='store_true', help='Do dose-weighting on alignment.')
parser.add_argument('-v', '--verbose', action='store_true', help='Allow verbose output from motioncor2 during script run.') parser.add_argument('-v', '--verbose', action='store_true', help='Allow verbose output from motioncor2 during script run.')
parser.add_argument('-kf', '--keepFrames', action='store_true', help='Keep temporary individual aligned frames.') parser.add_argument('-kf', '--keepFrames', action='store_true', help='Keep temporary individual aligned frames.')
parser.add_argument('-psf', '--pixelSizeFactor', nargs='?', type=float, default=1, help='Correction factor for pixel size, set to 0.5 for super resolution with binned mdoc.')
# parser.add_argument('-c', '--cutoff', nargs='?', type=float, default='1', help='The threshold of how many standard deviations above or below the a line must deviate before it is corrected') # parser.add_argument('-c', '--cutoff', nargs='?', type=float, default='1', help='The threshold of how many standard deviations above or below the a line must deviate before it is corrected')
# parser.add_argument('-g', '--graph', action='store_true', help='Store a graph of the corrected and uncorrected line intensities for debug purposes.') # parser.add_argument('-g', '--graph', action='store_true', help='Store a graph of the corrected and uncorrected line intensities for debug purposes.')
...@@ -104,8 +105,12 @@ if not subframesDir: ...@@ -104,8 +105,12 @@ if not subframesDir:
print("No subframes found in current directory tree, terminating!") print("No subframes found in current directory tree, terminating!")
sys.exit() sys.exit()
stackParams = sorted(stackParams, key = lambda i: i['tiltangle']) stackParams = sorted(stackParams, key = lambda i: i['tiltangle'])
inBaseName = re.search("(\w+)\..*", args.input).group(1) try:
inBaseName = re.search("([^\/]+)\.\w+.mdoc$", args.input).group(1)
except:
print("Not a .mdoc file, skipping.")
sys.exit()
stackFileName = os.path.join(mdocDir, inBaseName + ".stackFiles") stackFileName = os.path.join(mdocDir, inBaseName + ".stackFiles")
tiltFileName = os.path.join(mdocDir, inBaseName + ".rawTlt") tiltFileName = os.path.join(mdocDir, inBaseName + ".rawTlt")
...@@ -137,7 +142,7 @@ with open(os.path.join(mdocDir, inBaseName + "_alignFramesMC2.sh"), "w+") as scr ...@@ -137,7 +142,7 @@ with open(os.path.join(mdocDir, inBaseName + "_alignFramesMC2.sh"), "w+") as scr
doseWeightParams = "" doseWeightParams = ""
scriptFile.write("echo Aligning frame stack %s \n" % (os.path.join(subframesDir, imageParams['filename']) )) scriptFile.write("echo Aligning frame stack %s \n" % (os.path.join(subframesDir, imageParams['filename']) ))
scriptFile.write("MotionCor2-cuda%i -InMrc \"%s\" -OutMrc \"%s\" -Patch %i %i -InFmMotion 1 -Iter 30 -Tilt %f -FtBin %i -PixSize %f%s%s\n\n" %(args.cudaVer, os.path.join(subframesDir, imageParams['filename']), os.path.join(alignedDir, imageParams['filename']), args.patchSize, args.patchSize, imageParams['tiltangle'], args.binning, imageParams['pixelspacing'], doseWeightParams, verboseString) ) scriptFile.write("MotionCor2-cuda%i -InMrc \"%s\" -OutMrc \"%s\" -Patch %i %i -InFmMotion 1 -Iter 30 -Tilt %f -FtBin %i -PixSize %f%s%s\n\n" %(args.cudaVer, os.path.join(subframesDir, imageParams['filename']), os.path.join(alignedDir, imageParams['filename']), args.patchSize, args.patchSize, imageParams['tiltangle'], args.binning, imageParams['pixelspacing']*args.pixelSizeFactor, doseWeightParams, verboseString) )
scriptFile.write("echo Creating combined tilt series stack %s\n" % (inBaseName + "_mc2.mrc")) scriptFile.write("echo Creating combined tilt series stack %s\n" % (inBaseName + "_mc2.mrc"))
scriptFile.write("source /sw/apps/imod/current/imodenv\n") scriptFile.write("source /sw/apps/imod/current/imodenv\n")
scriptFile.write("newstack -fileinlist %s -output %s -tilt %s%s\n\n" % ( os.path.basename(stackFileName), inBaseName + "_mc2.mrc", os.path.basename(tiltFileName), verboseString )) scriptFile.write("newstack -fileinlist %s -output %s -tilt %s%s\n\n" % ( os.path.basename(stackFileName), inBaseName + "_mc2.mrc", os.path.basename(tiltFileName), verboseString ))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment