\HeaderA{landmarkMatrix}{Compute and cluster high density regions in 1D}{landmarkMatrix}
\begin{Description}\relax
This functions first identifies high-density regions for each
\code{\LinkA{flowFrame}{flowFrame}} in a
\code{\LinkA{flowSet}{flowSet}} and subsequently tries
to cluster these regions, yielding the landmarks matrix that needs to
be supplied to \code{\LinkA{landmarkreg}{landmarkreg}}. The function is
considered to be internal.
\end{Description}
\begin{Usage}
\begin{verbatim}
landmarkMatrix(data, fres, parm, border=0.05, peakNr=NULL, densities = NULL, n = 201)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{data}] A \code{flowSet}. 
\item[\code{fres}] A list of
\code{\LinkA{filterResultList}{filterResultList}}
objects generated by a filtering opration using a
\code{\LinkA{curv1Filter}{curv1Filter}}. Each list
item represents the results for one of the flow parameters in
\code{parm}.
\item[\code{parm}] Character scalar of flow paramater to compute landmarks
for. 
\item[\code{border}] A numeric in \code{[0,1]}. Ignore all high-density
regions with mean values in the extreme percentiles of the data
range. 
\item[\code{peakNr}] Force a fixed number of peaks. 
\item[\code{densities}] An optional matrix of y values of the density
estimates for the \code{flowSet}. If this is not present, density
estimates will be calculated by the function. 
\item[\code{n}] Number of bins used for the density estimation. 
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
In order to normalize the data using the \code{landmarkreg} function
in the \code{\LinkA{fda}{fda}}, a set of landmarks has to
be computed for each \code{flowFrame} in a \code{flowSet}. The number
of lansmarks has to be the same for each frame. This function
identifies high-density regions in each frame, computes a simple
clustering and returns a matrix of landmark locations. Missing
landmarks of individual frames are substituted by the mean landmark
location of the respective cluster.
\end{Details}
\begin{Value}
A matrix of landmark locations. Columns are landmarks and rows are
\code{flowFrames}.
\end{Value}
\begin{Author}\relax
Florian Hahne
\end{Author}
\begin{SeeAlso}\relax
\code{\LinkA{landmarkreg}{landmarkreg}},\code{\LinkA{warpSet}{warpSet}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}

data(GvHD)
tmp <- list("FSC-H"=filter(GvHD[1:3], curv1Filter("FSC-H")))
res <-  flowStats:::landmarkMatrix(GvHD[1:3], tmp, "FSC-H")

\end{ExampleCode}
\end{Examples}

