Home > data-import > supporting_functions > extract_img_name_list.m

extract_img_name_list

PURPOSE ^

This function will go through a list of file structures and extract image

SYNOPSIS ^

function [img_name_list seq] = extract_img_name_list(img_name_list, img_step, seq_pos_idx, min_img_seq, max_img_seq)

DESCRIPTION ^

 This function will go through a list of file structures and extract image
 sequence number and sort it with increasing order.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [img_name_list seq] = extract_img_name_list(img_name_list, img_step, seq_pos_idx, min_img_seq, max_img_seq)
0002 % This function will go through a list of file structures and extract image
0003 % sequence number and sort it with increasing order.
0004 
0005 if ~exist('img_step', 'var')
0006     img_step = 1;
0007 end
0008 
0009 if ~exist('seq_pos_idx', 'var')
0010     seq_pos_idx = -1;
0011 end
0012 
0013 n = length(img_name_list);
0014 
0015 % get file sequence No.
0016 seq = NaN(n, 1);
0017 
0018 for i=1:n
0019     fname = img_name_list(i).name;
0020     
0021     s = regexp(fname, '[_.]', 'split');
0022     seq(i) = str2double(s{end + seq_pos_idx});
0023 end
0024 
0025 [seq index] = sort(seq);
0026 img_name_list = img_name_list(index);
0027 
0028 if ~exist('max_img_seq', 'var')
0029     max_img_seq = max(seq);
0030 end
0031 
0032 if ~exist('min_img_seq', 'var')
0033     min_img_seq = min(seq);
0034 end
0035 
0036 index = ismember(seq, min_img_seq:img_step:max_img_seq);
0037 seq = seq(index);
0038 img_name_list = img_name_list(index);
0039 
0040 end

Generated on Wed 24-May-2017 00:00:56 by m2html © 2005