	BatchProc = true;
	Rec_2D = true;
	Rec_3D = true; 
	
	// Batch_NS_Into_TS script arguments
	NStoTS_xydrift = true;
	NStoTS_warp = true;
	NStoTS_zdrift = true;
	NStoTS_zfactor = 2;
	NStoTS_ppc = 0.1248; // case for Andor EMCCD
//	NStoTS_ppc = 0.49; // case for Hamamatsu sCMOS

	// Batch_Process_Locs macro arguments
	// File chooser
	CHOOSE = false;
	CHOOSE_STRING = "";
	EXC = true;
	EXC_STRING = "_ZR_";
	// Drift correction
	CORR_DRIFT = true;
	BIN = 12; // number of frames per sub-reconstruction used for autocorrelation
	MAG = 5; //  pixel size of sub-reconstructions used for autocorrelation
	SM = 0.2; // smoothing factor for autocorrelation
	// Merging
	MERGE = false;
	DIST = 160;
	MAXF = 0;
	OFF = 0;
	// Photon filter
	PHOT_FILT = false;
	PHOT_MIN = 700;
	PHOT_MAX = 15000;
	// Expression-based filter
	EXP_FILT = true;
	EXP_STRING = "intensity>700 & intensity<30000 & detections<5"; // for STORM
//	EXP_STRING = "intensity>1500 & intensity<500000 & detections<500"; // for PAINT
	// Density filter
	DENS_FILT = false;
	DENS_RAD = 100;
	DENS_NUMB = 2;
	DENS_DIM = "2D";
	// TSF Export
	TSF = false;

	// Generate_Reconstructions macro arguments	
	CAM_SIZE = 160;
	SR_SIZE = 16;	
	XMIN = 0;
	YMIN = 0;
	XWIDTH = 256;
	YWIDTH = 256;
	P3D = false;
	Z_SPACE = 30;
	Z_MIN = -400;
	Z_MAX = 800;
	Z_AUTO = true;
	Z_SAT = 10;
	Z_UN = 0;
	Z_COLOR = "Colorized 2D";
	Z_LUT = "Jet";
	to16 = false;
	AD_CONT = false;
	SAT_LEV = 0.1;
	GAUSS = 8;
	
	
	inputDir = getDirectory("Choose a Locs directory");
	inputDirF = escapePath(inputDir); // Windows case, necessary to escape paths input to scripts
	plugin_path = getDirectory("plugins");

	// NS to TS
	NStoTS_path = plugin_path + "ChriSTORM" + File.separator + "Process locs files (batch)" + File.separator+ "Batch_NS_Into_TS.js";
	NStoTS_args = "" + inputDirF + "," + NStoTS_xydrift + "," + NStoTS_warp + "," + NStoTS_zdrift + "," + NStoTS_zfactor + "," + NStoTS_ppc;
	out_path = runMacro(NStoTS_path, NStoTS_args);


	// Optional Batch Proc
	if (BatchProc == true) {
		BatchProc_path = plugin_path + File.separator + "ChriSTORM" + File.separator + "Process locs files (batch)" + File.separator+ "Batch_Process_Locs.ijm";
		BatchProc_args = out_path + "," + CHOOSE + "," + CHOOSE_STRING + "," + EXC + "," + EXC_STRING + "," + CORR_DRIFT + "," + BIN + "," + MAG + "," + SM + "," + MERGE + "," + DIST + "," + MAXF + "," + OFF + "," + PHOT_FILT + "," + PHOT_MIN + "," + PHOT_MAX + "," + EXP_FILT + "," + EXP_STRING + "," + DENS_FILT + "," + DENS_RAD + "," + DENS_NUMB + "," + DENS_DIM + "," + TSF;
		out_path = runMacro(BatchProc_path, BatchProc_args);
	}

	
	// Generate Recs (2D)
	if (Rec2D == true) {
		Gen_Recon_path = plugin_path + File.separator + "ChriSTORM" + File.separator + "Reconstruct Images (batch)" + File.separator+ "Generate_Reconstructions.ijm";
		Gen_Recon_args = out_path + "," + CAM_SIZE + "," + SR_SIZE + "," + XMIN + "," + YMIN + "," + XWIDTH + "," + YWIDTH + "," + P3D + "," + Z_SPACE + "," + Z_MIN + "," + Z_MAX + "," + Z_AUTO + "," + Z_SAT + "," + Z_UN + "," + Z_COLOR + "," + Z_LUT + "," + GAUSS + "," + to16 + "," + AD_CONT + "," + SAT_LEV;
		out_path2 = runMacro(Gen_Recon_path, Gen_Recon_args);	
	}

	// Optional Generate Recs (Zc)
	if (Rec3D == true) {
		P3D = true;
		Gen_Recon_args = out_path + "," + CAM_SIZE + "," + SR_SIZE + "," + XMIN + "," + YMIN + "," + XWIDTH + "," + YWIDTH + "," + P3D + "," + Z_SPACE + "," + Z_MIN + "," + Z_MAX + "," + Z_AUTO + "," + Z_SAT + "," + Z_UN + "," + Z_COLOR + "," + Z_LUT + "," + GAUSS + "," + to16 + "," + AD_CONT + "," + SAT_LEV;		
		out_path2 = runMacro(Gen_Recon_path, Gen_Recon_args);
	}	
	
	function escapePath(p) {
		if (indexOf(p, "\\") > 0) {
			pE = split(p, "\\");
			pF = ""+ pE[0] + "\\" + "\\";
			for (i = 1; i < pE.length; i++) {
				pF = pF + pE[i] + "\\" + "\\";
			}
		}
		else {
			pF = p;
		}
		print(pF);
		return pF;
	}

	

 