text:
/***************************************************************************
 *
 * Authors:     J.M. De la Rosa Trevin (jmdelarosa@cnb.csic.es)
 *
 * Unidad de  Bioinformatica of Centro Nacional de Biotecnologia , CSIC
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
 * 02111-1307  USA
 *
 *  All comments concerning this program package may be sent to the
 *  e-mail address 'xmipp@cnb.csic.es'
 ***************************************************************************/

#ifndef METADATA_LABEL_H
#define METADATA_LABEL_H

#include <map>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <fstream>
#include "src/funcs.h"

class EMDLabelData;
class StaticInitialization;

enum EMDLabel
{
    EMDL_UNDEFINED = -1, // Keep the order the same as in StaticInitialization below!!
    EMDL_FIRST_LABEL,
    EMDL_OBJID = EMDL_FIRST_LABEL, ///< object id (int), NOTE: This label is special and shouldn't be used

    EMDL_AREA_ID, ///< ID for the area (or field of view). If one does not use (tilt) series, area would be the same as micrograph...
    EMDL_AREA_NAME, ///< Name for the area (or field of view). If one does not use (tilt) series, area would be the same as micrograph...
    EMDL_COMMENT, // The EMDL_COMMENT is handled specially as well

    EMDL_CTF_BFACTOR, ///< B-factor
    EMDL_CTF_MAXRES, ///< Maximum resolution with Thon rings
    EMDL_CTF_VALIDATIONSCORE, ///< Gctf-based validation score for CTF fit
    EMDL_CTF_SCALEFACTOR, ///< linear scale-factor
    EMDL_CTF_SAMPLING_RATE, ///< Sampling rate
    EMDL_CTF_VOLTAGE, ///< Microscope voltage (kV)
    EMDL_CTF_DEFOCUSU, ///< Defocus U (Angstroms)
    EMDL_CTF_DEFOCUSV, ///< Defocus V (Angstroms)
    EMDL_CTF_DEFOCUS_ANGLE, ///< Defocus angle (degrees)
    EMDL_CTF_CS, ///< Spherical aberration
    EMDL_CTF_CA, ///< Chromatic aberration
    EMDL_CTF_DETECTOR_PIXEL_SIZE, ///< Pixel size for detector as used in CTF-determination
    EMDL_CTF_ENERGY_LOSS, ///< Energy loss
    EMDL_CTF_FOM, ///< ctffind FOM (CC) for quality of CTF-fit
    EMDL_CTF_IMAGE, ///< name of an image describing the CTF model
    EMDL_CTF_LENS_STABILITY, ///< Lens stability
    EMDL_CTF_MAGNIFICATION, ///< Magnification used for CTF-determination
    EMDL_CTF_PHASESHIFT, ///< Phase-shift from a phase plate
    EMDL_CTF_CONVERGENCE_CONE, ///< Convergence cone
    EMDL_CTF_LONGITUDINAL_DISPLACEMENT, ///< Longitudinal displacement
    EMDL_CTF_TRANSVERSAL_DISPLACEMENT, ///< Transversal displacemente
    EMDL_CTF_Q0, ///< Amplitude contrast
    EMDL_CTF_K, ///< CTF gain
    EMDL_CTF_VALUE, ///< CTF value

    EMDL_IMAGE_NAME,
    EMDL_IMAGE_ORI_NAME,
    EMDL_IMAGE_RECONSTRUCT_NAME,
    EMDL_IMAGE_ID,
    EMDL_IMAGE_ENABLED,
    EMDL_IMAGE_DATATYPE,
    EMDL_IMAGE_DIMENSIONALITY,
    EMDL_IMAGE_BEAMTILT_X,
    EMDL_IMAGE_BEAMTILT_Y,
    EMDL_IMAGE_BEAMTILT_GROUP,
    EMDL_IMAGE_COORD_X,
    EMDL_IMAGE_COORD_Y,
    EMDL_IMAGE_COORD_Z,
    EMDL_IMAGE_FRAME_NR,
    EMDL_IMAGE_MAGNIFICATION_CORRECTION,
    EMDL_IMAGE_NORM_CORRECTION,
    EMDL_IMAGE_SAMPLINGRATE,
    EMDL_IMAGE_SAMPLINGRATE_X,
    EMDL_IMAGE_SAMPLINGRATE_Y,
    EMDL_IMAGE_SAMPLINGRATE_Z,
    EMDL_IMAGE_SIZE,
    EMDL_IMAGE_SIZEX,
    EMDL_IMAGE_SIZEY,
    EMDL_IMAGE_SIZEZ,
    EMDL_IMAGE_STATS_MIN,
    EMDL_IMAGE_STATS_MAX,
    EMDL_IMAGE_STATS_AVG,
    EMDL_IMAGE_STATS_STDDEV,
    EMDL_IMAGE_STATS_SKEW,
    EMDL_IMAGE_STATS_KURT,
    EMDL_IMAGE_WEIGHT,

    EMDL_MASK_NAME,

    EMDL_MATRIX_1_1,
    EMDL_MATRIX_1_2,
    EMDL_MATRIX_1_3,
    EMDL_MATRIX_2_1,
    EMDL_MATRIX_2_2,
    EMDL_MATRIX_2_3,
    EMDL_MATRIX_3_1,
    EMDL_MATRIX_3_2,
    EMDL_MATRIX_3_3,

    EMDL_MICROGRAPH_ID,
    EMDL_MICROGRAPH_NAME,
    EMDL_MICROGRAPH_NAME_WODOSE,
    EMDL_MICROGRAPH_MOVIE_NAME,
    EMDL_MICROGRAPH_TILT_ANGLE,
    EMDL_MICROGRAPH_TILT_AXIS_DIRECTION,
    EMDL_MICROGRAPH_TILT_AXIS_OUTOFPLANE,

    EMDL_MLMODEL_ACCURACY_ROT,
    EMDL_MLMODEL_ACCURACY_TRANS,
    EMDL_MLMODEL_AVE_PMAX,
    EMDL_MLMODEL_CURRENT_RESOLUTION,
    EMDL_MLMODEL_CURRENT_SIZE,
    EMDL_MLMODEL_DATA_VS_PRIOR_REF,
    EMDL_MLMODEL_DIMENSIONALITY,
    EMDL_MLMODEL_DIMENSIONALITY_DATA,
    EMDL_MLMODEL_DIFF2_HALVES_REF,
    EMDL_MLMODEL_ESTIM_RESOL_REF,
	EMDL_MLMODEL_FOURIER_COVERAGE_REF,
    EMDL_MLMODEL_FOURIER_COVERAGE_TOTAL_REF,
    EMDL_MLMODEL_FSC_HALVES_REF,
    EMDL_MLMODEL_GROUP_NAME,
    EMDL_MLMODEL_GROUP_NO,
    EMDL_MLMODEL_GROUP_NR_PARTICLES,
    EMDL_MLMODEL_GROUP_SCALE_CORRECTION,
    EMDL_MLMODEL_HELICAL_NR_ASU,
    EMDL_MLMODEL_HELICAL_TWIST,
    EMDL_MLMODEL_HELICAL_TWIST_MIN,
    EMDL_MLMODEL_HELICAL_TWIST_MAX,
    EMDL_MLMODEL_HELICAL_TWIST_INITIAL_STEP,
    EMDL_MLMODEL_HELICAL_RISE,
    EMDL_MLMODEL_HELICAL_RISE_MIN,
    EMDL_MLMODEL_HELICAL_RISE_MAX,
    EMDL_MLMODEL_HELICAL_RISE_INITIAL_STEP,
    EMDL_MLMODEL_IS_HELIX,
    EMDL_MLMODEL_INTERPOLATOR,
    EMDL_MLMODEL_LL,
    EMDL_MLMODEL_MINIMUM_RADIUS_NN_INTERPOLATION,
    EMDL_MLMODEL_NORM_CORRECTION_AVG,
    EMDL_MLMODEL_NR_BODIES,
    EMDL_MLMODEL_NR_CLASSES,
    EMDL_MLMODEL_NR_GROUPS,
    EMDL_MLMODEL_ORIGINAL_SIZE,
    EMDL_MLMODEL_ORIENTABILITY_CONTRIBUTION,
    EMDL_MLMODEL_PADDING_FACTOR,
    EMDL_MLMODEL_PDF_CLASS,
    EMDL_MLMODEL_PRIOR_OFFX_CLASS,
    EMDL_MLMODEL_PRIOR_OFFY_CLASS,
    EMDL_MLMODEL_PDF_ORIENT,
    EMDL_MLMODEL_PIXEL_SIZE,
    EMDL_MLMODEL_POWER_REF,
    EMDL_MLMODEL_PRIOR_MODE,
    EMDL_MLMODEL_SIGMA_OFFSET,
    EMDL_MLMODEL_SIGMA_ROT,
    EMDL_MLMODEL_SIGMA_TILT,
    EMDL_MLMODEL_SIGMA_PSI,
    EMDL_MLMODEL_REF_IMAGE,
    EMDL_MLMODEL_SGD_GRADIENT_IMAGE,
    EMDL_MLMODEL_SIGMA2_NOISE,
    EMDL_MLMODEL_SIGMA2_REF,
    EMDL_MLMODEL_SSNR_REF,
    EMDL_MLMODEL_TAU2_FUDGE_FACTOR,
    EMDL_MLMODEL_TAU2_REF,

    EMDL_OPTIMISER_ACCURACY_ROT,
    EMDL_OPTIMISER_ACCURACY_TRANS,
    EMDL_OPTIMISER_ADAPTIVE_FRACTION,
    EMDL_OPTIMISER_ADAPTIVE_OVERSAMPLING,
    EMDL_OPTIMISER_AUTO_LOCAL_HP_ORDER,
    EMDL_OPTIMISER_AVAILABLE_MEMORY,
    EMDL_OPTIMISER_BEST_RESOL_THUS_FAR,
	EMDL_OPTIMISER_CHANGES_OPTIMAL_OFFSETS,
	EMDL_OPTIMISER_CHANGES_OPTIMAL_ORIENTS,
	EMDL_OPTIMISER_CHANGES_OPTIMAL_CLASSES,
    EMDL_OPTIMISER_COARSE_SIZE,
    EMDL_OPTIMISER_DATA_ARE_CTF_PHASE_FLIPPED,
    EMDL_OPTIMISER_DATA_ARE_CTF_PREMULTIPLIED,
    EMDL_OPTIMISER_DATA_STARFILE,
    EMDL_OPTIMISER_DO_AUTO_REFINE,
    EMDL_OPTIMISER_DO_ONLY_FLIP_CTF_PHASES,
    EMDL_OPTIMISER_DO_CORRECT_CTF,
    EMDL_OPTIMISER_DO_CORRECT_MAGNIFICATION,
    EMDL_OPTIMISER_DO_CORRECT_NORM,
    EMDL_OPTIMISER_DO_CORRECT_SCALE,
    EMDL_OPTIMISER_DO_REALIGN_MOVIES,
    EMDL_OPTIMISER_DO_MAP,
    EMDL_OPTIMISER_DO_SGD,
    EMDL_OPTIMISER_SGD_MU,
	EMDL_OPTIMISER_SGD_SIGMA2FUDGE_INI,
	EMDL_OPTIMISER_SGD_SIGMA2FUDGE_HALFLIFE,
    EMDL_OPTIMISER_SGD_SUBSET_START,
    EMDL_OPTIMISER_SGD_SUBSET_SIZE,
    EMDL_OPTIMISER_SGD_WRITE_EVERY_SUBSET,
    EMDL_OPTIMISER_SGD_MAX_SUBSETS,
    EMDL_OPTIMISER_SGD_STEPSIZE,
    EMDL_OPTIMISER_DO_SOLVENT_FLATTEN,
    EMDL_OPTIMISER_DO_SKIP_ALIGN,
    EMDL_OPTIMISER_DO_SKIP_ROTATE,
    EMDL_OPTIMISER_DO_SPLIT_RANDOM_HALVES,
    EMDL_OPTIMISER_DO_ZERO_MASK,
    EMDL_OPTIMISER_FIX_SIGMA_NOISE,
    EMDL_OPTIMISER_FIX_SIGMA_OFFSET,
    EMDL_OPTIMISER_FIX_TAU,
    EMDL_OPTIMISER_HAS_CONVERGED,
    EMDL_OPTIMISER_HAS_HIGH_FSC_AT_LIMIT,
    EMDL_OPTIMISER_HAS_LARGE_INCR_SIZE_ITER_AGO,
    EMDL_OPTIMISER_DO_HELICAL_REFINE,
    EMDL_OPTIMISER_IGNORE_HELICAL_SYMMETRY,
    EMDL_OPTIMISER_HELICAL_TWIST_INITIAL,
    EMDL_OPTIMISER_HELICAL_RISE_INITIAL,
    EMDL_OPTIMISER_HELICAL_Z_PERCENTAGE,
    EMDL_OPTIMISER_HELICAL_TUBE_INNER_DIAMETER,
    EMDL_OPTIMISER_HELICAL_TUBE_OUTER_DIAMETER,
    EMDL_OPTIMISER_HELICAL_SYMMETRY_LOCAL_REFINEMENT,
    EMDL_OPTIMISER_HELICAL_SIGMA_DISTANCE,
    EMDL_OPTIMISER_HELICAL_KEEP_TILT_PRIOR_FIXED,
    EMDL_OPTIMISER_HIGHRES_LIMIT_EXP,
    EMDL_OPTIMISER_HIGHRES_LIMIT_SGD,
    EMDL_OPTIMISER_IGNORE_CTF_UNTIL_FIRST_PEAK,
    EMDL_OPTIMISER_INCR_SIZE,
    EMDL_OPTIMISER_ITERATION_NO,
    EMDL_OPTIMISER_LOCAL_SYMMETRY_FILENAME,
    EMDL_OPTIMISER_LOWRES_JOIN_RANDOM_HALVES,
    EMDL_OPTIMISER_MAGNIFICATION_RANGE,
    EMDL_OPTIMISER_MAGNIFICATION_STEP,
    EMDL_OPTIMISER_MAX_COARSE_SIZE,
    EMDL_OPTIMISER_MAX_NR_POOL,
    EMDL_OPTIMISER_MODEL_STARFILE,
    EMDL_OPTIMISER_MODEL_STARFILE2,
    EMDL_OPTIMISER_NR_ITERATIONS,
    EMDL_OPTIMISER_NR_ITER_WO_RESOL_GAIN,
    EMDL_OPTIMISER_NR_ITER_WO_HIDDEN_VAR_CHANGES,
    EMDL_OPTIMISER_OUTPUT_ROOTNAME,
    EMDL_OPTIMISER_PARTICLE_DIAMETER,
    EMDL_OPTIMISER_RADIUS_MASK_3D_MAP,
    EMDL_OPTIMISER_RADIUS_MASK_EXP_PARTICLES,
    EMDL_OPTIMISER_RANDOM_SEED,
    EMDL_OPTIMISER_REFS_ARE_CTF_CORRECTED,
    EMDL_OPTIMISER_SAMPLING_STARFILE,
    EMDL_OPTIMISER_SMALLEST_CHANGES_OPT_CLASSES,
    EMDL_OPTIMISER_SMALLEST_CHANGES_OPT_OFFSETS,
    EMDL_OPTIMISER_SMALLEST_CHANGES_OPT_ORIENTS,
    EMDL_OPTIMISER_SOLVENT_MASK_NAME,
    EMDL_OPTIMISER_SOLVENT_MASK2_NAME,
    EMDL_OPTIMISER_TAU_SPECTRUM_NAME,
    EMDL_OPTIMISER_USE_TOO_COARSE_SAMPLING,
    EMDL_OPTIMISER_WIDTH_MASK_EDGE,

