<?xml version="1.0" encoding="utf-8"?>
<executable>
  <category>Experimental.Filtering</category>
  <title>N4ITK MRI Bias correction</title>
  <index>3</index>
  <description>Performs MRI bias correction using N4 algorithm. This module is based on the ITK filters contributed in the following publication:  Tustison N, Gee J "N4ITK: Nick's N3 ITK Implementation For MRI Bias Field Correction", The Insight Journal 2009 January-June, http://hdl.handle.net/10380/3053</description>
  <version>9</version>
  <documentation-url>http://www.slicer.org/slicerWiki/index.php/Modules:N4ITKBiasFieldCorrection-Documentation-3.6</documentation-url>
  <license></license>
  <contributor>Nick Tustison (algorithm and ITK implementation), Andrey Fedorov (Slicer wrapping)</contributor>
<acknowledgements>The development of this module was partially supported by NIH grants R01 AA016748-01 and R01 CA111288, as well as by NA-MIC, NAC, NCIGT and the Slicer community.</acknowledgements>

  <parameters>
    <label>IO</label>
    <description>Input/output parameters</description>
    <image>
      <longflag>inputimage</longflag>
      <name>inputImageName</name>
      <label>Input Image</label>
      <channel>input</channel>
      <description>Input image with MRI field inhomegeneity</description>
    </image>
    
    <image>
      <longflag>maskimage</longflag>
      <name>maskImageName</name>
      <label>Mask Image</label>
      <channel>input</channel>
      <description>Mask of the structure of interest in the input image. Optional, but highly recommended.</description>
    </image>

    <image>
      <longflag>outputimage</longflag>
      <name>outputImageName</name>
      <label>Output Volume</label>
      <channel>output</channel>
      <description>Result of processing</description>
    </image>

    <image>
      <longflag>outputbiasfield</longflag>
      <name>outputBiasFieldName</name>
      <label>Output bias field image</label>
      <channel>output</channel>
      <description>Recovered bias field</description>
    </image>

  </parameters>

  <parameters>
  <label>N4 Parameters</label>
    <integer-vector>
      <name>numberOfIterations</name>
      <longflag>iterations</longflag>
      <label>Number of iterations</label>
      <description>Number of iterations at each level, separated by comma</description>
      <default>50,40,30</default>
    </integer-vector>

    <float>
      <name>convergenceThreshold</name>
      <longflag>convergencethreshold</longflag>
      <description></description>
      <label>Convergence threshold</label>
      <default>0.0001</default>
    </float>

    <float-vector>
      <name>initialMeshResolution</name>
      <longflag>meshresolution</longflag>
      <label>BSpline grid resolution</label>
      <description>Initial resolution of the bspline grid: resolution in each of the 3 dimensions separated by comma</description>
      <default>1,1,1</default>
    </float-vector>

    <float>
      <name>splineDistance</name>
      <longflag>splinedistance</longflag>
      <label>Spline distance</label>
      <description>Distance between spline points; valid only if mesh resolution is not specified</description>
      <default>0</default>
    </float>
 
    <integer>
      <name>shrinkFactor</name>
      <longflag>shrinkfactor</longflag>
      <label>Shrink factor</label>
      <description>Specifies upsampling scale for the input image. Should be defined as a non-zero number. 1 corresponds to no upsampling, and will result in the slowest execution.</description>
      <default>4</default>
    </integer>

  </parameters>

  <parameters advanced="true">
  <label>Advanced N4 Parameters</label>
  <description>Advanced parameters of the algorithm</description>

     <integer>
      <name>bsplineOrder</name>
      <longflag>bsplineorder</longflag>
      <label>BSpline order</label>
      <description>Order of the BSpline used for fitting</description>
      <default>3</default>
    </integer>
 
    <image>
      <longflag>weightimage</longflag>
      <name>weightImageName</name>
      <label>Weight Image</label>
      <channel>input</channel>
      <description>Weight Image</description>
    </image>

    <float>
      <name>alpha</name>
      <longflag>bsplinealpha</longflag>
      <description>Sigmoid normalized alpha</description>
      <label>BSpline alpha</label>
      <default>0</default>
    </float>
   
    <float>
      <name>beta</name>
      <longflag>bsplinebeta</longflag>
      <description>Sigmoid normalized beta</description>
      <label>BSpline beta</label>
      <default>0.5</default>
    </float>
    
    <float-vector>
      <name>histogramSharpening</name>
      <longflag>histogramsharpening</longflag>
      <label>Histogram sharpening</label>
      <default>0</default>
    </float-vector>

  </parameters>

</executable>
