You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: BackgroundRemovalMacroIOWrapper.m
    path of file: ./repos/sepia/wrapper
    
    the code of the file until where you have to start completion: %% [localField,maskFinal] = BackgroundRemovalMacroIOWrapper(input,output,maskFullName,algorParam)
%
% Input
% --------------
% input         : input directory contains NIfTI (*totalfield* and
%                 *fieldmapsd*) files or structure containing filenames
% output        : output directory that st
    
function [inputDir, inputNiftiList] = io_01_get_input_file_list(input,outputDir,prefix)

if isstruct(input)
    
    % Option 1: input are files
    inputNiftiList  = input;
    
    % take the phase data directory as reference input directory 
    [inputDir,~,~] = fileparts(inputNiftiList(1).name);
    
else
    
    % Option 2: input is a directory
    inputDir = input; 
    
    % First check with SEPIA default naming structure
    disp('Searching input directory based on SEPIA default naming structure...');
    filePattern = {'fieldmap','','noisesd','header'}; % don't change the order
    [isLoadSuccessful, inputNiftiList] = read_default_to_filelist(inputDir, filePattern);
    
    % If it doesn't work then check BIDS compatibility
    if ~isLoadSuccessful
        error('No file matches the SEPIA default naming structure. Please check the input directory again.')
    end