    EMDL_ORIENT_FLIP,
    EMDL_ORIENT_ID,
    EMDL_ORIENT_ORIGIN_X,
    EMDL_ORIENT_ORIGIN_X_PRIOR,
    EMDL_ORIENT_ORIGIN_Y,
    EMDL_ORIENT_ORIGIN_Y_PRIOR,
    EMDL_ORIENT_ORIGIN_Z,
    EMDL_ORIENT_ORIGIN_Z_PRIOR,
    EMDL_ORIENT_ROT,
    EMDL_ORIENT_ROT_PRIOR,
    EMDL_ORIENT_TILT,
    EMDL_ORIENT_TILT_PRIOR,
    EMDL_ORIENT_PSI,
    EMDL_ORIENT_PSI_PRIOR,
    EMDL_ORIENT_PSI_PRIOR_FLIP_RATIO,

    EMDL_PARTICLE_AUTOPICK_FOM,
    EMDL_PARTICLE_HELICAL_TUBE_ID,
    EMDL_PARTICLE_HELICAL_TUBE_PITCH,
    EMDL_PARTICLE_HELICAL_TRACK_LENGTH,
    EMDL_PARTICLE_CLASS,
    EMDL_PARTICLE_DLL,
    EMDL_PARTICLE_ID,
    EMDL_PARTICLE_FOM,
    EMDL_PARTICLE_KL_DIVERGENCE,
    EMDL_PARTICLE_RANDOM_SUBSET,
    EMDL_PARTICLE_NAME,
    EMDL_PARTICLE_ORI_NAME,
    EMDL_PARTICLE_NR_SIGNIFICANT_SAMPLES,
    EMDL_PARTICLE_NR_FRAMES,
    EMDL_PARTICLE_NR_FRAMES_AVG,
    EMDL_PARTICLE_MOVIE_RUNNING_AVG,
    EMDL_PARTICLE_PMAX,

    EMDL_PIPELINE_JOB_COUNTER,
    EMDL_PIPELINE_NODE_NAME,
    EMDL_PIPELINE_NODE_TYPE,
    EMDL_PIPELINE_PROCESS_ALIAS,
    EMDL_PIPELINE_PROCESS_NAME,
    EMDL_PIPELINE_PROCESS_TYPE,
    EMDL_PIPELINE_PROCESS_STATUS,
    EMDL_PIPELINE_EDGE_FROM,
    EMDL_PIPELINE_EDGE_TO,
    EMDL_PIPELINE_EDGE_PROCESS,

    EMDL_POSTPROCESS_BFACTOR,
    EMDL_POSTPROCESS_FINAL_RESOLUTION,
    EMDL_POSTPROCESS_FSC_GENERAL,
    EMDL_POSTPROCESS_FSC_TRUE,
    EMDL_POSTPROCESS_FSC_MASKED,
    EMDL_POSTPROCESS_FSC_UNMASKED,
    EMDL_POSTPROCESS_FSC_RANDOM_MASKED,
    EMDL_POSTPROCESS_AMPLCORR_MASKED,
    EMDL_POSTPROCESS_AMPLCORR_UNMASKED,
    EMDL_POSTPROCESS_DPR_MASKED,
    EMDL_POSTPROCESS_DPR_UNMASKED,
    EMDL_POSTPROCESS_GUINIER_FIT_CORRELATION,
    EMDL_POSTPROCESS_GUINIER_FIT_INTERCEPT,
    EMDL_POSTPROCESS_GUINIER_FIT_SLOPE,
    EMDL_POSTPROCESS_GUINIER_VALUE_IN,
    EMDL_POSTPROCESS_GUINIER_VALUE_INVMTF,
    EMDL_POSTPROCESS_GUINIER_VALUE_WEIGHTED,
    EMDL_POSTPROCESS_GUINIER_VALUE_SHARPENED,
    EMDL_POSTPROCESS_GUINIER_VALUE_INTERCEPT,
    EMDL_POSTPROCESS_GUINIER_RESOL_SQUARED,
    EMDL_POSTPROCESS_MTF_VALUE, ///< Detector MTF value

    EMDL_SAMPLING_IS_3D,
    EMDL_SAMPLING_IS_3D_TRANS,
    EMDL_SAMPLING_HEALPIX_ORDER,
    EMDL_SAMPLING_LIMIT_TILT,
    EMDL_SAMPLING_OFFSET_RANGE,
    EMDL_SAMPLING_OFFSET_STEP,
	EMDL_SAMPLING_HELICAL_OFFSET_STEP,
    EMDL_SAMPLING_PERTURB,
    EMDL_SAMPLING_PERTURBATION_FACTOR,
    EMDL_SAMPLING_PRIOR_MODE,
    EMDL_SAMPLING_PSI_STEP,
    EMDL_SAMPLING_SIGMA_ROT,
    EMDL_SAMPLING_SIGMA_TILT,
    EMDL_SAMPLING_SIGMA_PSI,
    EMDL_SAMPLING_SYMMETRY,

    EMDL_SELECTED,
    EMDL_SELECT_PARTICLES_ZSCORE,
    EMDL_SORTED_IDX,
    EMDL_STARFILE_MOVIE_PARTICLES,
    EMDL_PERFRAME_CUMULATIVE_WEIGHT,
    EMDL_PERFRAME_RELATIVE_WEIGHT,

    EMDL_RESOLUTION,
    EMDL_RESOLUTION_ANGSTROM,
    EMDL_RESOLUTION_INVPIXEL,
    EMDL_SPECTRAL_IDX,

    EMDL_LAST_LABEL                       // **** NOTE ****: Do keep this label always at the end
    // it is here for looping purposes
};//close enum Label

enum EMDLabelType
{
    EMDL_INT, EMDL_LONG, EMDL_BOOL, EMDL_DOUBLE, EMDL_FLOAT, EMDL_STRING
};

class EMDL
{
public:
    // This enum defines what MetaDataLabels this class can manage, if
    // you need a new one add it here and modify affected methods:
    //
    //  - static EMDLabel codifyLabel( std::string strLabel );        EMDL::addLabel(EMDL_OPTIMISER_RANDOM_SEED, EMDL_INT, "randomSeed");

    // - static std::string EMDL::label2Str( EMDLabel inputLabel );
    // - void writeValuesToFile( std::ofstream &outfile, EMDLabel inputLabel );
    // - void addValue( std::string name, std::string value );
    //
    // Keep this special structure (using EMDL_FIRSTLABEL and EMDL_LAST_LABEL) so the
    // programmer can iterate through it like this:
    //
    //  for( EMDLabel mdl = EMDL_FIRST_LABEL ; mdl < EMDL_LAST_LABEL ; EMDLabel( mdl+1 ) )
    //

static EMDLabel str2Label(const std::string &labelName);
static std::string label2Str(const EMDLabel &label);

static bool isInt(const EMDLabel &label);
static bool isLong(const EMDLabel &label);
static bool isBool(const EMDLabel &label);
static bool isString(const EMDLabel &label);
static bool isDouble(const EMDLabel &label);
static bool isNumber(const EMDLabel &label);
static bool isValidLabel(const EMDLabel &label);
static bool isValidLabel(const std::string &labelName);

static void printDefinitions(std::ostream& out);

private:
    static std::map<EMDLabel, EMDLabelData> data;
    static std::map<std::string, EMDLabel> names;
    static std::map<std::string, std::string> definitions;
    static StaticInitialization initialization; //Just for initialization

    static void addLabel(EMDLabel label, EMDLabelType type, std::string name, std::string definition = "undocumented");

    friend class StaticInitialization;
}
;//close class MLD definition

//Just an struct to store type and string alias
class EMDLabelData
{
public:
    EMDLabelType type;
    std::string str;
    //Default constructor
    EMDLabelData()
    {
    }
    EMDLabelData(EMDLabelType t, std::string s)
    {
        type = t;
        str = s;
    }
};//close class EMDLabelData c

