Description: |
// DigitalMicrograph Script 'BatchConvert__FloatDM4_to_16bit_DM4_and_8bit_TIF_withScaleBar.s'
// Batch Convert Float DM4 files to 16-bit DM4 and 8-bit Tif Format with generation of a header files in .hdr (plain text)
// and Gatan *.gtg (binary) format files. The resuls will be stored at '[original data directory]/output' directory.
//
// Logic:
// - when max image intensity is above 65535, the image is scaled as minPoint->0 maxPoint->65535,
// where the max and min points are calculated using provided in the dialog methods
// - when max image intensity is below 65536, the image is directly converted to 16-bit without rescaling
// - in all cases the 8-bit TIF files are scaled based on contrast values embedded into original DM4 file
//
// Note 1: the embedded scale bar will be kept in the resulting images
// Note 2: to enusure that none of the intensities clipped away the Min/Max method is recommended
// Note 3: Last directory for input is stored as a global tag BatchConvert:LastInPath,
// Last directory for output is stored as a global tag BatchConvert:LastOutPath,
// Last used method is stored as a global tag BatchConvert:ScalingType |