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: xASL_wrp_PreparePV.m
    path of file: ./repos/ExploreASL/Modules/SubModule_ASL
    
    the code of the file until where you have to start completion: function x = xASL_wrp_PreparePV(x, bStandardSpace)
%xASL_wrp_PreparePV Submodule of ExploreASL ASL Module, to prepare PV maps on ASL resolution
%
% FORMAT: xASL_wrp_PreparePV(x, bStandardSpace)
%
% INPUT:
%   x               - structure containing fields with all information required to run this submodule (REQUIRED)
%   bStandardSpace  - boolean to select the creation of PV maps in standard space (OPTIONAL, DEFAULT = false)
%
% OUTPUT:
%   x               - structure containing fields with all information required to run this submodule
% OUTPUT FILES: NIfTI containing PV maps on ASL resolution
%
% -----------------------------------------------------------------------------------------------------------------------------------------------------
% DESCRIPTION: This submodule prepares partial volume correction (PVC) by creating correct PV maps in ASL resolution, in native space,
%              as well as in standard space if requested (to perform PVC in
%              standard space):
%
% If bStandardSpace:
%
%   1. Create dummy upsampled ASL scan, for registration
%   2. Reslice pGM & pWM to hi-res ASL
%   3. Estimate effective spatial resolution of ASL
%   4. Smooth pGM & pWM to this spatial resolution
%   5. Move smoothed tissue posteriors to MNI space
%
% else: run step 3 only, which will use the effective spatial resolution
% that is default for the respective sequence:
% 2D EPI: [1 1 1] * VoxelSize
% 3D GRASE: [1.1 1.1 1.38] * VoxelSize
% 3D spiral: [4.3 4.4 10.1] * VoxelSize (assuming GE uses the upsampled 2x2x4 mm 
% & run steps 1&2, but in native space these entail presmoothing &

    
function x = xASL_wrp_PreparePV(x, bStandardSpace)
%xASL_wrp_PreparePV Submodule of ExploreASL ASL Module, to prepare PV maps on ASL resolution
%
% FORMAT: xASL_wrp_PreparePV(x, bStandardSpace)
%
% INPUT:
%   x               - structure containing fields with all information required to run this submodule (REQUIRED)
%   bStandardSpace  - boolean to select the creation of PV maps in standard space (OPTIONAL, DEFAULT = false)
%
% OUTPUT:
%   x               - structure containing fields with all information required to run this submodule
% OUTPUT FILES: NIfTI containing PV maps on ASL resolution
%
% -----------------------------------------------------------------------------------------------------------------------------------------------------
% DESCRIPTION: This submodule prepares partial volume correction (PVC) by creating correct PV maps in ASL resolution, in native space,
%              as well as in standard space if requested (to perform PVC in
%              standard space):
%
% If bStandardSpace:
%
%   1. Create dummy upsampled ASL scan, for registration
%   2. Reslice pGM & pWM to hi-res ASL
%   3. Estimate effective spatial resolution of ASL
%   4. Smooth pGM & pWM to this spatial resolution
%   5. Move smoothed tissue posteriors to MNI space
%
% else: run step 3 only, which will use the effective spatial resolution
% that is default for the respective sequence:
% 2D EPI: [1 1 1] * VoxelSize
% 3D GRASE: [1.1 1.1 1.38] * VoxelSize
% 3D spiral: [4.3 4.4 10.1] * VoxelSize (assuming GE uses the upsampled 2x2x4 mm 
% & run steps 1&2, but in native space these entail presmoothing &
% downsampling.
%
% EXAMPLE: xASL_wrp_PreparePV(x);
% __________________________________
% Copyright (C) 2015-2020 ExploreASL




%% ------------------------------------------------------------------------------------------
%% 0)   Admin
if nargin<2 || isempty(bStandardSpace)
	bStandardSpace = false;
end