//Just a class for static initialization
class StaticInitialization
{
private:
    StaticInitialization()
    {
        ///==== Add labels entries from here in the SAME ORDER as declared in ENUM ==========
    	EMDL::addLabel(EMDL_COMMENT, EMDL_STRING, "rlnComment", "A metadata comment (This is treated in a special way)");

        EMDL::addLabel(EMDL_AREA_ID, EMDL_LONG, "rlnAreaId", "ID (i.e. a unique number) of an area (i.e. field-of-view)");
        EMDL::addLabel(EMDL_AREA_NAME, EMDL_STRING, "rlnAreaName", "Name of an area (i.e. field-of-view)");

    	EMDL::addLabel(EMDL_CTF_BFACTOR, EMDL_DOUBLE, "rlnCtfBfactor", "B-factor (in A^2) that describes CTF power spectrum fall-off");
    	EMDL::addLabel(EMDL_CTF_MAXRES, EMDL_DOUBLE, "rlnCtfMaxResolution", "Estimated maximum resolution (in A) of significant CTF Thon rings");
    	EMDL::addLabel(EMDL_CTF_VALIDATIONSCORE, EMDL_DOUBLE, "rlnCtfValidationScore", "Gctf-based validation score for the quality of the CTF fit");
    	EMDL::addLabel(EMDL_CTF_SCALEFACTOR, EMDL_DOUBLE, "rlnCtfScalefactor", "Linear scale-factor on the CTF (values between 0 and 1)");
        EMDL::addLabel(EMDL_CTF_VOLTAGE, EMDL_DOUBLE, "rlnVoltage", "Voltage of the microscope (in kV)");
        EMDL::addLabel(EMDL_CTF_DEFOCUSU, EMDL_DOUBLE, "rlnDefocusU", "Defocus in U-direction (in Angstroms, positive values for underfocus)");
        EMDL::addLabel(EMDL_CTF_DEFOCUSV, EMDL_DOUBLE, "rlnDefocusV", "Defocus in V-direction (in Angstroms, positive values for underfocus)");
        EMDL::addLabel(EMDL_CTF_DEFOCUS_ANGLE, EMDL_DOUBLE, "rlnDefocusAngle", "Angle between X and defocus U direction (in degrees)");
        EMDL::addLabel(EMDL_CTF_CS, EMDL_DOUBLE, "rlnSphericalAberration", "Spherical aberration (in millimeters)");
        EMDL::addLabel(EMDL_CTF_CA, EMDL_DOUBLE, "rlnChromaticAberration", "Chromatic aberration (in millimeters)");
        EMDL::addLabel(EMDL_CTF_DETECTOR_PIXEL_SIZE, EMDL_DOUBLE, "rlnDetectorPixelSize", "Pixel size of the detector (in micrometers)");
        EMDL::addLabel(EMDL_CTF_ENERGY_LOSS, EMDL_DOUBLE, "rlnEnergyLoss", "Energy loss (in eV)");
        EMDL::addLabel(EMDL_CTF_FOM, EMDL_DOUBLE, "rlnCtfFigureOfMerit", "Figure of merit for the fit of the CTF (not used inside relion_refine)");
        EMDL::addLabel(EMDL_CTF_IMAGE, EMDL_STRING, "rlnCtfImage", "Name of an image with all CTF values");
        EMDL::addLabel(EMDL_CTF_LENS_STABILITY, EMDL_DOUBLE, "rlnLensStability", "Lens stability (in ppm)");
        EMDL::addLabel(EMDL_CTF_MAGNIFICATION, EMDL_DOUBLE, "rlnMagnification", "Magnification at the detector (in times)");
        EMDL::addLabel(EMDL_CTF_PHASESHIFT, EMDL_DOUBLE, "rlnPhaseShift", "Phase-shift from a phase-plate (in degrees)");
        EMDL::addLabel(EMDL_CTF_CONVERGENCE_CONE, EMDL_DOUBLE, "rlnConvergenceCone", "Convergence cone (in mrad)");
        EMDL::addLabel(EMDL_CTF_LONGITUDINAL_DISPLACEMENT, EMDL_DOUBLE, "rlnLongitudinalDisplacement", "Longitudinal displacement (in Angstroms)");
        EMDL::addLabel(EMDL_CTF_TRANSVERSAL_DISPLACEMENT, EMDL_DOUBLE, "rlnTransversalDisplacement", "Transversal displacement (in Angstroms)");
        EMDL::addLabel(EMDL_CTF_Q0, EMDL_DOUBLE, "rlnAmplitudeContrast", "Amplitude contrast (as a fraction, i.e. 10% = 0.1)");
        EMDL::addLabel(EMDL_CTF_VALUE, EMDL_DOUBLE, "rlnCtfValue", "Value of the Contrast Transfer Function");

    	EMDL::addLabel(EMDL_IMAGE_NAME, EMDL_STRING, "rlnImageName", "Name of an image");
    	EMDL::addLabel(EMDL_IMAGE_ORI_NAME, EMDL_STRING, "rlnImageOriginalName", "Original name of an image");
    	EMDL::addLabel(EMDL_IMAGE_RECONSTRUCT_NAME, EMDL_STRING, "rlnReconstructImageName", "Name of an image to be used for reconstruction only");
    	EMDL::addLabel(EMDL_IMAGE_ID, EMDL_LONG, "rlnImageId", "ID (i.e. a unique number) of an image");
    	EMDL::addLabel(EMDL_IMAGE_ENABLED, EMDL_BOOL, "rlnEnabled", "Not used in RELION, only included for backward compatibility with XMIPP selfiles");
        EMDL::addLabel(EMDL_IMAGE_DATATYPE, EMDL_INT, "rlnDataType", "Type of data stored in an image (e.g. int, RFLOAT etc)");
        EMDL::addLabel(EMDL_IMAGE_DIMENSIONALITY, EMDL_INT, "rlnImageDimensionality", "Dimensionality of data stored in an image (i.e. 2 or 3)");
        EMDL::addLabel(EMDL_IMAGE_BEAMTILT_X, EMDL_DOUBLE, "rlnBeamTiltX", "Beam tilt in the X-direction (in mrad)");
        EMDL::addLabel(EMDL_IMAGE_BEAMTILT_Y, EMDL_DOUBLE, "rlnBeamTiltY", "Beam tilt in the Y-direction (in mrad)");
        EMDL::addLabel(EMDL_IMAGE_BEAMTILT_GROUP, EMDL_STRING, "rlnBeamTiltGroupName", "Name of a group (of images) with assumedly identical beam-tilts");
        EMDL::addLabel(EMDL_IMAGE_COORD_X, EMDL_DOUBLE, "rlnCoordinateX", "X-Position of an image in a micrograph (in pixels)");
        EMDL::addLabel(EMDL_IMAGE_COORD_Y, EMDL_DOUBLE, "rlnCoordinateY", "Y-Position of an image in a micrograph (in pixels)");
        EMDL::addLabel(EMDL_IMAGE_COORD_Z, EMDL_DOUBLE, "rlnCoordinateZ", "Z-Position of an image in a 3D micrograph, i.e. tomogram (in pixels)");
        EMDL::addLabel(EMDL_IMAGE_FRAME_NR, EMDL_INT, "rlnMovieFrameNumber", "Number of a movie frame");
        EMDL::addLabel(EMDL_IMAGE_NORM_CORRECTION, EMDL_DOUBLE, "rlnNormCorrection", "Normalisation correction value for an image");
        EMDL::addLabel(EMDL_IMAGE_MAGNIFICATION_CORRECTION, EMDL_DOUBLE, "rlnMagnificationCorrection", "Magnification correction value for an image");
        EMDL::addLabel(EMDL_IMAGE_SAMPLINGRATE, EMDL_DOUBLE, "rlnSamplingRate", "Sampling rate of an image (in Angstrom/pixel)");
        EMDL::addLabel(EMDL_IMAGE_SAMPLINGRATE_X, EMDL_DOUBLE, "rlnSamplingRateX", "Sampling rate in X-direction of an image (in Angstrom/pixel)");
        EMDL::addLabel(EMDL_IMAGE_SAMPLINGRATE_Y, EMDL_DOUBLE, "rlnSamplingRateY", "Sampling rate in Y-direction of an image (in Angstrom/pixel)");
        EMDL::addLabel(EMDL_IMAGE_SAMPLINGRATE_Z, EMDL_DOUBLE, "rlnSamplingRateZ", "Sampling rate in Z-direction of an image (in Angstrom/pixel)");
        EMDL::addLabel(EMDL_IMAGE_SIZE, EMDL_INT, "rlnImageSize", "Size of an image (in pixels)");
        EMDL::addLabel(EMDL_IMAGE_SIZEX, EMDL_INT, "rlnImageSizeX", "Size of an image in the X-direction (in pixels)");
        EMDL::addLabel(EMDL_IMAGE_SIZEY, EMDL_INT, "rlnImageSizeY", "Size of an image in the Y-direction (in pixels)");
        EMDL::addLabel(EMDL_IMAGE_SIZEZ, EMDL_INT, "rlnImageSizeZ", "Size of an image in the Z-direction (in pixels)");
        EMDL::addLabel(EMDL_IMAGE_STATS_MIN, EMDL_DOUBLE, "rlnMinimumValue", "Minimum value for the pixels in an image");
        EMDL::addLabel(EMDL_IMAGE_STATS_MAX, EMDL_DOUBLE, "rlnMaximumValue", "Maximum value for the pixels in an image");
        EMDL::addLabel(EMDL_IMAGE_STATS_AVG, EMDL_DOUBLE, "rlnAverageValue", "Average value for the pixels in an image");
        EMDL::addLabel(EMDL_IMAGE_STATS_STDDEV, EMDL_DOUBLE, "rlnStandardDeviationValue", "Standard deviation for the pixel values in an image");
        EMDL::addLabel(EMDL_IMAGE_STATS_SKEW, EMDL_DOUBLE, "rlnSkewnessValue", "Skewness (3rd moment) for the pixel values in an image");
        EMDL::addLabel(EMDL_IMAGE_STATS_KURT, EMDL_DOUBLE, "rlnKurtosisExcessValue", "Kurtosis excess (4th moment - 3) for the pixel values in an image");
        EMDL::addLabel(EMDL_IMAGE_WEIGHT, EMDL_DOUBLE, "rlnImageWeight", "Relative weight of an image");

        EMDL::addLabel(EMDL_MASK_NAME, EMDL_STRING, "rlnMaskName", "Name of an image that contains a [0,1] mask");

        EMDL::addLabel(EMDL_MATRIX_1_1, EMDL_DOUBLE, "rlnMatrix_1_1", "Matrix element (1,1) of a 3x3 matrix");
        EMDL::addLabel(EMDL_MATRIX_1_2, EMDL_DOUBLE, "rlnMatrix_1_2", "Matrix element (1,2) of a 3x3 matrix");
        EMDL::addLabel(EMDL_MATRIX_1_3, EMDL_DOUBLE, "rlnMatrix_1_3", "Matrix element (1,3) of a 3x3 matrix");
        EMDL::addLabel(EMDL_MATRIX_2_1, EMDL_DOUBLE, "rlnMatrix_2_1", "Matrix element (2,1) of a 3x3 matrix");
        EMDL::addLabel(EMDL_MATRIX_2_2, EMDL_DOUBLE, "rlnMatrix_2_2", "Matrix element (2,1) of a 3x3 matrix");
        EMDL::addLabel(EMDL_MATRIX_2_3, EMDL_DOUBLE, "rlnMatrix_2_3", "Matrix element (2,1) of a 3x3 matrix");
        EMDL::addLabel(EMDL_MATRIX_3_1, EMDL_DOUBLE, "rlnMatrix_3_1", "Matrix element (3,1) of a 3x3 matrix");
        EMDL::addLabel(EMDL_MATRIX_3_2, EMDL_DOUBLE, "rlnMatrix_3_2", "Matrix element (3,1) of a 3x3 matrix");
        EMDL::addLabel(EMDL_MATRIX_3_3, EMDL_DOUBLE, "rlnMatrix_3_3", "Matrix element (3,1) of a 3x3 matrix");

        EMDL::addLabel(EMDL_MICROGRAPH_ID, EMDL_LONG, "rlnMicrographId", "ID (i.e. a unique number) of a micrograph");
        EMDL::addLabel(EMDL_MICROGRAPH_NAME, EMDL_STRING, "rlnMicrographName", "Name of a micrograph");
        EMDL::addLabel(EMDL_MICROGRAPH_NAME_WODOSE, EMDL_STRING, "rlnMicrographNameNoDW", "Name of a micrograph without dose weighting");
        EMDL::addLabel(EMDL_MICROGRAPH_MOVIE_NAME, EMDL_STRING, "rlnMicrographMovieName", "Name of a micrograph movie stack");
        EMDL::addLabel(EMDL_MICROGRAPH_TILT_ANGLE, EMDL_DOUBLE, "rlnMicrographTiltAngle", "Tilt angle (in degrees) used to collect a micrograph");
        EMDL::addLabel(EMDL_MICROGRAPH_TILT_AXIS_DIRECTION, EMDL_DOUBLE, "rlnMicrographTiltAxisDirection", "Direction of the tilt-axis (in degrees) used to collect a micrograph");
        EMDL::addLabel(EMDL_MICROGRAPH_TILT_AXIS_OUTOFPLANE, EMDL_DOUBLE, "rlnMicrographTiltAxisOutOfPlane", "Out-of-plane angle (in degrees) of the tilt-axis used to collect a micrograph (90=in-plane)");

        EMDL::addLabel(EMDL_MLMODEL_ACCURACY_ROT, EMDL_DOUBLE, "rlnAccuracyRotations", "Estimated accuracy (in degrees) with which rotations can be assigned");
        EMDL::addLabel(EMDL_MLMODEL_ACCURACY_TRANS, EMDL_DOUBLE, "rlnAccuracyTranslations", "Estimated accuracy (in pixels) with which translations can be assigned");
        EMDL::addLabel(EMDL_MLMODEL_AVE_PMAX, EMDL_DOUBLE, "rlnAveragePmax", "Average value (over all images) of the maxima of the probability distributions");
        EMDL::addLabel(EMDL_MLMODEL_CURRENT_RESOLUTION, EMDL_DOUBLE, "rlnCurrentResolution", "Current resolution where SSNR^MAP drops below 1 (in 1/Angstroms)");
        EMDL::addLabel(EMDL_MLMODEL_CURRENT_SIZE, EMDL_INT, "rlnCurrentImageSize", "Current size of the images used in the refinement");
        EMDL::addLabel(EMDL_MLMODEL_DATA_VS_PRIOR_REF, EMDL_DOUBLE, "rlnSsnrMap", "Spectral signal-to-noise ratio as defined for MAP estimation (SSNR^MAP)");
        EMDL::addLabel(EMDL_MLMODEL_DIMENSIONALITY, EMDL_INT, "rlnReferenceDimensionality", "Dimensionality of the references (2D/3D)");
        EMDL::addLabel(EMDL_MLMODEL_DIMENSIONALITY_DATA, EMDL_INT, "rlnDataDimensionality", "Dimensionality of the data (2D/3D)");
        EMDL::addLabel(EMDL_MLMODEL_DIFF2_HALVES_REF, EMDL_DOUBLE, "rlnDiff2RandomHalves", "Power of the differences between two independent reconstructions from random halves of the data");
        EMDL::addLabel(EMDL_MLMODEL_ESTIM_RESOL_REF, EMDL_DOUBLE, "rlnEstimatedResolution", "Estimated resolution (in A) for a reference");
        EMDL::addLabel(EMDL_MLMODEL_FOURIER_COVERAGE_REF, EMDL_DOUBLE, "rlnFourierCompleteness", "Fraction of Fourier components (per resolution shell) with SNR>1");
        EMDL::addLabel(EMDL_MLMODEL_FOURIER_COVERAGE_TOTAL_REF, EMDL_DOUBLE, "rlnOverallFourierCompleteness", "Fraction of all Fourier components up to the current resolution with SNR>1");
        EMDL::addLabel(EMDL_MLMODEL_FSC_HALVES_REF, EMDL_DOUBLE, "rlnGoldStandardFsc", "Fourier shell correlation between two independent reconstructions from random halves of the data");
        EMDL::addLabel(EMDL_MLMODEL_GROUP_NAME, EMDL_STRING, "rlnGroupName", "The name of a group of images (e.g. all images from a micrograph)");
        EMDL::addLabel(EMDL_MLMODEL_GROUP_NO, EMDL_LONG, "rlnGroupNumber", "The number of a group of images");
        EMDL::addLabel(EMDL_MLMODEL_GROUP_NR_PARTICLES, EMDL_LONG, "rlnGroupNrParticles", "Number particles in a group of images");
        EMDL::addLabel(EMDL_MLMODEL_GROUP_SCALE_CORRECTION, EMDL_DOUBLE, "rlnGroupScaleCorrection", "Intensity-scale correction for a group of images");
        EMDL::addLabel(EMDL_MLMODEL_HELICAL_NR_ASU, EMDL_INT, "rlnNrHelicalAsymUnits", "How many new helical asymmetric units are there in each box");
        EMDL::addLabel(EMDL_MLMODEL_HELICAL_TWIST, EMDL_DOUBLE, "rlnHelicalTwist", "The helical twist (rotation per subunit) in degrees");
        EMDL::addLabel(EMDL_MLMODEL_HELICAL_TWIST_MIN, EMDL_DOUBLE, "rlnHelicalTwistMin", "Minimum helical twist (in degrees, + for right-handedness)");
        EMDL::addLabel(EMDL_MLMODEL_HELICAL_TWIST_MAX, EMDL_DOUBLE, "rlnHelicalTwistMax", "Maximum helical twist (in degrees, + for right-handedness)");
        EMDL::addLabel(EMDL_MLMODEL_HELICAL_TWIST_INITIAL_STEP, EMDL_DOUBLE, "rlnHelicalTwistInitialStep", "Initial step of helical twist search (in degrees)");
        EMDL::addLabel(EMDL_MLMODEL_HELICAL_RISE, EMDL_DOUBLE, "rlnHelicalRise", "The helical rise (translation per subunit) in Angstroms");
        EMDL::addLabel(EMDL_MLMODEL_HELICAL_RISE_MIN, EMDL_DOUBLE, "rlnHelicalRiseMin", "Minimum helical rise (in Angstroms)");
        EMDL::addLabel(EMDL_MLMODEL_HELICAL_RISE_MAX, EMDL_DOUBLE, "rlnHelicalRiseMax", "Maximum helical rise (in Angstroms)");
        EMDL::addLabel(EMDL_MLMODEL_HELICAL_RISE_INITIAL_STEP, EMDL_DOUBLE, "rlnHelicalRiseInitialStep", "Initial step of helical rise search (in Angstroms)");
        EMDL::addLabel(EMDL_MLMODEL_IS_HELIX, EMDL_BOOL, "rlnIsHelix", "Flag to indicate that helical refinement should be performed");
        EMDL::addLabel(EMDL_MLMODEL_INTERPOLATOR, EMDL_INT, "rlnFourierSpaceInterpolator", "The kernel used for Fourier-space interpolation (NN=0, linear=1)");
        EMDL::addLabel(EMDL_MLMODEL_LL, EMDL_DOUBLE, "rlnLogLikelihood", "Value of the log-likelihood target function");
        EMDL::addLabel(EMDL_MLMODEL_MINIMUM_RADIUS_NN_INTERPOLATION,  EMDL_INT, "rlnMinRadiusNnInterpolation","Minimum radius for NN-interpolation (in Fourier pixels), for smaller radii linear int. is used");
        EMDL::addLabel(EMDL_MLMODEL_NORM_CORRECTION_AVG, EMDL_DOUBLE, "rlnNormCorrectionAverage", "Average value (over all images) of the normalisation correction values");
        EMDL::addLabel(EMDL_MLMODEL_NR_CLASSES, EMDL_INT, "rlnNrClasses", "The number of references (i.e. classes) to be used in refinement");
        EMDL::addLabel(EMDL_MLMODEL_NR_BODIES, EMDL_INT, "rlnNrBodies", "The number of independent rigid bodies to be refined in multi-body refinement");
        EMDL::addLabel(EMDL_MLMODEL_NR_GROUPS, EMDL_INT, "rlnNrGroups", "The number of different groups of images (each group has its own noise spectrum, and intensity-scale correction)");
        EMDL::addLabel(EMDL_MLMODEL_ORIENTABILITY_CONTRIBUTION, EMDL_DOUBLE, "rlnSpectralOrientabilityContribution", "Spectral SNR contribution to the orientability of individual particles");
        EMDL::addLabel(EMDL_MLMODEL_ORIGINAL_SIZE, EMDL_INT, "rlnOriginalImageSize", "Original size of the images (in pixels)");
        EMDL::addLabel(EMDL_MLMODEL_PADDING_FACTOR, EMDL_DOUBLE, "rlnPaddingFactor", "Oversampling factor for Fourier transforms of the references");
        EMDL::addLabel(EMDL_MLMODEL_PDF_CLASS, EMDL_DOUBLE, "rlnClassDistribution", "Probability Density Function of the different classes (i.e. fraction of images assigned to each class)");
        EMDL::addLabel(EMDL_MLMODEL_PRIOR_OFFX_CLASS, EMDL_DOUBLE, "rlnClassPriorOffsetX", "Prior in the X-offset for a class (in pixels)");
        EMDL::addLabel(EMDL_MLMODEL_PRIOR_OFFY_CLASS, EMDL_DOUBLE, "rlnClassPriorOffsetY", "Prior in the Y-offset for a class (in pixels)");
        EMDL::addLabel(EMDL_MLMODEL_PDF_ORIENT, EMDL_DOUBLE, "rlnOrientationDistribution", "Probability Density Function of the orientations  (i.e. fraction of images assigned to each orient)");
        EMDL::addLabel(EMDL_MLMODEL_PIXEL_SIZE, EMDL_DOUBLE, "rlnPixelSize", "Size of the pixels in the references and images (in Angstroms)");
        EMDL::addLabel(EMDL_MLMODEL_POWER_REF, EMDL_DOUBLE, "rlnReferenceSpectralPower", "Spherical average of the power of the reference");
        EMDL::addLabel(EMDL_MLMODEL_PRIOR_MODE, EMDL_INT, "rlnOrientationalPriorMode", "Mode for prior distributions on the orientations (0=no prior; 1=(rot,tilt,psi); 2=(rot,tilt); 3=rot; 4=tilt; 5=psi) ");
        EMDL::addLabel(EMDL_MLMODEL_REF_IMAGE, EMDL_STRING, "rlnReferenceImage", "Name of a reference image");
        EMDL::addLabel(EMDL_MLMODEL_SGD_GRADIENT_IMAGE, EMDL_STRING, "rlnSGDGradientImage", "Name of image containing the SGD gradient");
        EMDL::addLabel(EMDL_MLMODEL_SIGMA_OFFSET, EMDL_DOUBLE, "rlnSigmaOffsets","Standard deviation in the origin offsets (in Angstroms)");
        EMDL::addLabel(EMDL_MLMODEL_SIGMA2_NOISE, EMDL_DOUBLE, "rlnSigma2Noise", "Spherical average of the standard deviation in the noise (sigma)");
        EMDL::addLabel(EMDL_MLMODEL_SIGMA2_REF, EMDL_DOUBLE, "rlnReferenceSigma2", "Spherical average of the estimated power in the noise of a reference");
        EMDL::addLabel(EMDL_MLMODEL_SIGMA_ROT, EMDL_DOUBLE, "rlnSigmaPriorRotAngle", "Standard deviation of the prior on the rot (i.e. first Euler) angle");
        EMDL::addLabel(EMDL_MLMODEL_SIGMA_TILT, EMDL_DOUBLE, "rlnSigmaPriorTiltAngle", "Standard deviation of the prior on the tilt (i.e. second Euler) angle");
        EMDL::addLabel(EMDL_MLMODEL_SIGMA_PSI, EMDL_DOUBLE, "rlnSigmaPriorPsiAngle", "Standard deviation of the prior on the psi (i.e. third Euler) angle");
        EMDL::addLabel(EMDL_MLMODEL_SSNR_REF, EMDL_DOUBLE, "rlnSignalToNoiseRatio", "Spectral signal-to-noise ratio for a reference");
        EMDL::addLabel(EMDL_MLMODEL_TAU2_FUDGE_FACTOR, EMDL_DOUBLE, "rlnTau2FudgeFactor", "Regularisation parameter with which estimates for the power in the references will be multiplied (T in original paper)");
        EMDL::addLabel(EMDL_MLMODEL_TAU2_REF, EMDL_DOUBLE, "rlnReferenceTau2", "Spherical average of the estimated power in the signal of a reference");

        EMDL::addLabel(EMDL_OPTIMISER_ACCURACY_ROT, EMDL_DOUBLE, "rlnOverallAccuracyRotations", "Overall accuracy of the rotational assignments (in degrees)");
        EMDL::addLabel(EMDL_OPTIMISER_ACCURACY_TRANS, EMDL_DOUBLE, "rlnOverallAccuracyTranslations", "Overall accuracy of the translational assignments (in pixels)");
        EMDL::addLabel(EMDL_OPTIMISER_ADAPTIVE_FRACTION, EMDL_DOUBLE, "rlnAdaptiveOversampleFraction", "Fraction of the weights that will be oversampled in a second pass of the adaptive oversampling strategy");
		EMDL::addLabel(EMDL_OPTIMISER_ADAPTIVE_OVERSAMPLING, EMDL_INT, "rlnAdaptiveOversampleOrder", "Order of the adaptive oversampling (0=no oversampling, 1= 2x oversampling; 2= 4x oversampling, etc)");
		EMDL::addLabel(EMDL_OPTIMISER_AUTO_LOCAL_HP_ORDER, EMDL_INT, "rlnAutoLocalSearchesHealpixOrder", "Healpix order (before oversampling) from which autosampling procedure will use local angular searches");
		EMDL::addLabel(EMDL_OPTIMISER_AVAILABLE_MEMORY, EMDL_DOUBLE, "rlnAvailableMemory", "Available memory per computing node (i.e. per MPI-process)");
        EMDL::addLabel(EMDL_OPTIMISER_BEST_RESOL_THUS_FAR, EMDL_DOUBLE, "rlnBestResolutionThusFar", "The highest resolution that has been obtained in this optimization thus far");
        EMDL::addLabel(EMDL_OPTIMISER_COARSE_SIZE, EMDL_INT, "rlnCoarseImageSize", "Current size of the images to be used in the first pass of the adaptive oversampling strategy (may be smaller than the original image size)");
        EMDL::addLabel(EMDL_OPTIMISER_CHANGES_OPTIMAL_OFFSETS, EMDL_DOUBLE, "rlnChangesOptimalOffsets", "The average change in optimal translation in the last iteration (in pixels) ");
        EMDL::addLabel(EMDL_OPTIMISER_CHANGES_OPTIMAL_ORIENTS, EMDL_DOUBLE, "rlnChangesOptimalOrientations", "The average change in optimal orientation in the last iteration (in degrees) ");
        EMDL::addLabel(EMDL_OPTIMISER_CHANGES_OPTIMAL_CLASSES, EMDL_DOUBLE, "rlnChangesOptimalClasses", "The number of particles that changed their optimal clsas assignment in the last iteration");
        EMDL::addLabel(EMDL_OPTIMISER_DATA_ARE_CTF_PHASE_FLIPPED, EMDL_BOOL, "rlnCtfDataArePhaseFlipped", "Flag to indicate that the input images have been phase-flipped");
        EMDL::addLabel(EMDL_OPTIMISER_DATA_ARE_CTF_PREMULTIPLIED, EMDL_BOOL, "rlnCtfDataAreCtfPremultiplied", "Flag to indicate that the input images have been premultiplied with their CTF");
        EMDL::addLabel(EMDL_OPTIMISER_DATA_STARFILE, EMDL_STRING, "rlnExperimentalDataStarFile", "STAR file with metadata for the experimental images");
        EMDL::addLabel(EMDL_OPTIMISER_DO_CORRECT_CTF, EMDL_BOOL, "rlnDoCorrectCtf", "Flag to indicate that CTF-correction should be performed");
        EMDL::addLabel(EMDL_OPTIMISER_DO_CORRECT_MAGNIFICATION, EMDL_BOOL, "rlnDoCorrectMagnification", "Flag to indicate that (per-group) magnification correction should be performed");
        EMDL::addLabel(EMDL_OPTIMISER_DO_CORRECT_NORM, EMDL_BOOL, "rlnDoCorrectNorm", "Flag to indicate that (per-image) normalisation-error correction should be performed");
        EMDL::addLabel(EMDL_OPTIMISER_DO_CORRECT_SCALE, EMDL_BOOL, "rlnDoCorrectScale", "Flag to indicate that internal (per-group) intensity-scale correction should be performed");
        EMDL::addLabel(EMDL_OPTIMISER_DO_REALIGN_MOVIES, EMDL_BOOL, "rlnDoRealignMovies", "Flag to indicate that individual frames of movies are being re-aligned");
        EMDL::addLabel(EMDL_OPTIMISER_DO_MAP, EMDL_BOOL, "rlnDoMapEstimation", "Flag to indicate that MAP estimation should be performed (otherwise ML estimation)");
        EMDL::addLabel(EMDL_OPTIMISER_DO_SGD, EMDL_BOOL, "rlnDoStochasticGradientDescent", "Flag to indicate that SGD-optimisation should be performed (otherwise expectation maximisation)");
        EMDL::addLabel(EMDL_OPTIMISER_SGD_MU, EMDL_DOUBLE, "rlnSgdMuFactor", "The mu-parameter that controls the momentum of the SGD gradients");
        EMDL::addLabel(EMDL_OPTIMISER_SGD_SIGMA2FUDGE_INI, EMDL_DOUBLE, "rlnSgdSigma2FudgeInitial", "The variance of the noise will initially be multiplied with this value (larger than 1)");
        EMDL::addLabel(EMDL_OPTIMISER_SGD_SIGMA2FUDGE_HALFLIFE, EMDL_LONG, "rlnSgdSigma2FudgeHalflife", "After processing this many particles the multiplicative factor for the noise variance will have halved");
        EMDL::addLabel(EMDL_OPTIMISER_SGD_SUBSET_START, EMDL_INT, "rlnSgdNextSubset", "Number of the next subset to restart this run with");
        EMDL::addLabel(EMDL_OPTIMISER_SGD_SUBSET_SIZE, EMDL_LONG, "rlnSgdSubsetSize", "The number of particles in the random subsets for SGD");
        EMDL::addLabel(EMDL_OPTIMISER_SGD_WRITE_EVERY_SUBSET, EMDL_INT, "rlnSgdWriteEverySubset", "Every this many subsets the model is written to disk");
        EMDL::addLabel(EMDL_OPTIMISER_SGD_MAX_SUBSETS, EMDL_LONG, "rlnSgdMaxSubsets", "Stop SGD after doing this many subsets (possibly spanning more than 1 iteration)");
        EMDL::addLabel(EMDL_OPTIMISER_SGD_STEPSIZE, EMDL_DOUBLE, "rlnSgdStepsize", "Stepsize in SGD updates)");
        EMDL::addLabel(EMDL_OPTIMISER_DO_AUTO_REFINE, EMDL_BOOL, "rlnDoAutoRefine", "Flag to indicate that 3D auto-refine procedure is being used");
        EMDL::addLabel(EMDL_OPTIMISER_DO_ONLY_FLIP_CTF_PHASES, EMDL_BOOL, "rlnDoOnlyFlipCtfPhases", "Flag to indicate that CTF-correction should only comprise phase-flipping");
        EMDL::addLabel(EMDL_OPTIMISER_DO_SOLVENT_FLATTEN, EMDL_BOOL, "rlnDoSolventFlattening", "Flag to indicate that the references should be masked to set their solvent areas to a constant density");
        EMDL::addLabel(EMDL_OPTIMISER_DO_SKIP_ALIGN, EMDL_BOOL, "rlnDoSkipAlign", "Flag to indicate that orientational (i.e. rotational and translational) searches will be omitted from the refinement, only marginalisation over classes will take place");
        EMDL::addLabel(EMDL_OPTIMISER_DO_SKIP_ROTATE, EMDL_BOOL, "rlnDoSkipRotate", "Flag to indicate that rotational searches will be omitted from the refinement, only marginalisation over classes and translations will take place");
        EMDL::addLabel(EMDL_OPTIMISER_DO_SPLIT_RANDOM_HALVES, EMDL_BOOL, "rlnDoSplitRandomHalves", "Flag to indicate that the data should be split into two completely separate, random halves");
        EMDL::addLabel(EMDL_OPTIMISER_DO_ZERO_MASK, EMDL_BOOL, "rlnDoZeroMask", "Flag to indicate that the surrounding solvent area in the experimental particles will be masked to zeros (by default random noise will be used");
        EMDL::addLabel(EMDL_OPTIMISER_FIX_SIGMA_NOISE, EMDL_BOOL, "rlnFixSigmaNoiseEstimates", "Flag to indicate that the estimates for the power spectra of the noise should be kept constant");
        EMDL::addLabel(EMDL_OPTIMISER_FIX_SIGMA_OFFSET ,EMDL_BOOL, "rlnFixSigmaOffsetEstimates", "Flag to indicate that the estimates for the stddev in the origin offsets should be kept constant");
        EMDL::addLabel(EMDL_OPTIMISER_FIX_TAU, EMDL_BOOL, "rlnFixTauEstimates", "Flag to indicate that the estimates for the power spectra of the signal (i.e. the references) should be kept constant");
        EMDL::addLabel(EMDL_OPTIMISER_HAS_CONVERGED, EMDL_BOOL, "rlnHasConverged", "Flag to indicate that the optimization has converged");
        EMDL::addLabel(EMDL_OPTIMISER_HAS_HIGH_FSC_AT_LIMIT, EMDL_BOOL, "rlnHasHighFscAtResolLimit", "Flag to indicate that the FSC at the resolution limit is significant");
        EMDL::addLabel(EMDL_OPTIMISER_HAS_LARGE_INCR_SIZE_ITER_AGO, EMDL_INT, "rlnHasLargeSizeIncreaseIterationsAgo", "How many iterations have passed since the last large increase in image size");
        EMDL::addLabel(EMDL_OPTIMISER_DO_HELICAL_REFINE, EMDL_BOOL, "rlnDoHelicalRefine", "Flag to indicate that helical refinement should be performed");
        EMDL::addLabel(EMDL_OPTIMISER_IGNORE_HELICAL_SYMMETRY, EMDL_BOOL, "rlnIgnoreHelicalSymmetry", "Flag to indicate that helical symmetry is ignored in 3D reconstruction");
        EMDL::addLabel(EMDL_OPTIMISER_HELICAL_TWIST_INITIAL, EMDL_DOUBLE, "rlnHelicalTwistInitial", "The intial helical twist (rotation per subunit) in degrees before refinement");
        EMDL::addLabel(EMDL_OPTIMISER_HELICAL_RISE_INITIAL, EMDL_DOUBLE, "rlnHelicalRiseInitial", "The initial helical rise (translation per subunit) in Angstroms before refinement");
        EMDL::addLabel(EMDL_OPTIMISER_HELICAL_Z_PERCENTAGE, EMDL_DOUBLE, "rlnHelicalCentralProportion", "Only expand this central fraction of the Z axis when imposing real-space helical symmetry");
        EMDL::addLabel(EMDL_OPTIMISER_HELICAL_TUBE_INNER_DIAMETER, EMDL_DOUBLE, "rlnHelicalMaskTubeInnerDiameter", "Inner diameter of helical tubes in Angstroms (for masks of helical references and particles)");
        EMDL::addLabel(EMDL_OPTIMISER_HELICAL_TUBE_OUTER_DIAMETER, EMDL_DOUBLE, "rlnHelicalMaskTubeOuterDiameter", "Outer diameter of helical tubes in Angstroms (for masks of helical references and particles)");
        EMDL::addLabel(EMDL_OPTIMISER_HELICAL_SYMMETRY_LOCAL_REFINEMENT, EMDL_BOOL, "rlnHelicalSymmetryLocalRefinement", "Flag to indicate that local refinement of helical parameters should be performed");
        EMDL::addLabel(EMDL_OPTIMISER_HELICAL_SIGMA_DISTANCE, EMDL_DOUBLE, "rlnHelicalSigmaDistance", "Sigma of distance along the helical tracks");
        EMDL::addLabel(EMDL_OPTIMISER_HELICAL_KEEP_TILT_PRIOR_FIXED, EMDL_BOOL, "rlnHelicalKeepTiltPriorFixed", "Flag to indicate that helical tilt priors are kept fixed (at 90 degrees) in global angular searches");
        EMDL::addLabel(EMDL_OPTIMISER_HIGHRES_LIMIT_EXP, EMDL_DOUBLE, "rlnHighresLimitExpectation", "High-resolution-limit (in Angstrom) for the expectation step");
        EMDL::addLabel(EMDL_OPTIMISER_HIGHRES_LIMIT_SGD, EMDL_DOUBLE, "rlnHighresLimitSGD", "High-resolution-limit (in Angstrom) for Stochastic Gradient Descent");
        EMDL::addLabel(EMDL_OPTIMISER_IGNORE_CTF_UNTIL_FIRST_PEAK, EMDL_BOOL, "rlnDoIgnoreCtfUntilFirstPeak", "Flag to indicate that the CTFs should be ignored until their first peak");
        EMDL::addLabel(EMDL_OPTIMISER_INCR_SIZE, EMDL_INT, "rlnIncrementImageSize", "Number of Fourier shells to be included beyond the resolution where SSNR^MAP drops below 1");
        EMDL::addLabel(EMDL_OPTIMISER_ITERATION_NO, EMDL_INT, "rlnCurrentIteration", "The number of the current iteration");
        EMDL::addLabel(EMDL_OPTIMISER_LOCAL_SYMMETRY_FILENAME, EMDL_STRING, "rlnLocalSymmetryFile", "Local symmetry description file containing list of masks and their operators");
        EMDL::addLabel(EMDL_OPTIMISER_LOWRES_JOIN_RANDOM_HALVES, EMDL_DOUBLE, "rlnJoinHalvesUntilThisResolution", "Resolution (in Angstrom) to join the two random half-reconstructions to prevent their diverging orientations (for C-symmetries)");
        EMDL::addLabel(EMDL_OPTIMISER_MAGNIFICATION_RANGE, EMDL_DOUBLE, "rlnMagnificationSearchRange", "Search range for magnification correction");
        EMDL::addLabel(EMDL_OPTIMISER_MAGNIFICATION_STEP, EMDL_DOUBLE, "rlnMagnificationSearchStep", "Step size  for magnification correction");
        EMDL::addLabel(EMDL_OPTIMISER_MAX_COARSE_SIZE, EMDL_INT, "rlnMaximumCoarseImageSize", "Maximum size of the images to be used in the first pass of the adaptive oversampling strategy (may be smaller than the original image size)");
        EMDL::addLabel(EMDL_OPTIMISER_MAX_NR_POOL, EMDL_INT, "rlnMaxNumberOfPooledParticles", "Maximum number particles that are processed together to speed up calculations");
        EMDL::addLabel(EMDL_OPTIMISER_MODEL_STARFILE, EMDL_STRING, "rlnModelStarFile", "STAR file with metadata for the model that is being refined");
        EMDL::addLabel(EMDL_OPTIMISER_MODEL_STARFILE2, EMDL_STRING, "rlnModelStarFile2", "STAR file with metadata for the second model that is being refined (from random halves of the data)");
        EMDL::addLabel(EMDL_OPTIMISER_NR_ITERATIONS, EMDL_INT, "rlnNumberOfIterations", "Maximum number of iterations to be performed");
        EMDL::addLabel(EMDL_OPTIMISER_NR_ITER_WO_RESOL_GAIN, EMDL_INT, "rlnNumberOfIterWithoutResolutionGain", "Number of iterations that have passed without a gain in resolution");
        EMDL::addLabel(EMDL_OPTIMISER_NR_ITER_WO_HIDDEN_VAR_CHANGES, EMDL_INT, "rlnNumberOfIterWithoutChangingAssignments", "Number of iterations that have passed without large changes in orientation and class assignments");
        EMDL::addLabel(EMDL_OPTIMISER_OUTPUT_ROOTNAME, EMDL_STRING, "rlnOutputRootName", "Rootname for all output files (this may include a directory structure, which should then exist)");
        EMDL::addLabel(EMDL_OPTIMISER_PARTICLE_DIAMETER, EMDL_DOUBLE, "rlnParticleDiameter", "Diameter of the circular mask to be applied to all experimental images (in Angstroms)");
        EMDL::addLabel(EMDL_OPTIMISER_RADIUS_MASK_3D_MAP, EMDL_INT, "rlnRadiusMaskMap", "Radius of the spherical mask to be applied to all references (in Angstroms)");
        EMDL::addLabel(EMDL_OPTIMISER_RADIUS_MASK_EXP_PARTICLES, EMDL_INT, "rlnRadiusMaskExpImages", "Radius of the circular mask to be applied to all experimental images (in Angstroms)");
        EMDL::addLabel(EMDL_OPTIMISER_RANDOM_SEED, EMDL_INT, "rlnRandomSeed", "Seed (i.e. a number) for the random number generator");
        EMDL::addLabel(EMDL_OPTIMISER_REFS_ARE_CTF_CORRECTED, EMDL_BOOL, "rlnRefsAreCtfCorrected", "Flag to indicate that the input references have been CTF-amplitude corrected");
        EMDL::addLabel(EMDL_OPTIMISER_SMALLEST_CHANGES_OPT_CLASSES, EMDL_INT, "rlnSmallestChangesClasses", "Smallest changes thus far in the optimal class assignments (in numer of particles).");
        EMDL::addLabel(EMDL_OPTIMISER_SMALLEST_CHANGES_OPT_OFFSETS, EMDL_DOUBLE, "rlnSmallestChangesOffsets", "Smallest changes thus far in the optimal offset assignments (in pixels).");
        EMDL::addLabel(EMDL_OPTIMISER_SMALLEST_CHANGES_OPT_ORIENTS, EMDL_DOUBLE, "rlnSmallestChangesOrientations", "Smallest changes thus far in the optimal orientation assignments (in degrees).");
        EMDL::addLabel(EMDL_OPTIMISER_SAMPLING_STARFILE, EMDL_STRING, "rlnOrientSamplingStarFile", "STAR file with metadata for the orientational sampling");
        EMDL::addLabel(EMDL_OPTIMISER_SOLVENT_MASK_NAME, EMDL_STRING, "rlnSolventMaskName", "Name of an image that contains a (possibly soft) mask for the solvent area (values=0 for solvent, values =1 for protein)");
        EMDL::addLabel(EMDL_OPTIMISER_SOLVENT_MASK2_NAME, EMDL_STRING, "rlnSolventMask2Name", "Name of a secondary solvent mask (e.g. to flatten density inside an icosahedral virus)");
        EMDL::addLabel(EMDL_OPTIMISER_TAU_SPECTRUM_NAME, EMDL_STRING, "rlnTauSpectrumName", "Name of a STAR file that holds a tau2-spectrum");
        EMDL::addLabel(EMDL_OPTIMISER_USE_TOO_COARSE_SAMPLING, EMDL_BOOL, "rlnUseTooCoarseSampling", "Flag to indicate that the angular sampling on the sphere will be one step coarser than needed to speed up calculations");
        EMDL::addLabel(EMDL_OPTIMISER_WIDTH_MASK_EDGE, EMDL_INT, "rlnWidthMaskEdge", "Width (in pixels) of the soft edge for spherical/circular masks to be used for solvent flattening");

        EMDL::addLabel(EMDL_ORIENT_FLIP, EMDL_BOOL, "rlnIsFlip", "Flag to indicate that an image should be mirrored");
        EMDL::addLabel(EMDL_ORIENT_ID, EMDL_LONG, "rlnOrientationsID", "ID (i.e. a unique number) for an orientation");
        EMDL::addLabel(EMDL_ORIENT_ORIGIN_X, EMDL_DOUBLE, "rlnOriginX", "X-coordinate (in pixels) for the origin of rotation");
        EMDL::addLabel(EMDL_ORIENT_ORIGIN_X_PRIOR, EMDL_DOUBLE, "rlnOriginXPrior", "Center of the prior on the X-coordinate (in pixels) for the origin of rotation");
        EMDL::addLabel(EMDL_ORIENT_ORIGIN_Y, EMDL_DOUBLE, "rlnOriginY", "Y-coordinate (in pixels) for the origin of rotation");
        EMDL::addLabel(EMDL_ORIENT_ORIGIN_Y_PRIOR, EMDL_DOUBLE, "rlnOriginYPrior", "Center of the prior on the X-coordinate (in pixels) for the origin of rotation");
        EMDL::addLabel(EMDL_ORIENT_ORIGIN_Z, EMDL_DOUBLE, "rlnOriginZ", "Z-coordinate (in pixels) for the origin of rotation");
        EMDL::addLabel(EMDL_ORIENT_ORIGIN_Z_PRIOR, EMDL_DOUBLE, "rlnOriginZPrior", "Center of the prior on the X-coordinate (in pixels) for the origin of rotation");
        EMDL::addLabel(EMDL_ORIENT_ROT, EMDL_DOUBLE, "rlnAngleRot", "First Euler angle (rot, in degrees)");
        EMDL::addLabel(EMDL_ORIENT_ROT_PRIOR, EMDL_DOUBLE, "rlnAngleRotPrior", "Center of the prior (in degrees) on the first Euler angle (rot)");
        EMDL::addLabel(EMDL_ORIENT_TILT, EMDL_DOUBLE, "rlnAngleTilt", "Second Euler angle (tilt, in degrees)");
        EMDL::addLabel(EMDL_ORIENT_TILT_PRIOR, EMDL_DOUBLE, "rlnAngleTiltPrior", "Center of the prior (in degrees) on the second Euler angle (tilt)");
        EMDL::addLabel(EMDL_ORIENT_PSI, EMDL_DOUBLE, "rlnAnglePsi", "Third Euler, or in-plane angle (psi, in degrees)");
        EMDL::addLabel(EMDL_ORIENT_PSI_PRIOR, EMDL_DOUBLE, "rlnAnglePsiPrior", "Center of the prior (in degrees) on the third Euler angle (psi)");
        EMDL::addLabel(EMDL_ORIENT_PSI_PRIOR_FLIP_RATIO, EMDL_DOUBLE, "rlnAnglePsiFlipRatio", "Flip ratio of bimodal psi prior (0~0.5, 0 means an ordinary prior, 0.5 means a perfect bimodal prior)");

        EMDL::addLabel(EMDL_PARTICLE_AUTOPICK_FOM, EMDL_DOUBLE, "rlnAutopickFigureOfMerit", "Autopicking FOM for a particle");
        EMDL::addLabel(EMDL_PARTICLE_HELICAL_TUBE_ID, EMDL_INT, "rlnHelicalTubeID", "Helical tube ID for a helical segment");
        EMDL::addLabel(EMDL_PARTICLE_HELICAL_TUBE_PITCH, EMDL_DOUBLE, "rlnHelicalTubePitch", "Corss-over distance for a helical segment (A)");
        EMDL::addLabel(EMDL_PARTICLE_HELICAL_TRACK_LENGTH, EMDL_DOUBLE, "rlnHelicalTrackLength", "Distance from the position of this helical segment to the starting point of the tube");
        EMDL::addLabel(EMDL_PARTICLE_CLASS, EMDL_INT, "rlnClassNumber", "Class number for which a particle has its highest probability");
        EMDL::addLabel(EMDL_PARTICLE_DLL, EMDL_DOUBLE, "rlnLogLikeliContribution", "Contribution of a particle to the log-likelihood target function");
        EMDL::addLabel(EMDL_PARTICLE_ID, EMDL_LONG, "rlnParticleId", "ID (i.e. a unique number) for a particle");
        EMDL::addLabel(EMDL_PARTICLE_FOM, EMDL_DOUBLE, "rlnParticleFigureOfMerit", "Developmental FOM for a particle");
        EMDL::addLabel(EMDL_PARTICLE_KL_DIVERGENCE, EMDL_DOUBLE, "rlnKullbackLeibnerDivergence", "Kullback-Leibner divergence for a particle");
        EMDL::addLabel(EMDL_PARTICLE_RANDOM_SUBSET, EMDL_INT, "rlnRandomSubset", "Random subset to which this particle belongs");
        EMDL::addLabel(EMDL_PARTICLE_NAME, EMDL_STRING, "rlnParticleName", "Name for a particles");
        EMDL::addLabel(EMDL_PARTICLE_ORI_NAME, EMDL_STRING, "rlnOriginalParticleName", "Original name for a particles");
        EMDL::addLabel(EMDL_PARTICLE_NR_SIGNIFICANT_SAMPLES, EMDL_INT, "rlnNrOfSignificantSamples", "Number of orientational/class assignments (for a particle) with sign.probabilities in the 1st pass of adaptive oversampling"); /**< particle, Number of orientations contributing to weights*/
        EMDL::addLabel(EMDL_PARTICLE_NR_FRAMES, EMDL_INT, "rlnNrOfFrames", "Number of movie frames that were collected for this particle");
        EMDL::addLabel(EMDL_PARTICLE_NR_FRAMES_AVG, EMDL_INT, "rlnAverageNrOfFrames", "Number of movie frames that one averages over upon extraction of movie-particles");
        EMDL::addLabel(EMDL_PARTICLE_MOVIE_RUNNING_AVG, EMDL_INT, "rlnMovieFramesRunningAverage", "Number of movie frames inside the running average that will be used for movie-refinement");
        EMDL::addLabel(EMDL_PARTICLE_PMAX, EMDL_DOUBLE, "rlnMaxValueProbDistribution", "Maximum value of the (normalised) probability function for a particle"); /**< particle, Maximum value of probability distribution */

        EMDL::addLabel(EMDL_PIPELINE_JOB_COUNTER, EMDL_INT, "rlnPipeLineJobCounter", "Number of the last job in the pipeline");
        EMDL::addLabel(EMDL_PIPELINE_NODE_NAME, EMDL_STRING , "rlnPipeLineNodeName", "Name of a Node in the pipeline");
        EMDL::addLabel(EMDL_PIPELINE_NODE_TYPE, EMDL_INT, "rlnPipeLineNodeType", "Type of a Node in the pipeline");
        EMDL::addLabel(EMDL_PIPELINE_PROCESS_ALIAS, EMDL_STRING , "rlnPipeLineProcessAlias", "Alias of a Process in the pipeline");
        EMDL::addLabel(EMDL_PIPELINE_PROCESS_NAME, EMDL_STRING , "rlnPipeLineProcessName", "Name of a Process in the pipeline");
        EMDL::addLabel(EMDL_PIPELINE_PROCESS_TYPE, EMDL_INT, "rlnPipeLineProcessType", "Type of a Process in the pipeline");
        EMDL::addLabel(EMDL_PIPELINE_PROCESS_STATUS, EMDL_INT, "rlnPipeLineProcessStatus", "Status of a Process in the pipeline (running, scheduled, finished or cancelled)");
        EMDL::addLabel(EMDL_PIPELINE_EDGE_FROM, EMDL_STRING , "rlnPipeLineEdgeFromNode", "Name of the origin of an edge");
        EMDL::addLabel(EMDL_PIPELINE_EDGE_TO, EMDL_STRING ,"rlnPipeLineEdgeToNode", "Name of the to-Node in an edge");
        EMDL::addLabel(EMDL_PIPELINE_EDGE_PROCESS, EMDL_STRING ,"rlnPipeLineEdgeProcess", "Name of the destination of an edge");

        EMDL::addLabel(EMDL_POSTPROCESS_FINAL_RESOLUTION, EMDL_DOUBLE, "rlnFinalResolution", "Final estimated resolution after postprocessing (in Angstroms)");
        EMDL::addLabel(EMDL_POSTPROCESS_BFACTOR, EMDL_DOUBLE, "rlnBfactorUsedForSharpening", "Applied B-factor in the sharpening of the map");
        EMDL::addLabel(EMDL_POSTPROCESS_FSC_GENERAL, EMDL_DOUBLE, "rlnFourierShellCorrelation", "FSC value (of unspecified type, e.g. masked or unmasked)");
        EMDL::addLabel(EMDL_POSTPROCESS_FSC_TRUE, EMDL_DOUBLE, "rlnFourierShellCorrelationCorrected", "Final FSC value: i.e. after correction based on masking of randomized-phases maps");
        EMDL::addLabel(EMDL_POSTPROCESS_FSC_MASKED, EMDL_DOUBLE, "rlnFourierShellCorrelationMaskedMaps", "FSC value after masking of the original maps");
        EMDL::addLabel(EMDL_POSTPROCESS_FSC_UNMASKED, EMDL_DOUBLE, "rlnFourierShellCorrelationUnmaskedMaps", "FSC value before masking of the original maps");
        EMDL::addLabel(EMDL_POSTPROCESS_FSC_RANDOM_MASKED, EMDL_DOUBLE, "rlnCorrectedFourierShellCorrelationPhaseRandomizedMaskedMaps", "FSC value after masking of the randomized-phases maps");
        EMDL::addLabel(EMDL_POSTPROCESS_AMPLCORR_MASKED, EMDL_DOUBLE, "rlnAmplitudeCorrelationMaskedMaps", "Correlation coefficient between amplitudes in Fourier shells of masked maps");
        EMDL::addLabel(EMDL_POSTPROCESS_AMPLCORR_UNMASKED,  EMDL_DOUBLE, "rlnAmplitudeCorrelationUnmaskedMaps", "Correlation coefficient between amplitudes in Fourier shells of unmasked maps");
        EMDL::addLabel(EMDL_POSTPROCESS_DPR_MASKED, EMDL_DOUBLE, "rlnDifferentialPhaseResidualMaskedMaps", "Differential Phase Residual in Fourier shells of masked maps");
        EMDL::addLabel(EMDL_POSTPROCESS_DPR_UNMASKED,  EMDL_DOUBLE, "rlnDifferentialPhaseResidualUnmaskedMaps", "Differential Phase Residual in Fourier shells of unmasked maps");
        EMDL::addLabel(EMDL_POSTPROCESS_GUINIER_FIT_INTERCEPT, EMDL_DOUBLE, "rlnFittedInterceptGuinierPlot", "The fitted intercept of the Guinier-plot");
        EMDL::addLabel(EMDL_POSTPROCESS_GUINIER_FIT_SLOPE, EMDL_DOUBLE, "rlnFittedSlopeGuinierPlot", "The fitted slope of the Guinier-plot");
        EMDL::addLabel(EMDL_POSTPROCESS_GUINIER_FIT_CORRELATION, EMDL_DOUBLE, "rlnCorrelationFitGuinierPlot", "The correlation coefficient of the fitted line through the Guinier-plot");
        EMDL::addLabel(EMDL_POSTPROCESS_GUINIER_VALUE_IN, EMDL_DOUBLE, "rlnLogAmplitudesOriginal", "Y-value for Guinier plot: the logarithm of the radially averaged amplitudes of the input map");
        EMDL::addLabel(EMDL_POSTPROCESS_GUINIER_VALUE_INVMTF, EMDL_DOUBLE, "rlnLogAmplitudesMTFCorrected", "Y-value for Guinier plot: the logarithm of the radially averaged amplitudes after MTF correction");
        EMDL::addLabel(EMDL_POSTPROCESS_GUINIER_VALUE_WEIGHTED, EMDL_DOUBLE, "rlnLogAmplitudesWeighted", "Y-value for Guinier plot: the logarithm of the radially averaged amplitudes after FSC-weighting");
        EMDL::addLabel(EMDL_POSTPROCESS_GUINIER_VALUE_SHARPENED, EMDL_DOUBLE, "rlnLogAmplitudesSharpened", "Y-value for Guinier plot: the logarithm of the radially averaged amplitudes after sharpening");
        EMDL::addLabel(EMDL_POSTPROCESS_GUINIER_VALUE_INTERCEPT, EMDL_DOUBLE, "rlnLogAmplitudesIntercept", "Y-value for Guinier plot: the fitted plateau of the logarithm of the radially averaged amplitudes");
        EMDL::addLabel(EMDL_POSTPROCESS_GUINIER_RESOL_SQUARED, EMDL_DOUBLE, "rlnResolutionSquared", "X-value for Guinier plot: squared resolution in 1/Angstrom^2");
		EMDL::addLabel(EMDL_POSTPROCESS_MTF_VALUE, EMDL_DOUBLE, "rlnMtfValue", "Value of the detectors modulation transfer function (between 0 and 1)");

        EMDL::addLabel(EMDL_SAMPLING_IS_3D, EMDL_BOOL, "rlnIs3DSampling", "Flag to indicate this concerns a 3D sampling ");
        EMDL::addLabel(EMDL_SAMPLING_IS_3D_TRANS, EMDL_BOOL, "rlnIs3DTranslationalSampling", "Flag to indicate this concerns a x,y,z-translational sampling ");
        EMDL::addLabel(EMDL_SAMPLING_HEALPIX_ORDER, EMDL_INT, "rlnHealpixOrder", "Healpix order for the sampling of the first two Euler angles (rot, tilt) on the 3D sphere");
        EMDL::addLabel(EMDL_SAMPLING_LIMIT_TILT, EMDL_DOUBLE, "rlnTiltAngleLimit", "Values to which to limit the tilt angles (positive for keeping side views, negative for keeping top views)");
        // Jun19,2015 - Shaoda, I think all of these 3 offsets are in PIXELS.
        EMDL::addLabel(EMDL_SAMPLING_OFFSET_RANGE, EMDL_DOUBLE, "rlnOffsetRange", "Search range for the origin offsets (in Angstroms)");
        EMDL::addLabel(EMDL_SAMPLING_OFFSET_STEP, EMDL_DOUBLE, "rlnOffsetStep", "Step size for the searches in the origin offsets (in Angstroms)");
        EMDL::addLabel(EMDL_SAMPLING_HELICAL_OFFSET_STEP, EMDL_DOUBLE, "rlnHelicalOffsetStep", "Step size for the searches of offsets along helical axis (in Angstroms)");
        EMDL::addLabel(EMDL_SAMPLING_PERTURB, EMDL_DOUBLE, "rlnSamplingPerturbInstance", "Random instance of the random perturbation on the orientational sampling");
        EMDL::addLabel(EMDL_SAMPLING_PERTURBATION_FACTOR, EMDL_DOUBLE, "rlnSamplingPerturbFactor", "Factor for random perturbation on the orientational sampling (between 0 no perturbation and 1 very strong perturbation)");
        EMDL::addLabel(EMDL_SAMPLING_PSI_STEP, EMDL_DOUBLE, "rlnPsiStep", "Step size (in degrees) for the sampling of the in-plane rotation angle (psi)");
        EMDL::addLabel(EMDL_SAMPLING_SYMMETRY, EMDL_STRING, "rlnSymmetryGroup", "Symmetry group (e.g., C1, D7, I2, I5, etc.)");

        EMDL::addLabel(EMDL_SELECTED, EMDL_BOOL, "rlnSelected", "Flag whether an entry in a metadatatable is selected in the viewer or not");
        EMDL::addLabel(EMDL_SELECT_PARTICLES_ZSCORE, EMDL_DOUBLE, "rlnParticleSelectZScore", "Sum of Z-scores from particle_select. High Z-scores are likely to be outliers.");
        EMDL::addLabel(EMDL_SORTED_IDX, EMDL_LONG, "rlnSortedIndex", "Index of a metadata entry after sorting (first sorted index is 0).");
        EMDL::addLabel(EMDL_STARFILE_MOVIE_PARTICLES, EMDL_STRING, "rlnStarFileMovieParticles", "Filename of a STAR file with movie-particles in it");
        EMDL::addLabel(EMDL_PERFRAME_CUMULATIVE_WEIGHT, EMDL_DOUBLE, "rlnPerFrameCumulativeWeight", "Sum of the resolution-dependent relative weights from the first frame until the given frame");
		EMDL::addLabel(EMDL_PERFRAME_RELATIVE_WEIGHT, EMDL_DOUBLE, "rlnPerFrameRelativeWeight", "The resolution-dependent relative weights for a given frame");

        EMDL::addLabel(EMDL_RESOLUTION, EMDL_DOUBLE, "rlnResolution", "Resolution (in 1/Angstroms)");
        EMDL::addLabel(EMDL_RESOLUTION_ANGSTROM, EMDL_DOUBLE, "rlnAngstromResolution", "Resolution (in Angstroms)");
        EMDL::addLabel(EMDL_RESOLUTION_INVPIXEL, EMDL_DOUBLE, "rlnResolutionInversePixel", "Resolution (in 1/pixel, Nyquist = 0.5)");
        EMDL::addLabel(EMDL_SPECTRAL_IDX, EMDL_INT, "rlnSpectralIndex", "Spectral index (i.e. distance in pixels to the origin in Fourier space) ");

     }

