## <patchtrack.adoc> Directives file for batchruntomo (Akey-Nudelman, 2015 yNPC)

## Setup values for hole_18 <34 tomograms>
#  > change defocus and tomogram thickness values

# set tilt man pages > environment variable IMOD_USE_GPU
# or UseGPU=0 ; best GPU in system in tilt.com 
# see /usr/local/ImodCalib/cpu.adoc where gpu is activated

setupset.copyarg.dual=0
setupset.copyarg.gold=0

# extract tilt angles from headers
setupset.copyarg.extract=1

# scan image header
# setupset.scanHeader=1

# reading angles with extract and setting pixel (nm) over-rides scanHeader
# but have fixed pixel value in all headers > pix value in nm
setupset.copyarg.pixel=0.56

#underfocus positive in nm
setupset.copyarg.defocus=5500.0
setupset.copyarg.voltage=300
setupset.copyarg.Cs=0.01
setupset.copyarg.rotation=169.0

setupset.copyarg.ctfnoise=/usr/local/ImodCalib/config-noise_TK1-300kv.txt

# patch tracking defaults and turns of the lOG density option
setupset.systemTemplate=/usr/local/IMOD/SystemTemplate/cryoSample.adoc

## Preprocessing
runtime.Preprocessing.any.removeXrays=1
#runtime.Preprocessing.any.archiveOriginal=1
# these are defaults
#comparam.eraser.ccderaser.PeakCriterion=8.
#comparam.eraser.ccderaser.DiffCriterion=6.

## Coarse alignment
comparam.xcorr.tiltxcorr.FilterRadius1=0.03
comparam.xcorr.tiltxcorr.FilterRadius2=0.25
comparam.xcorr.tiltxcorr.FilterSigma2=0.05
comparam.xcorr.tiltxcorr.ExcludeCentralPeak=1
comparam.prenewst.newstack.BinByFactor=2
# useful filter with direct detectors
comparam.prenewst.newstack.AntialiasFilter=1

## Patch-tracking
runtime.Fiducials.any.trackingMethod=1
# if patch size less than ~1180 will use unbinned image for cross-correlation
# this value for integrated K2 data gives a 6 x 6 array 
comparam.xcorr_pt.tiltxcorr.SizeOfPatchesXandY=400,400
comparam.xcorr_pt.tiltxcorr.OverlapOfPatchesXandY=0.33,0.33
#comparam.xcorr_pt.tiltxcorr.NumberOfPatchesXandY=6,6

# imodchopconts man page > If -1 is entered, the length will be the 
# default for breaking up contours from patch tracking in eTomo, which 
# is the Z size in the model divided by 5, but no less than 16

comparam.xcorr_pt.imodchopconts.LengthOfPieces=-1
comparam.xcorr_pt.tiltxcorr.IterateCorrelations=3
comparam.xcorr_pt.tiltxcorr.FilterRadius2=0.25
comparam.xcorr_pt.tiltxcorr.FilterSigma2=0.05
comparam.xcorr_pt.tiltxcorr.BordersInXandY=50,50

## Alignment
comparam.align.tiltalign.SurfacesToAnalyze=1
comparam.align.tiltalign.LocalAlignments=0
comparam.align.tiltalign.MagOption=1
comparam.align.tiltalign.TiltOption=5
comparam.align.tiltalign.TiltDefaultGrouping=5
comparam.align.tiltalign.RotOption=1
comparam.align.tiltalign.WeightWholeTracks=1
comparam.align.tiltalign.KFactorScaling=0.9
comparam.align.tiltalign.RobustFitting=1
comparam.align.tiltalign.MetroFactor=0.25
comparam.align.tiltalign.MaximumCycles=1000

## No Tomogram positioning 

## Aligned stack with CTF correction

# use flag=0 for default bicubic interpolation or
# perhaps 1 for linear interp. and better signal before 1/2 nyquist?
runtime.AlignedStack.any.linearInterpolation=0
runtime.AlignedStack.any.binByFactor=1
comparam.newst.newstack.AntialiasFilter=-1
runtime.AlignedStack.any.correctCTF=1
runtime.AlignedStack.any.filterStack=0
runtime.CTFplotting.any.autoFitRangeAndStep=1.0,0.0
# df underfocus is positive in nanometers
comparam.ctfplotter.ctfplotter.ExpectedDefocus=5500.0
# Do not invert tilt angles due to a possible left handed coord system in UCSF Tomo
#comparam.ctfplotter.ctfplotter.InvertTiltAngles=1
comparam.ctfplotter.ctfplotter.AmplitudeContrast=0.1
comparam.ctfplotter.ctfplotter.SphericalAberration=0.01
comparam.ctfplotter.ctfplotter.FrequencyRangeToFit=0.05,0.4
comparam.ctfplotter.ctfplotter.VaryExponentInFit=0
comparam.ctfcorrection.ctfphaseflip.InterpolationWidth=20
comparam.ctfcorrection.ctfphaseflip.DefocusTol=200
# Do not invert tilt angles due to possible left handed coord system in UCSF Tomo
#comparam.ctfcorrection.ctfphaseflip.InvertTiltAngles=1

## Reconstruction with both BP and SIRT
comparam.tilt.tilt.THICKNESS=700
comparam.tilt.tilt.RADIAL=0.45,0.05

# No log of data for cryo-EM> should also be in the cryoSample.adoc 
comparam.tilt.tilt.LOG=0

# > see sirtsetup.com in runtime directory
runtime.Reconstruction.any.useSirt=1
runtime.Reconstruction.any.doBackprojAlso=1
comparam.sirtsetup.sirtsetup.LeaveIterations=10
# the default value is 8 but should go to 1 if using the gpu (sirtsetup.com)
# comparam.sirtsetup.sirtsetup.NumberOfProcessors=1

# rweigted bp=0, 1=flat filter or fraction in between for SIRT?
comparam.sirtsetup.sirtsetup.FlatFilterFraction=0 

# Not used as it filters in X only
#comparam.sirtsetup.sirtsetup.RadiusAndSigma=0.2,0.05 

# for smaller 3D SIRT integer volume on disk 
comparam.sirtsetup.sirtsetup.ScaleToInteger=-20000,20000

## Post processing flip about X axis (2=do SIRT 3D and BP volumes; otherwise=1)
runtime.Trimvol.any.doSIRTifBoth=2
# rotate both volumes about X
runtime.Trimvol.any.reorient=2


