<?xml version="1.0" encoding="utf-8" ?>
<executable>
  <category>Registration</category>
  <title>BRAINSDemonWarp</title>

  <description>
    This program finds a deformation field to warp a moving image onto a fixed image.  The images must be of the same signal kind, and contain an image of the same kind of object.  This program uses the Thirion Demons warp software in ITK, the Insight Toolkit.
  </description>
  <version>0.1.0.$Revision: 1.4 $(alpha)</version>
  <documentation-url></documentation-url>
  <license>https://www.nitrc.org/svn/brains/BuildScripts/trunk/License.txt </license>
  <contributor>This tool was developed by Hans Johnson and Greg Harris.</contributor>

  <parameters>
    <label>Input Image Files</label>
    <description>Parameters for specifying the Thirion registration image set</description>

    <image>
      <name>movingVolume</name>
      <flag>m</flag>
      <longflag alias="moving_image">movingVolume</longflag>
      <description>Required: input moving image</description>
      <label>Moving Image Volume</label>
      <channel>input</channel>
    </image>

    <image>
      <name>fixedVolume</name>
      <flag>f</flag>
      <longflag alias="fixed_image">fixedVolume</longflag>
      <description>Required: input fixed target image</description>
      <label>Fixed Image Volume</label>
      <channel>input</channel>
    </image>
  </parameters>

  <parameters>
    <label>Output Files</label>
    <description>Output file in which to store tract lines</description>
    <image>
      <name>outputVolume</name>
      <flag>o</flag>
      <longflag alias="output_image">outputVolume</longflag>
      <description>Required: output resampled moving image.</description>
      <label>Output Image Volume</label>
      <channel>output</channel>
    </image>

    <image>
      <name>outputDeformationFieldVolume</name>
      <flag>O</flag>
      <longflag alias="output_field">outputDeformationFieldVolume</longflag>
      <description>Required: output deformation field vector image.</description>
      <label>Output Deformation Field Volume</label>
      <channel>output</channel>
    </image>
  </parameters>

  <parameters>
    <label>Thirion Registration Parameters</label>
    <description>Input parameters controlling the Thirion Registation</description>
    <string-enumeration>
      <name>registrationFilterType</name>
      <longflag>registrationFilterType</longflag>
      <description>Registration Filter Type: Demons|FastSymmetricForces|Diffeomorphic|LogDemons|SymmetricLogDemons</description>
      <label>Registration Filter Type</label>
      <default>Demons</default>
      <element>FastSymmetricForces</element>
      <element>Diffeomorphic</element>
      <element>LogDemons</element>
      <element>SymmetricLogDemons</element>:
    </string-enumeration>
    <double>
      <name>smoothDeformationFieldSigma</name>
      <flag>s</flag>
      <longflag alias="def_field_sigma">smoothDeformationFieldSigma</longflag>
      <label>Deformation field smoothing sigma</label>
      <description>A gaussian smoothing value to be applied to the deformation feild/</description>
      <default>1.0</default>
    </double>


    <string-enumeration>
      <name>inputPixelType</name>
      <longflag>inputPixelType</longflag>
      <description>Input Volumes Pixel Type: float|uchar|short|ushort|int</description>
      <label>Type Code for Input Volumes Pixel Type</label>
      <default>float</default>
      <element>float</element>
      <element>uchar</element>
      <element>short</element>
      <element>ushort</element>
      <element>int</element>
      <channel>input</channel>
    </string-enumeration>

    <string-enumeration>
      <name>outputPixelType</name>
      <longflag>outputPixelType</longflag>
      <description>Output Volume Pixel Type: float|uchar|short|ushort|int</description>
      <label>Type Code for Output Volume Pixel Type</label>
      <default>CopyInputPixelType</default>
      <element>CopyInputPixelType</element>
      <element>float</element>
      <element>uchar</element>
      <element>short</element>
      <element>ushort</element>
      <element>int</element>
      <channel>input</channel>
    </string-enumeration>

    <string>
      <name>outputDisplacementFieldPrefix</name>
      <longflag>outputDisplacementFieldPrefix</longflag>
      <description>Displacement Field filename prefix for x y and z component images</description>
      <label>Displacement Field Prefix</label>
      <channel>input</channel>
      <default>none</default>
    </string>

    <image>
      <name>outputCheckerboardVolume</name>
      <longflag>outputCheckerboardVolume</longflag>
      <description>Checkerboard image volume</description>
      <label>Output Checkerboard Volume</label>
      <channel>output</channel>
    </image>

    <integer-vector>
      <name>checkerboardPatternSubdivisions</name>
      <longflag>checkerboardPatternSubdivisions</longflag>
      <description>Number of Checkerboard subdivisions in all 3 directions</description>
      <label>Checkerboard Pattern Subdivisions</label>
      <default>4,4,4</default>
      <channel>input</channel>
    </integer-vector>

    <boolean>
      <name>forceCoronalZeroOrigin</name>
      <longflag>forceCoronalZeroOrigin</longflag>
      <description>Flag to indicate that all images being read in must have their spatial centers matched.</description>
      <label>Center Volumes</label>
      <default>0</default>
      <channel>input</channel>
    </boolean>

    <boolean>
      <name>outputNormalized</name>
      <longflag>outputNormalized</longflag>
      <description>Flag to warp and write the normalized images to output.  In normalized images the image values are fit-scaled to be between 0 and 1</description>
      <label>Warp Normalized Images</label>
      <default>1</default>
      <channel>input</channel>
    </boolean>

    <boolean>
      <name>outputDebug</name>
      <flag>v</flag>
      <longflag>outputDebug</longflag>
      <description>Flag to write the images after each step</description>
      <label>Write Intermediate Images</label>
      <default>0</default>
      <channel>input</channel>
    </boolean>

    <string-enumeration>
      <name>maskProcessingMode</name>
      <longflag>maskProcessingMode</longflag>
      <description>What mode to use for using the masks: NOMASK|ROIAUTO|ROI|BOBF.  If ROIAUTO is choosen, then the mask is implicitly defined using a otsu forground and hole filling algorithm. Where the Region Of Interest mode uses the masks to define what parts of the image should be used for computing the deformation field.  Brain Only Background Fill uses the masks to pre-process the input images by clipping and filling in the background with a predefined value.</description>
      <label>Mask Processing Mode</label>
      <default>NOMASK</default>
      <element>NOMASK</element>
      <element>ROIAUTO</element>
      <element>ROI</element>
      <element>BOBF</element>:
    </string-enumeration>

    <file>
      <name>fixedBinaryVolume</name>
      <longflag>fixedBinaryVolume</longflag>
      <description>Mask filename for desired region of interest in the Fixed image.</description>
      <label>Input Fixed Mask Filename</label>
      <channel>input</channel>
    </file>

    <file>
      <name>movingBinaryVolume</name>
      <longflag>movingBinaryVolume</longflag>
      <description>Mask filename for desired region of interest in the Moving image.</description>
      <label>Input Moving Mask Filename</label>
      <channel>input</channel>
    </file>

    <integer>
      <name>lowerThresholdForBOBF</name>
      <longflag>lowerThresholdForBOBF</longflag>
      <description>Lower threshold for performing BOBF</description>
      <label>BOBF Lower Threshold</label>
      <default>0</default>
      <channel>input</channel>
    </integer>

    <integer>
      <name>upperThresholdForBOBF</name>
      <longflag>upperThresholdForBOBF</longflag>
      <description>Upper threshold for performing BOBF</description>
      <label>BOBF Upper Threshold</label>
      <default>70</default>
      <channel>input</channel>
    </integer>

    <integer>
      <name>backgroundFillValue</name>
      <longflag>backgroundFillValue</longflag>
      <description>Replacement value to overwrite background when performing BOBF</description>
      <label>BOBF Background Replacement Value</label>
      <default>0</default>
      <channel>input</channel>
    </integer>

    <integer-vector>
      <name>seedForBOBF</name>
      <longflag>seedForBOBF</longflag>
      <description>coordinates in all 3 directions for Seed when performing BOBF</description>
      <label>Seed For BOBF</label>
      <default>0,0,0</default>
      <channel>input</channel>
    </integer-vector>

    <integer-vector>
      <name>neighborhoodForBOBF</name>
      <longflag>neighborhoodForBOBF</longflag>
      <description>neighborhood in all 3 directions to be included when performing BOBF</description>
      <label>Seed For BOBF</label>
      <default>1,1,1</default>
      <channel>input</channel>
    </integer-vector>

    <integer-vector>
      <name>medianFilterSize</name>
      <longflag>medianFilterSize</longflag>
      <description>Median filter radius in all 3 directions</description>
      <label>Median Filter Size</label>
      <default>0,0,0</default>
      <channel>input</channel>
    </integer-vector>

    <file>
      <name>movingLandmarks</name>
      <longflag>movingLandmarks</longflag>
      <description>Landmarks filename for moving image to initialize deformation field</description>
      <label>Moving Landmarks Filename</label>
      <channel>input</channel>
    </file>

    <file>
      <name>fixedLandmarks</name>
      <longflag>fixedLandmarks</longflag>
      <description>Landmarks filename for fixed (target) image to initialize deformation field</description>
      <label>Fixed Landmarks Filename</label>
      <channel>input</channel>
    </file>

    <image>
      <name>initializeWithDeformationField</name>
      <longflag>initializeWithDeformationField</longflag>
      <description>Initial deformation field vector image file name</description>
      <label>Initial Deformation Field Volume</label>
      <channel>input</channel>
    </image>


    <file>
      <name>initializeWithFourier</name>
      <longflag>initializeWithFourier</longflag>
      <description>Initial Coefficient filename.</description>
      <label>Initial Coefficient Filename</label>
      <channel>input</channel>
    </file>

    <file>
      <name>initializeWithTransform</name>
      <longflag>initializeWithTransform</longflag>
      <description>Initial Transform filename</description>
      <label>Initial Transform  Filename</label>
      <channel>input</channel>
    </file>
    <integer>
      <name>numberOfHistogramBins</name>
      <longflag>numberOfHistogramBins</longflag>
      <description>the number of histogram levels</description>
      <label>Number of Histogram Bins</label>
      <default>256</default>
    </integer>
    <integer>
      <name>numberOfMatchPoints</name>
      <longflag>numberOfMatchPoints</longflag>
      <description>the number of match points</description>
      <label>Number of Match Points</label>
      <default>2</default>
    </integer>
    <integer>
      <name>numberOfPyramidLevels</name>
      <flag>n</flag>
      <longflag alias="num_levels">numberOfPyramidLevels</longflag>
      <description>the number of pyramid levels</description>
      <label>Number of Pyramid Levels</label>
      <default>5</default>
    </integer>
    <integer-vector>
      <name>arrayOfPyramidLevelIterations</name>
      <flag>i</flag>
      <longflag alias="number_iterations">arrayOfPyramidLevelIterations</longflag>
      <description>the iterations for each pyramid level</description>
      <label>the iteration count for each pyramid level</label>
      <default>300,50,30,20,15</default>
    </integer-vector>
    <integer-vector>
      <name>minimumFixedPyramid</name>
      <longflag>minimumFixedPyramid</longflag>
      <description>the Shrink factor for the first level of the fixed image pyramid</description>
      <label>Moving Shrink Factors</label>
      <default>16,16,16</default>
    </integer-vector>
    <integer-vector>
      <name>minimumMovingPyramid</name>
      <longflag>minimumMovingPyramid</longflag>
      <description>the Shrink factor for the first level of the moving image pyramid</description>
      <label>Moving Shrink Factors</label>
      <default>16,16,16</default>
    </integer-vector>
    <integer-enumeration>
       <name>gradientType</name>
       <flag>t</flag>
       <longflag>gradient_type</longflag>
       <description>Type of gradient used for computing the demons force (0 is symmetrized, 1 is fixed image, 2 is moving image)</description>
       <default>0</default>
       <label>Gradient Type</label>
       <element>0</element>
       <element>1</element>
       <element>2</element>
     </integer-enumeration>
     <double>
       <name>smoothingUp</name>
       <flag>g</flag>
       <longflag>up_field_sigma</longflag>
       <description>Smoothing sigma for the update field at each iteration</description>
       <label>Update field smoothing</label>
       <default>0.0</default>
    </double>
    <double>
       <name>maxStepLength</name>
       <flag>l</flag>
       <longflag>max_step_length</longflag>
       <description>Maximum length of an update vector (0: no restriction)</description>
       <label>Max Step Length</label>
       <default>2.0</default>
       </double>
    <boolean>
       <name>histogramMatch</name>
       <flag>e</flag>
       <longflag alias="use_histogram_matching">--histogramMatch</longflag>
       <description>Histogram Match the input images.  This is suitable for images of the same modality that may have different absolute scales, but the same overall intensity profile.</description>
       <label>Histogram Match</label>
       <default>false</default>
    </boolean>
    <boolean>
       <name>turnOffDiffeomorph</name>
       <flag>a</flag>
       <longflag>use_vanilla_dem</longflag>
       <description>Run vanilla demons algorithm</description>
       <label>Turn off Diffeomorphism</label>
       <default>false</default>
    </boolean>
    <boolean>
      <name>UseDebugImageViewer</name>
      <flag>G</flag>
      <longflag>--gui</longflag>
      <description>Display intermediate image volumes for debugging</description>
      <default>false</default>
    </boolean>
    <boolean>
      <name>PromptAfterImageSend</name>
      <flag>p</flag>
      <longflag>--promptUser</longflag>
      <description>Prompt the user to hit enter each time an image is sent to the DebugImageViewer</description>
      <default>false</default>
    </boolean>
    <integer>
      <name>numberOfBCHApproximationTerms</name>
      <longflag>numberOfBCHApproximationTerms</longflag>
      <description>Number of terms in the BCH expansion</description>
      <default>2</default>
    </integer>
  </parameters>
</executable>