    ~StaticInitialization()
    {
    }
    friend class EMDL;
};

/**Just an utility function */
bool vectorContainsLabel(const std::vector<EMDLabel>& labelsVector, const EMDLabel label);

#endif


text:
<?xml version="1.0"?>
<component name="ca.firstvoices.rest.freshness.service" version="1.0.0">
  <implementation class="ca.firstvoices.rest.freshness.services.DirectoryFreshnessServiceHashMapImpl"/>

  <service>
    <provide interface="ca.firstvoices.rest.freshness.services.DirectoryFreshnessService"/>
  </service>
</component>

redpajama_set_name: RedPajamaGithub


text:
package com.soeima.resources.extensions;

import com.soeima.resources.PathItemFactory;
import com.soeima.resources.RecursionType;
import com.soeima.resources.Resource;
import com.soeima.resources.ResourceLoader;
import com.soeima.resources.util.IOUtil;
import com.soeima.resources.util.ReflectionUtil;
import com.soeima.resources.util.Strings;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;

/**
 * Implements an extension loading mechanism, which is used to load protocol extensions.
 *
 * @author   Marco Soeima
 * @version  2012/10/08
 */
public class ResourceExtensionLoader {

    /** Indicates if the extensions have already been loaded. */
    private boolean loaded;

    /**
     * Creates a new {@link ResourceExtensionLoader} object.
     */
    public ResourceExtensionLoader() {
    }

