\section{Command Line Tools}

All programs in MIA are available as command line tools. 

\subsection{Converting raw data to images and volumes}

MIA doen't support the processing of raw data files. 
Instead it provides the tools to convert such data to certain file formats that carry size and data type information. 
Two command are provided: \texttt{mia-raw2image} for conversion of 2D data and \texttt{mia-raw2volume} for conversion of 3D data. 
Some storage formats also may provide information about pixel/voxel size. 

To convert a raw 2D array of size 120x130 of double floating point values (64 bit) , stored as big endian, and 
  with a pixel size of $2.0 x 2.0$ units to a PNG image, the following command may be issued: 
\lstset{language=bash}
\begin{lstlisting}
mia-raw2image -i input.raw --big-endian -o output.png -r double \
	-s <120,130> -f <2.0,2.0> 
\end{lstlisting}

\noindent 
In order to convert a raw 256x256x128 3D data array of unsingned short values (16 bit), given as low endian, with a voxel size of $1.0 x 1.0 x 2.0$ 
  to the VISTA file format issue the following command: 
\begin{lstlisting}
mia-raw2volume -i input.raw  -o output.v -r ushort \
	-s <256,256,128> -f <1.0,1.0,2.0>
\end{lstlisting}

\noindent 
The number of supported image file formats depends on the compiled in support - see chapter \ref{ch:prog} for details. 

\subsection{Filtering images}

MIA provides a set of standard 2D and 3D filters. 
These filters can easily combined  to a filter chain. 
For example in order to filter a 2D image \texttt{image.png} first with a Gaussian 
  of the order 3 (filter width = 2 * 3 + 1), and then with a 
  median least square filter of the order 2, issue the command 
\begin{lstlisting}
mia-2dimagefilter -i image.png -o filtered.png gauss:w=3 mlv:w=2
\end{lstlisting}

Morphological operations, line erosion, dilation, open, and close are currently only supported for 3D images. 
To apply an openin operation to a volume data set \texttt{volume.v}, by using a filled sphere of radius 3 as structuring element, 
  call: 
\begin{lstlisting}
mia-2dimagefilter -i volume.v -o morphed.v open:shape=[sphere:r=3]
\end{lstlisting}

\subsection{Non-linear image registration and deformation}

MIA implements fluid dynamic and linear elastic registration by minimising a voxel based measure. 
As a result a vector field is evaluated that describes a probable course of change the given input images and the appllied registration model. 

For a non-linear fluid dynamics based registration of the floating image \texttt{source.v} to the reference image \texttt{reference.v}, by using the 
 adaptive solver algorithm \cite{wollny02comput} with a maximum of 40 iterations and a multi-grid start size of 16x16x16, call 

\begin{lstlisting}
mia-3dnrreg -i source.v -r reference.v -m naviera:iter=40 -m 16 -o field.v 
\end{lstlisting}

\noindent 
In order to apply the deformation to an input image, using the omoms3 interpolation filter, do 
\begin{lstlisting}
mia-3ddeform -i source.v -t field.v -o deformed.v -p omoms3
\end{lstlisting}





