Custom Image File Naming

Custom Image File Naming

For increased flexibility, data traceability, debugging, and efficient post-processing in industrial environments, use JavaScript to override the default image-saving settings configured in Aurora Focus.
Fields such as trigger ID, trigger time, image index, image time, acquisition image size, barcode count, and job name are available within the JavaScript environment for integration into custom filenames. This enables contextual naming based on the specific acquisition and processing events.
The following code snippet demonstrates how to leverage custom image file naming.
/** @param {IMainArguments}input_result - object with results of the job. @returns {IMainResult}- object defining outputs per interface. @param {IOnJobResultsIntermediateFunctionArguments}arg - object with results of the job. @returns {IOnJobResultsIntermediateFunctionResult} object defining outputs per interface. */ let x = 0; export function onResults(input_result) { console.log('Received onResults: '); x++; const trigger_time = input_result.job_info.metrics.trigger_time; const img_time = input_result.job_info.acquisition_images[0].acquisition_time; return { //common :"test1" ftp: { common_file_name: `Result_Image${x.toString().padStart(5, '0')}`, img_file_name: [`Result_Image_trigger_time:${trigger_time.toString().padStart(5, '0')}_img_time:${img_time}`], } } } export function onJobResultIntermediate(input_result) { x++; const acquisition_images_size = input_result.job_info.acquisition_images.length; const img_index = input_result.job_info.acquisition_images[0].index; const img_time = input_result.job_info.acquisition_images[0].acquisition_time; const trigger_id = input_result.job_info.metrics.trigger_id; const trigger_time = input_result.job_info.metrics.trigger_time; const barcodeCount = input_result.job_info.acquisition_images[0].num_of_barcode; const job_name = input_result.job_info.name; console.log('Received onJobResultIntermediate: ', input_result); return { ftp: { common_file_name: `Intermediate_filename${x.toString().padStart(5, '0')}`, img_file_name: [`Intermediate_image_filename_9999_trigger_id:${trigger_id.toString().padStart(5, '0')}_trigger_time:${trigger_time}_img_index:${img_index}_img_time:${img_time}_acquisition_images_size:${acquisition_images_size}_barcodeCount:${barcodeCount}_job_name:${job_name}`], } }; }