    /**
     * Loads the extension path item factories, i.e., those which are not built into the core.
     *
     * @return  The list of extension {@link PathItemFactory} objects.
     */
    public List<PathItemFactory> loadExtensions() {
        ResourceLoader rl = new ResourceLoader();
        rl.setRecursionType(RecursionType.Recursive);

        for (String path : Strings.split(System.getProperty("java.class.path"), File.pathSeparator)) {
            rl.addPath(path);
        }

        List<PathItemFactory> factories = new ArrayList<PathItemFactory>();

        for (Resource resource : rl.getResourcesForExtension(ResourceExtensionProperties.Extension)) {
            Properties properties = new Properties();
            InputStream is = null;

            try {
                is = resource.getInputStream();
                properties.load(is);
            }
            catch (IOException e) {
            }
            finally {
                IOUtil.close(is);
            }

            PathItemFactory factory =
                ReflectionUtil.newInstance(properties.getProperty(ResourceExtensionProperties.FactoryName));

            if (factory != null) {
                factories.add(factory);
            }
        }

        loaded = true;
        return factories;
    } // end method loadExtensions

    /**
     * Returns true if the extensions have already been loaded.
     *
     * @return  true if the extensions have already been loaded; false otherwise.
     */
    public boolean extensionsLoaded() {
        return loaded;
    }
} // end class ResourceExtensionLoader


