static GwyContainer* apefile_get_metadata(APEFile *apefile) { GwyContainer *meta; gchar *p; meta = gwy_container_new(); HASH_STORE("Version", "%u", version); HASH_STORE("Tip oscilation frequency", "%g Hz", freq_osc_tip); HASH_STORE("Acquire delay", "%.6f s", acquire_delay); HASH_STORE("Raster delay", "%.6f s", raster_delay); HASH_STORE("Tip distance", "%g nm", tip_dist); if (apefile->remark && *apefile->remark && (p = g_convert(apefile->remark, strlen(apefile->remark), "UTF-8", "ISO-8859-1", NULL, NULL, NULL))) gwy_container_set_string_by_name(meta, "Comment", p); gwy_container_set_string_by_name (meta, "SPM mode", g_strdup(gwy_enum_to_string(apefile->spm_mode, spm_modes, G_N_ELEMENTS(spm_modes)))); p = format_vt_date(apefile->scan_date); if (p) gwy_container_set_string_by_name(meta, "Date", p); return meta; }
static void store_metadata(SurfFile *surffile, GwyContainer *container) { char date[20]; g_snprintf(date, sizeof(date), "%d. %d. %d", surffile->day, surffile->month, surffile->year); HASH_STORE("Version", "%u", version); HASH_STORE("Operator name", "%s", operator_name); HASH_STORE("Object name", "%s", object_name); gwy_container_set_string_by_name(container, "/meta/Date", g_strdup(date)); gwy_container_set_string_by_name (container, "/meta/Acquisition type", g_strdup(gwy_enum_to_string(surffile->acquisition, acq_modes, G_N_ELEMENTS(acq_modes)))); }
static GwyContainer* surffile_get_metadata(SurfFile *surffile) { GwyContainer *meta; char date[40]; meta = gwy_container_new(); g_snprintf(date, sizeof(date), "%d. %d. %d", surffile->day, surffile->month, surffile->year); HASH_STORE("Version", "%u", version); HASH_STORE("Operator name", "%s", operator_name); HASH_STORE("Object name", "%s", object_name); gwy_container_set_string_by_name(meta, "Date", g_strdup(date)); gwy_container_set_string_by_name (meta, "Acquisition type", g_strdup(gwy_enum_to_string(surffile->acquisition, acq_modes, G_N_ELEMENTS(acq_modes)))); return meta; }
/* Quite incomplete... */ static GwyContainer* mprofile_get_metadata(MProFile *mprofile) { static const GwyEnum yesno[] = { { "No", 0, }, { "Yes", 1, } }; static const GwyEnum software_types[] = { { "MetroPro", 1, }, { "MetroBasic", 2, }, { "dbug", 3, }, }; static const GwyEnum discont_actions[] = { { "Delete", 0, }, { "Filter", 1, }, { "Ignore", 2, }, }; static const GwyEnum system_types[] = { { "softwate generated data", 0, }, { "Mark IVxp", 1, }, { "Maxim 3D", 2, }, { "Maxim NT", 3, }, { "GPI-XP", 4, }, { "NewView", 5, }, { "Maxim GP", 6, }, { "NewView/GP", 7, }, { "Mark to GPI conversion", 8, }, }; GwyContainer *meta; time_t tp; struct tm *tm; const gchar *s; gchar buffer[24]; gchar *p; meta = gwy_container_new(); /* Version */ p = g_strdup_printf("%d.%d.%d", mprofile->version_major, mprofile->version_minor, mprofile->version_micro); gwy_container_set_string_by_name(meta, "Version", p); /* Timestamp */ tp = mprofile->timestamp; tm = localtime(&tp); strftime(buffer, sizeof(buffer), "%Y-%m-%d %H:%M:%S", tm); gwy_container_set_string_by_name(meta, "Date", g_strdup(buffer)); /* Comments */ store_meta_string(meta, "Software date", mprofile->software_date); store_meta_string(meta, "Comment", mprofile->comment); store_meta_string(meta, "Objective name", mprofile->objective_name); store_meta_string(meta, "Part measured", mprofile->part_num); store_meta_string(meta, "Part serial number", mprofile->part_ser_num); store_meta_string(meta, "Description", mprofile->scan_description); store_meta_string(meta, "System error file", mprofile->sys_err_file); store_meta_string(meta, "Zoom description", mprofile->zoom_desc); store_meta_string(meta, "Wavelength select", mprofile->wavelength_select); /* Misc */ HASH_STORE_ENUM("Software type", software_type, software_types); HASH_STORE("Wavelength", "%g m", wavelength_in); HASH_STORE("Intensity averages", "%d", intens_avgs); HASH_STORE("Minimum modulation points", "%d", min_mod_pts); HASH_STORE_ENUM("Automatic gain control", agc, yesno); HASH_STORE_ENUM("Discontinuity action", discont_action, discont_actions); HASH_STORE("Discontinuity filter", "%g %%", discont_filter); HASH_STORE_ENUM("System type", system_type, system_types); HASH_STORE("System board", "%d", system_board); HASH_STORE("System serial", "%d", system_serial); HASH_STORE("Instrument id", "%d", instrument_id); HASH_STORE_ENUM("System error subtracted", subtract_sys_err, yesno); HASH_STORE("Refractive index", "%g", refactive_index); HASH_STORE_ENUM("Removed tilt bias", remove_tilt_bias, yesno); HASH_STORE_ENUM("Removed fringes", remove_fringes, yesno); HASH_STORE_ENUM("Wavelength folding", wavelength_fold, yesno); p = g_strdup_printf("%.2g", mprofile->min_mod/10.23); gwy_container_set_string_by_name(meta, "Minimum modulation", p); return meta; }
static GwyContainer* apefile_get_metadata(APEFile *apefile) { GwyContainer *meta; gchar *p; meta = gwy_container_new(); gwy_container_set_string_by_name(meta, "Version", g_strdup_printf("%u.%u", apefile->version, apefile->subversion)); /* * In SPM_MODE_SNOM or SPM_MODE_AFM_NONCONTACT freq_osc_tip holds the tip * oscillation frequency. * If spm_mode=SPM_MODE_AFM_CONTACT then the freq_osc_tip field holds the * force the tip applies to the sample in nN. * If spm_mode=SPM_MODE_STM then freq_osc_tip holds the bias voltage in * Volts. */ switch (apefile->spm_mode) { case SPM_MODE_SNOM: case SPM_MODE_AFM_NONCONTACT: HASH_STORE("Tip oscillation frequency", "%g Hz", freq_osc_tip); break; case SPM_MODE_AFM_CONTACT: HASH_STORE("Force", "%g nN", freq_osc_tip); break; case SPM_MODE_STM: HASH_STORE("Bias", "%g V", freq_osc_tip); break; default: HASH_STORE("Tip oscillation frequency", "%g Hz", freq_osc_tip); break; } /* We will fetch the HV Amplifier status only if file version>= 2.4*/ if (apefile->version > 1 && apefile->subversion >= 4) { gwy_container_set_string_by_name (meta, "XY HV Status", g_strdup(gwy_enum_to_string(apefile->xy_hv_status, hva_statuses, G_N_ELEMENTS(hva_statuses)))); gwy_container_set_string_by_name (meta, "Z HV Status", g_strdup(gwy_enum_to_string(apefile->z_hv_status, hva_statuses, G_N_ELEMENTS(hva_statuses)))); } HASH_STORE("Acquire delay", "%.6f s", acquire_delay); HASH_STORE("Raster delay", "%.6f s", raster_delay); HASH_STORE("Tip distance", "%g nm", tip_dist); if (apefile->remark && *apefile->remark && (p = g_convert(apefile->remark, strlen(apefile->remark), "UTF-8", "ISO-8859-1", NULL, NULL, NULL))) gwy_container_set_string_by_name(meta, "Comment", p); gwy_container_set_string_by_name (meta, "SPM mode", g_strdup(gwy_enum_to_string(apefile->spm_mode, spm_modes, G_N_ELEMENTS(spm_modes)))); p = format_vt_date(apefile->scan_date); if (p) gwy_container_set_string_by_name(meta, "Date", p); return meta; }