#!/usr/bin/env python

# Copyright (c) 2008-2025 the MRtrix3 contributors.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Covered Software is provided under this License on an "as is"
# basis, without warranty of any kind, either expressed, implied, or
# statutory, including, without limitation, warranties that the
# Covered Software is free of defects, merchantable, fit for a
# particular purpose or non-infringing.
# See the Mozilla Public License v. 2.0 for more details.
#
# For more details, see http://www.mrtrix.org/.

# Script that performs intensity normalisation of DWIs in various ways


def usage(cmdline): #pylint: disable=unused-variable
  from mrtrix3 import algorithm #pylint: disable=no-name-in-module, import-outside-toplevel
  cmdline.set_author('Robert E. Smith (robert.smith@florey.edu.au)')
  cmdline.set_synopsis('Perform various forms of intensity normalisation of DWIs')
  cmdline.add_description('This script provides access to different techniques for globally scaling the intensity of diffusion-weighted images. '
                          'The different algorithms have different purposes, and different requirements with respect to the data with which they must be provided & will produce as output. '
                          'Further information on the individual algorithms available can be accessed via their individual help pages; eg. "dwinormalise group -help".')

  # Import the command-line settings for all algorithms found in the relevant directory
  algorithm.usage(cmdline)



def execute(): #pylint: disable=unused-variable
  from mrtrix3 import algorithm, app #pylint: disable=no-name-in-module, import-outside-toplevel

  # Find out which algorithm the user has requested
  alg = algorithm.get_module(app.ARGS.algorithm)
  alg.check_output_paths()

  # From here, the script splits depending on what algorithm is being used
  alg.execute()





# Execute the script
import mrtrix3
mrtrix3.execute() #pylint: disable=no-member