text:
package cluster

import (
	"bytes"
	"context"
	"encoding/json"
	"io"
	"io/ioutil"
	"time"

	yaml2 "github.com/ghodss/yaml"
	"github.com/rancher/norman/types/convert"
	"github.com/rancher/norman/types/values"
	v1 "github.com/rancher/types/apis/core/v1"
	"github.com/sirupsen/logrus"
	authV1 "k8s.io/api/authorization/v1"
	"k8s.io/apimachinery/pkg/api/meta"
	v12 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
	"k8s.io/apimachinery/pkg/runtime"
	"k8s.io/apimachinery/pkg/util/yaml"
	clientauthv1 "k8s.io/client-go/kubernetes/typed/authorization/v1"
)

type noopCloser struct {
	io.Reader
}

func (noopCloser) Close() error {
	return nil
}

func findNamespaceCreates(inputYAML string) ([]string, error) {
	var namespaces []string

	reader := yaml.NewDocumentDecoder(noopCloser{Reader: bytes.NewBufferString(inputYAML)})
	for {
		next, readErr := ioutil.ReadAll(reader)
		if readErr != nil && readErr != io.ErrShortBuffer {
			return nil, readErr
		}

		obj := &unstructured.Unstructured{}
		next, err := yaml2.YAMLToJSON(next)
		if err != nil {
			return nil, err
		}

		err = json.Unmarshal(next, &obj.Object)
		if err != nil {
			return nil, err
		}

		if obj.IsList() {
			obj.EachListItem(func(obj runtime.Object) error {
				metadata, err := meta.Accessor(obj)
				if err != nil {
					return err
				}
				if obj.GetObjectKind().GroupVersionKind().Kind == "Namespace" && obj.GetObjectKind().GroupVersionKind().Version == "v1" {
					namespaces = append(namespaces, metadata.GetName())
				}

				if metadata.GetNamespace() != "" {
					namespaces = append(namespaces, metadata.GetNamespace())
				}
				return nil
			})
		} else if obj.GetKind() == "Namespace" && obj.GetAPIVersion() == "v1" {
			namespaces = append(namespaces, obj.GetName())
			if obj.GetNamespace() != "" {
				namespaces = append(namespaces, obj.GetNamespace())
			}
		}

		if readErr == nil {
			break
		}
	}

	uniq := map[string]bool{}
	var newNamespaces []string
	for _, ns := range namespaces {
		if !uniq[ns] {
			uniq[ns] = true
			newNamespaces = append(newNamespaces, ns)
		}
	}

	return newNamespaces, nil
}

func waitForNS(nsClient v1.NamespaceInterface, namespaces []string) {
	for i := 0; i < 3; i++ {
		allGood := true
		for _, ns := range namespaces {
			ns, err := nsClient.Get(ns, v12.GetOptions{})
			if err != nil {
				allGood = false
				break
			}
			status := ns.Annotations["cattle.io/status"]
			if status == "" {
				allGood = false
				break
			}
			nsMap := map[string]interface{}{}
			err = json.Unmarshal([]byte(status), &nsMap)
			if err != nil {
				allGood = false
				break
			}

			foundCond := false
			conds := convert.ToMapSlice(values.GetValueN(nsMap, "Conditions"))
			for _, cond := range conds {
				if cond["Type"] == "InitialRolesPopulated" && cond["Status"] == "True" {
					foundCond = true
				}
			}

			if !foundCond {
				allGood = false
			}
		}

		if allGood {
			break
		} else {
			time.Sleep(2 * time.Second)
		}
	}
}

func CanCreateRKETemplate(callerID string, subjectAccessReviewClient clientauthv1.SubjectAccessReviewInterface) (bool, error) {
	review := authV1.SubjectAccessReview{
		Spec: authV1.SubjectAccessReviewSpec{
			User: callerID,
			ResourceAttributes: &authV1.ResourceAttributes{
				Verb:     "create",
				Resource: "clustertemplates",
				Group:    "management.cattle.io",
			},
		},
	}

	result, err := subjectAccessReviewClient.Create(context.TODO(), &review, v12.CreateOptions{})
	if err != nil {
		return false, err
	}
	logrus.Debugf("CanCreateRKETemplate: %v", result)
	return result.Status.Allowed, nil
}


text:
package ch.squix.extraleague.rest.notification;

import static com.googlecode.objectify.ObjectifyService.ofy;

import java.io.UnsupportedEncodingException;
import java.util.Random;
import java.util.logging.Logger;

import org.restlet.resource.Get;
import org.restlet.resource.ServerResource;

import ch.squix.extraleague.model.client.BrowserClient;

import com.google.appengine.api.channel.ChannelService;
import com.google.appengine.api.channel.ChannelServiceFactory;

public class NotificationTokenResource extends ServerResource {

	private static final Logger log = Logger.getLogger(NotificationTokenResource.class.getName());

	@Get(value = "json")
	public NotificationTokenDto execute() throws UnsupportedEncodingException {
		ChannelService channelService = ChannelServiceFactory.getChannelService();
		Random random = new Random();
		String clientId = String.valueOf(random.nextLong());
		String token = channelService.createChannel(clientId);
		BrowserClient client = new BrowserClient();
		client.setClientId(clientId);
		client.setToken(token);
		ofy().save().entities(client);
		NotificationTokenDto dto = new NotificationTokenDto();
		dto.setToken(token);
		return dto;
	}

}


text:
using FluentAssertions;
using System;
using System.Linq;
using Xunit;

namespace AlfredoRevillaBairesdevChallenge.Tests
{
    public class StringLineToContactMapperTests
    {
        private StringLineToContactMapper _mapper;

        public StringLineToContactMapperTests()
        {
            _mapper = new StringLineToContactMapper();
        }

        [Fact]
        public void Result_count_should_be_same_as_input_lines_count()
        {
            //  arrage
            var data = new[]{"573435640 | jean | harion | vice president | Dominica | Telecommunications | 0 | 0",
                 "337983069 | meredith | kopit - levien | chief revenue officer| United States | Publishing | 0 | 0"};

            //  act
            var result = _mapper.Map(data);

            //  assert
            result.Count().Should().Be(data.Count());
        }
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"

    android:orientation="horizontal" >

<TextView
    android:id="@+id/desc"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:textSize="24dp"
    android:paddingLeft="10dp"
    />
</LinearLayout>


text:
import fs from 'fs';
import { join } from 'path';
import Promise from 'bluebird';
import { IIntlMessage } from '../../../domain';
import config from '../../config';

// Get locales
const locales = config.locales.map(locale => locale.id);

// A folder with messages
// In development, source dir will be used
const MESSAGES_DIR = process.env.MESSAGES_DIR || join(__dirname, './intl');

const readFile = Promise.promisify(fs.readFile);

export default async (root, { locale }): IIntlMessage[] => {
  if (!locales.includes(locale)) {
    throw new Error(`Locale '${locale}' not supported`);
  }
  let localeData;
  try {
    localeData = await readFile(join(MESSAGES_DIR, `translations/${locale}.json`));
  } catch (err) {
    if (err.code === 'ENOENT') {
      throw new Error(`Locale '${locale}' not found`);
    }
  }
  const translations = JSON.parse(localeData);
  return Object.keys(translations).map(messageId => ({
    id: `${messageId}.${locale}`,
    messageId,
    message: translations[messageId],
  }));
};


text:
""" Hash based helper functions.

"""

import hashlib
from typing import Callable, List, Tuple, Union

from btclib.alias import HashF, Octets
from btclib.ecc.curve import Curve, secp256k1

# from btclib.to_pub_key import Key, pub_keyinfo_from_key
from btclib.utils import bytes_from_octets, int_from_bits

H160_Net = Tuple[bytes, str]

def ripemd160(octets: Octets) -> bytes:
    "Return the RIPEMD160(*) of the input octet sequence."

    octets = bytes_from_octets(octets)
    return hashlib.new("ripemd160", octets).digest()

def sha256(octets: Octets) -> bytes:
    "Return the SHA256(*) of the input octet sequence."

    octets = bytes_from_octets(octets)
    return hashlib.sha256(octets).digest()

def hash160(octets: Octets) -> bytes:
    "Return the HASH160=RIPEMD160(SHA256) of the input octet sequence."

    return ripemd160(sha256(octets))

def hash256(octets: Octets) -> bytes:
    "Return the SHA256(SHA256(*)) of the input octet sequence."

    return sha256(sha256(octets))

def reduce_to_hlen(msg: Octets, hf: HashF = hashlib.sha256) -> bytes:

    msg = bytes_from_octets(msg)
    # Step 4 of SEC 1 v.2 section 4.1.3
    h = hf()
    h.update(msg)
    return h.digest()

def magic_message(msg: Octets) -> bytes:

    msg = bytes_from_octets(msg)
    t = (
        b"\x18Bitcoin Signed Message:\n"
        + len(msg).to_bytes(1, byteorder="big", signed=False)
        + msg
    )
    return sha256(t)

# FIXME move into ecc folder
def challenge_(
    msg_hash: Octets, ec: Curve = secp256k1, hf: HashF = hashlib.sha256
) -> int:

    # the message msg_hash: a hf_len array
    hf_len = hf().digest_size
    msg_hash = bytes_from_octets(msg_hash, hf_len)

    # leftmost ec.nlen bits %= ec.n
    return int_from_bits(msg_hash, ec.nlen) % ec.n

def merkle_root(data: List[bytes], hf: Callable[[Union[bytes, str]], bytes]) -> bytes:
    """Return the Merkel tree root of a list of binary hashes.

    The Merkel tree is a binary tree constructed
    with the provided list of binary data as bottom level,
    then recursively going up one level
    by hashing every hash value pair in the current level,
    until a single value (root) is obtained.
    """

    data = [hf(item) for item in data]
    while len(data) != 1:
        parent_level = []
        if len(data) % 2:
            data.append(data[-1])
        for i in range(0, len(data), 2):
            parent = hf(data[i] + data[i + 1])
            parent_level.append(parent)
        data = parent_level[:]
    return data[0]

def tagged_hash(tag: bytes, m: bytes, hf: HashF = hashlib.sha256) -> bytes:

    h1 = hf()
    h1.update(tag)
    tag_hash = h1.digest()

    h2 = hf()
    h2.update(tag_hash + tag_hash)

    # it could be sped up by storing the above midstate

    h2.update(m)
    return h2.digest()


text:
"""Module for testing the manage command."""

import os

import unittest

if __name__ == "__main__":
    import utils
    utils.import_depends()

from brokertest import TestBrokerCommand
from broker.personalitytest import PersonalityTestMixin

class TestManage(PersonalityTestMixin, TestBrokerCommand):

    def test_100_manage_unittest02(self):
        self.verify_buildfiles("unittest", "unittest02.one-nyp.ms.com",
                               want_exist=True)
        # we are using --force to bypass checks because the source domain unittest
        # latest commit does not exist in template-king
        command = ["manage", "--hostname", "unittest02.one-nyp.ms.com", "--sandbox", "%s/changetest1" % self.user, "--force"]
        out, err = self.successtest(command)
        self.matchoutput(err, 'Moving host unittest02.one-nyp.ms.com from domain unittest to sandbox changetest1', command)
        self.verify_buildfiles("unittest", "unittest02.one-nyp.ms.com",
                               want_exist=False)

    def test_101_verify_cleanup(self):
        basedir = self.config.get("broker", "basedir")
        command = [basedir,
                   "-name", "unittest02.one-nyp.ms.com*",
                   "-path", "*/unittest/*"]
        # basedir may contain the string ".../unittest/..."
        out = ["BASEDIR" + name[len(basedir):] for name in
               self.findcommand(command)]
        self.matchclean(" ".join(out), "/unittest/",
                        "find %s" % " ".join(command))

    def test_105_cat_unittest02(self):
        command = ["cat", "--hostname", "unittest02.one-nyp.ms.com"]
        out = self.commandtest(command)
        self.matchoutput(out, '"/metadata/template/branch/name" = "changetest1";', command)
        self.matchoutput(out, '"/metadata/template/branch/type" = "sandbox";', command)
        self.matchoutput(out,
                         '"/metadata/template/branch/author" = "%s";' % self.user,
                         command)

    def test_105_show_unittest02(self):
        command = "show host --hostname unittest02.one-nyp.ms.com"
        out = self.commandtest(command.split(" "))
        self.matchoutput(out, "Primary Name: unittest02.one-nyp.ms.com", command)
        self.matchoutput(out, "Sandbox: %s/changetest1" % self.user, command)

    def test_105_show_unittest02_proto(self):
        command = "show host --hostname unittest02.one-nyp.ms.com --format proto"
        host = self.protobuftest(command.split(" "), expect=1)[0]
        self.assertEqual(host.sandbox_author, self.user)
        self.assertEqual(host.domain.name, "changetest1")
        self.assertEqual(host.domain.type, host.domain.SANDBOX)

    def test_108_manage_unittest02_again(self):
        self.successtest(["manage", "--hostname", "unittest02.one-nyp.ms.com",
                          "--sandbox", "%s/changetest1" % self.user, "--skip_auto_compile"])
        self.verify_buildfiles("unittest", "unittest02.one-nyp.ms.com",
                               want_exist=False)
        command = ["cat", "--hostname", "unittest02.one-nyp.ms.com"]
        out = self.commandtest(command)
        self.matchoutput(out, '"/metadata/template/branch/name" = "changetest1";', command)
        self.matchoutput(out, '"/metadata/template/branch/type" = "sandbox";', command)
        self.matchoutput(out,
                         '"/metadata/template/branch/author" = "%s";' % self.user,
                         command)

    def test_110_manage_server1(self):
        # we are using --force to bypass checks because the source domain unittest
        # latest commit does not exist in template-king
        self.successtest(["manage", "--hostname", "server1.aqd-unittest.ms.com",
                          "--domain", "unittest", "--force"])
        command = ["cat", "--hostname", "server1.aqd-unittest.ms.com"]
        out = self.commandtest(command)
        self.matchoutput(out, '"/metadata/template/branch/name" = "unittest";', command)
        self.matchoutput(out, '"/metadata/template/branch/type" = "domain";', command)

    def test_115_verify_server1(self):
        command = "show host --hostname server1.aqd-unittest.ms.com"
        out = self.commandtest(command.split(" "))
        self.matchoutput(out, "Primary Name: server1.aqd-unittest.ms.com", command)
        self.matchoutput(out, "Domain: unittest", command)

    def test_120_manage_unittest00(self):
        self.verify_buildfiles("unittest", "unittest00.one-nyp.ms.com",
                               want_exist=True)
        # we are using --force to bypass checks because the source domain unittest
        # latest commit does not exist in template-king
        self.successtest(["manage", "--hostname", "unittest00.one-nyp.ms.com",
                          "--sandbox", "%s/changetest2" % self.user, "--force"])
        self.verify_buildfiles("unittest", "unittest00.one-nyp.ms.com",
                               want_exist=False)

    def test_125_verify_unittest00(self):
        command = "show host --hostname unittest00.one-nyp.ms.com"
        out = self.commandtest(command.split(" "))
        self.matchoutput(out, "Primary Name: unittest00.one-nyp.ms.com", command)
        self.matchoutput(out, "Sandbox: %s/changetest2" % self.user, command)

    def test_130_manage_utecl1(self):
        # To compile, this needs templates from the unittest domain.
        # This test takes advantage of the fact that those templates
        # started in the utsandbox sandbox.
        self.verify_buildfiles("unittest", "clusters/utecl1", want_exist=True)
        command = ["search_host", "--cluster", "utecl1"]
        hosts = self.commandtest(command).splitlines()
        self.assertTrue(hosts, "No hosts in cluster utecl1, bad test.")
        for host in hosts:
            self.verify_buildfiles("unittest", host, want_exist=True)

        # we want to manage utecl1, but have to do it at metacluster level.
        # we are using --force to bypass checks because the source domain unittest
        # latest commit does not exist in template-king
        command = ["manage", "--metacluster", "utmc1",
                   "--sandbox", "%s/utsandbox" % self.user, "--force"]
        self.successtest(command)
        self.verify_buildfiles("unittest", "clusters/utecl1", want_exist=False)
        for host in hosts:
            self.verify_buildfiles("unittest", host, want_exist=False)
        command = ["compile", "--sandbox=%s/utsandbox" % self.user]
        self.successtest(command)
        self.verify_buildfiles("utsandbox", "clusters/utecl1",
                               want_exist=True)
        for host in hosts:
            self.verify_buildfiles("utsandbox", host, want_exist=True)

    def test_135_verify_utecl1(self):
        command = ["show_esx_cluster", "--cluster=utecl1"]
        out = self.commandtest(command)
        self.matchoutput(out, "Sandbox: %s/utsandbox" % self.user, command)

        command = ["cat", "--cluster", "utecl1"]
        out = self.commandtest(command)
        self.matchoutput(out, '"/metadata/template/branch/name" = "utsandbox";', command)
        self.matchoutput(out, '"/metadata/template/branch/type" = "sandbox";', command)
        self.matchoutput(out,
                         '"/metadata/template/branch/author" = "%s";' % self.user,
                         command)

        command = ["search_host", "--cluster=utecl1"]
        out = self.commandtest(command)
        members = sorted(out.splitlines())
        self.assertTrue(members, "No hosts in output of %s." % command)

        command = ["search_host", "--cluster=utecl1",
                   "--sandbox=%s/utsandbox" % self.user]
        out = self.commandtest(command)
        aligned = sorted(out.splitlines())
        self.assertEqual(members, aligned,
                         "Not all utecl1 cluster members (%s) are in "
                         "sandbox utsandbox (%s)." % (members, aligned))

    def test_135_show_utecl1_proto(self):
        command = ["show_esx_cluster", "--cluster=utecl1", "--format", "proto"]
        cluster = self.protobuftest(command, expect=1)[0]
        self.assertEqual(cluster.sandbox_author, self.user)
        self.assertEqual(cluster.domain.name, "utsandbox")
        self.assertEqual(cluster.domain.type, cluster.domain.SANDBOX)

    def test_135_show_utmc1_proto(self):
        command = ["show_metacluster", "--metacluster=utmc1", "--format", "proto"]
        mc = self.protobuftest(command, expect=1)[0]
        self.assertEqual(mc.sandbox_author, self.user)
        self.assertEqual(mc.domain.name, "utsandbox")
        self.assertEqual(mc.domain.type, mc.domain.SANDBOX)

    def test_140_xml_profiles(self):
        command = ["manage", "--domain", "unittest-xml", "--force",
                  "--hostname", "unittest20.aqd-unittest.ms.com"]
        out = self.statustest(command)
        self.matchoutput(out, 'Moving host unittest20.aqd-unittest.ms.com '
                              'from domain unittest to domain unittest-xml', command)
        self.matchoutput(out, '1/1 template(s) being processed', command)
        self.verify_buildfiles("unittest-xml", "unittest20.aqd-unittest.ms.com",
                               xml=True, json=False)

    def test_141_xml_profiles_compile_not_repeated(self):
        command = ["compile", "--hostname", "unittest20.aqd-unittest.ms.com"]
        out = self.statustest(command)
        self.matchoutput(out, '0/1 template(s) being processed', command)

    def test_145_json_profiles(self):
        self.successtest(["manage", "--domain", "unittest-json", "--force",
                          "--hostname", "unittest20.aqd-unittest.ms.com"])
        self.successtest(["compile", "--hostname", "unittest20.aqd-unittest.ms.com"])
        self.verify_buildfiles("unittest-json", "unittest20.aqd-unittest.ms.com",
                               xml=False, json=True)

    def test_150_setup_featuretest(self):
        self.create_personality("aquilon", "featuretest")
        self.noouttest(["add_feature", "--feature", "notemplate",
                        "--type", "host", "--eon_id", 2,
                        "--visibility", "public",
                        "--activation", "rebuild", "--deactivation", "reboot"])
        self.successtest(["manage", "--hostname", "aquilon68.aqd-unittest.ms.com",
                          "--domain", "unittest", "--force"])
        self.statustest(["reconfigure", "--hostname", "aquilon68.aqd-unittest.ms.com",
                         "--personality", "featuretest"])

    def test_151_bind_no_template(self):
        command = ["bind_feature", "--feature", "notemplate",
                   "--personality", "featuretest"]
        out = self.badrequesttest(command)
        self.matchoutput(out,
                         "Host Feature notemplate does not have templates "
                         "present in domain unittest for archetype aquilon.",
                         command)

    def test_152_move_aquilon68_to_sandbox(self):
        self.successtest(["manage", "--hostname", "aquilon68.aqd-unittest.ms.com",
                          "--sandbox", "%s/utsandbox" % self.user, "--force"])

    def test_153_bind_feature(self):
        # The only host in the personality is in a sandbox, so the bind should
        # succeed
        command = ["bind_feature", "--feature", "notemplate",
                   "--personality", "featuretest"]
        err = self.statustest(command)
        self.matchoutput(err, "Flushed 1/1 templates.", command)

    def test_154_manage_notemplate(self):
        command = ["manage", "--hostname", "aquilon68.aqd-unittest.ms.com",
                   "--domain", "unittest"]
        out = self.badrequesttest(command)
        self.matchoutput(out,
                         "Host Feature notemplate does not have templates "
                         "present in domain unittest for archetype aquilon.",
                         command)

    def test_155_manage_notemplate_force(self):
        # --force means you know what you're doing...
        self.successtest(["manage", "--hostname", "aquilon68.aqd-unittest.ms.com",
                          "--domain", "unittest", "--force", "--skip_auto_compile"])

    def test_159_cleanup_featuretest(self):
        self.successtest(["manage", "--hostname", "aquilon68.aqd-unittest.ms.com",
                          "--sandbox", "%s/utsandbox" % self.user, "--force"])
        self.statustest(["reconfigure", "--hostname", "aquilon68.aqd-unittest.ms.com",
                         "--personality", "inventory"])
        self.statustest(["unbind_feature", "--feature", "notemplate",
                         "--personality", "featuretest"])
        self.noouttest(["del_feature", "--feature", "notemplate", "--type", "host"])
        self.noouttest(["del_personality", "--personality", "featuretest",
                        "--archetype", "aquilon"])

    def test_160_add_othersandbox(self):
        # We can't run "aq get" in the name of otheruser, so we have to create
        # the sandbox manually
        kingdir = self.config.get("broker", "kingdir")
        self.gitcommand(["branch", "othersandbox", "unittest"], cwd=kingdir)
        dst_dir = os.path.join(self.sandboxdir, "othersandbox")
        self.gitcommand(["clone", kingdir, dst_dir, "--branch", "othersandbox"])

    def test_161_manage_host_fail(self):
        command = ["manage", "--hostname", "unittest02.one-nyp.ms.com",
                   "--sandbox", "otheruser/othersandbox", "--force"]
        out = self.badrequesttest(command)
        self.matchoutput(out, "Bad Request: Template directory '%s' does not exist." %
                         os.path.join(self.config.get("broker", "templatesdir"),
                                      "otheruser", "othersandbox"), command)

    def test_161_manage_host_success(self):
        self.successtest(["manage", "--hostname", "unittest02.one-nyp.ms.com",
                          "--sandbox", "otheruser/othersandbox", "--force", "--skip_auto_compile"])

    def test_162_del_otheruser(self):
        self.noouttest(["del_user", "--username", "otheruser"] + self.valid_just_sn)

    def test_163_verify_host(self):
        command = ["show_host", "--hostname", "unittest02.one-nyp.ms.com"]
        out = self.commandtest(command)
        self.matchoutput(out, "Sandbox: othersandbox [orphaned]", command)

    def test_164_try_compile(self):
        # Also testing compile to accept justification
        command = ["compile", "--hostname", "unittest02.one-nyp.ms.com"] + self.emergency_just_with_reason
        out = self.internalerrortest(command)
        self.matchoutput(out,
                         "No author information provided for sandbox "
                         "othersandbox. If the sandbox belonged to an user "
                         "that got deleted, then all hosts/clusters must be "
                         "moved to a sandbox owned by an existing user.",
                         command)

    def test_165_update_personality(self):
        # Any command is good that tries to re-write the host plenary without
        # compiling it
        command = ["rebind_client", "--service", "aqd", "--instance", "ny-prod",
                   "--hostname", "unittest02.one-nyp.ms.com"]
        out = self.statustest(command)
        self.matchoutput(out, "Warning: Host unittest02.one-nyp.ms.com "
                         "is missing sandbox author information.", command)

    def test_169_manage_back(self):
        self.successtest(["manage", "--hostname", "unittest02.one-nyp.ms.com",
                          "--sandbox", "%s/changetest1" % self.user, "--force",
                          "--skip_auto_compile"])

    def test_200_nomanage_host(self):
        command = ["manage", "--hostname", "unittest02.one-nyp.ms.com",
                   "--domain", "nomanage"]
        out = self.badrequesttest(command)
        self.matchoutput(out,
                         "Managing objects to domain nomanage is not allowed.",
                         command)

    def test_200_nomanage_cluster(self):
        command = ["manage", "--cluster", "utecl1", "--domain", "nomanage"]
        out = self.badrequesttest(command)
        self.matchoutput(out,
                         "Managing objects to domain nomanage is not allowed.",
                         command)

    def test_200_manage_cluster_member(self):
        command = ["manage", "--hostname", "evh1.aqd-unittest.ms.com",
                   "--sandbox", "%s/changetest1" % self.user]
        out = self.badrequesttest(command)
        self.matchoutput(out,
                         "Cluster nodes must be managed at the cluster level",
                         command)

    def test_200_manage_metacluster_member(self):
        # we are using --force to bypass checks because the source domain unittest
        # latest commit does not exist in template-king
        command = ["manage", "--cluster", "utecl1",
                   "--sandbox", "%s/utsandbox" % self.user, "--force"]
        out = self.badrequesttest(command)
        self.matchoutput(out,
                         "utecl1 is member of metacluster utmc1, it must be "
                         "managed at metacluster level.", command)

    def test_200_bad_cluster(self):
        command = ["manage", "--cluster", "cluster-does-not-exist",
                   "--sandbox", "%s/changetest1" % self.user]
        out = self.notfoundtest(command)
        self.matchoutput(out, "Cluster cluster-does-not-exist not found",
                         command)

if __name__ == '__main__':
    suite = unittest.TestLoader().loadTestsFromTestCase(TestManage)
    unittest.TextTestRunner(verbosity=2).run(suite)


text:
package com.wide.ice.auth.service;

import com.wide.ice.auth.domain.User;

/**
 * Created by OELABED on 13/11/2016.
 */
public interface UserService {

    void create(User user);
}


text:
namespace Acklann.Plaid.Category
{
    /// <summary>
    /// Represents a request for plaid's '/categories/get' endpoint. Send a request to the '/categories/get' endpoint to get detailed information on categories returned by Plaid. This endpoint does not require authentication.
    /// </summary>
    /// <seealso cref="Acklann.Plaid.SerializableContent" />
    public class GetCategoriesRequest : SerializableContent { }
}


text:
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>W29165_text</title>
        <link rel="stylesheet" type="text/css" href="style.css" />

                «

    <p class="styleSans7.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">n52 UU< mm: IPA—mn— Hmw JAN—~35

    <p class="styleSans6.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>"><2 m~>>~>>
.3
<2 <2 <2 <2 <2 0 <2 axvm owvhm
<2
ENE
<2

    <p class="styleSans5.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">vad 00mm om; v2 on mm 2: mdm mdm oom wand whim wonoom<

    <p class="styleSans5.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">Quid co; :4 3; cm 0." ©me WS 3 omonw vaA: $93 mwomom<

    <p class="styleSans5.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">QENA: omwm mm.ww m2 omé mm 0M? 05 om ova vamp: mfxm wmnomms

    <p class="styleSans5.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">nmfid omhv modm R mm NM Won 93: 9: god mmxd~ Momxmdgm nova:

    <p class="styleSans5.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">wad oxwm No.00 on ow mm 0.3 mda mm.m_ Vmw Roda m.omxm.w_xm mmmmm:

    <p class="styleSans8.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">DdOUm—m Hum

    <p class="styleSans6.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">BIT

    <p class="styleSans27.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">Entry

    <p class="styleSans3.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">NA

    <p class="styleSans6.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">Cmééo fl ch

    <p class="styleSans4.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">_X-_>E Ema

    <p class="styleSans6.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">Emma—>22

    <p class="styleSans4.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">v39;

    <p class="styleSans5.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">v39;

    <p class="styleSans2.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">BIT

    <p class="styleSans31.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">

    <p class="styleSans6.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">NA

    <p class="styleSans4.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">NOV

    <p class="styleSans4.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">NOV

    <p class="styleSans3.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">btsoum

    <p class="styleSans6.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">BHI

    <p class="styleSans2.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">BH]

    <p class="styleSans2.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">BIT

    <p class="styleSans23.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">SIZE

    <p class="styleSans4.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">N: 9

    <p class="styleSans5.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">3m m

    <p class="styleSans4.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">3m w

    <p class="styleSans5.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">$m w

    <p class="styleSans2.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">wk. m

    <p class="styleSans2.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">at. m.

    <p class="styleSans3.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">BIT

    <p class="styleSans18.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">

    <p class="styleSans1.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">

    <p class="styleSans1.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">

    <p class="styleSans4.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">

    <p class="styleSans1.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">

    <p class="styleSans2.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">

    <p class="styleSans1.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">12


text:
@interface UIView (ImageEffects)

-(UIImage *)blurredSnapshot;

@end