%
% Copyright LANL
% Copyright Kitware
%
% This is documentation for the cinema file specification 
%

\documentclass{article}

\usepackage[export]{adjustbox}
\usepackage{authblk}
\usepackage[small,bf]{caption}
\usepackage{cite}
\usepackage{enumitem}
\setlist[description]{leftmargin=\parindent,labelindent=\parindent}
\usepackage{fancyhdr}
\usepackage{graphicx}
\usepackage[margin=1in]{geometry}
\usepackage{pdfpages}
\usepackage{tcolorbox}
\usepackage{times}
\usepackage{verbatim}
\usepackage{wallpaper}
\usepackage{xspace}


\begin{comment}
This is where we will put the copyright code
\end{comment}

\newcommand{\LAUR} {LA-UR-15-20572\xspace}
\newcommand{\insitu} {\textit{in situ}\xspace}
\newcommand{\CinemaSpecVersion} {v1.0}
\newcommand{\Composite} {\textit{Composite}\xspace}
\newcommand{\Simple} {\textit{Simple}\xspace}
\newcommand{\chaplin} {\textit{Chaplin}\xspace}
\newcommand{\Current} {\chaplin}

\pagestyle{fancy}
\fancyhf{}
\renewcommand{\headrulewidth}{0pt}
\chead{\LAUR}
\cfoot{\thepage}

\begin{document}

\title{Cinema \Current Database Specification}
\date{July 1, 2015 \\ \CinemaSpecVersion}
\author[**]{David DeMarle}
\author[*]{David H. Rogers}
\author[*]{John Patchett}
\author[**]{Berk Geveci}
\affil[*]{Los Alamos National Laboratory}
\affil[**]{Kitware, Inc.}

\renewcommand\Authands{ and }


%---------------------------------------------------------------------
% Title page 
%---------------------------------------------------------------------
\ThisCenterWallPaper{1.0}{img/script_cover.png}
\thispagestyle{empty}

\begin{ttfamily}
\begin{center}
\ \ \\
\vspace{3.5 in}
Cinema Database Specification \\
\bigskip
\bigskip
\Current Release \\
\bigskip
\LAUR\\
\bigskip
\bigskip
\bigskip
\bigskip
by \\
\bigskip
David DeMarle (Kitware, Inc)\\
David Rogers (LANL)\\
John Patchett (LANL)\\
Berk Gevevi (Kitware)\\
\end{center}
\vspace{1.0 in}
\begin{flushright}
Los Alamos National Laboratory\\
Bikini Atoll Rd., SM 30\\
Los Alamos, NM 87545\\
cinema@lanl.gov\\
\end{flushright}
\end{ttfamily}
\newpage

\pagenumbering{arabic}

%---------------------------------------------------------------------
% Begin Content
%---------------------------------------------------------------------

\section{Overview}
Extreme scale scientific simulations are leading a charge to exascale computation, and data analytics runs the risk of being a bottleneck to scientific discovery. Due to power and I/O constraints, we expect in situ visualization and analysis will be a critical component of these workflows. Options for extreme scale data analysis are often presented as a stark contrast: write large files to disk for interactive, exploratory analysis, or perform in situ analysis to save detailed data about phenomena that a scientists knows about in advance. We present a novel framework for a third option – a highly interactive, image-based approach that promotes exploration of simulation results, and is easily accessed through extensions to widely used open source tools. This in situ approach supports interactive exploration of a wide range of results, while still significantly reducing data movement and storage.

More information about the overall design of Cinema is available in the paper, \textit{An Image-based Approach to Extreme Scale In Situ Visualization and Analysis}\cite{cinemaSC14}.

A Cinema database is a collection of data that supports this image-based approach to interactive data exploration. It is a set of images and associated metadata, and is defined and an example given in the following sections.

\subsection{Public Comment}
We invite public comment on this specification. Please send comments to \texttt{\small cinema-dev@lanl.gov}. 

\subsection{Use Cases}
A Cinema Database supports the following three use cases:
\begin{enumerate}
\item Searching/querying of meta-data and samples. Samples can be searched purely on metadata, on image content, on position, on time, or on a combination of all of these.
\item Interactive visualization of sets of samples.
\item Playing interactive visualizations, allowing the user on/off control of elements in the visualization.
\end{enumerate}


\subsection{Cinema is Implementation Agnostic}
The Cinema Database is implementation agnostic. This database specification separates the metadata description of a set of images from the implementation of how these images are stored. In particular, if the images for a specific instance of a database are stored on disk, the design of the directory structure, metadata files, and image filenames on disk is entirely up to the person writing the data. Instead, this specification expects a database of URIs that maps metadata to data products required by the specification.

\section{The Cinema \Current Specification}
A cinema database is a set of precomputed visualization samples that can be queried and interactively viewed. This document describes release \CinemaSpecVersion of the Cinema \Current Database, in which image constituents are stored instead of pre-rendered images. The constituent images are inputs to a deferred rendering algorithm which allows the user to control which objects are in view and how each is colored. A separate document \cite{cinemaSimpleFileSpec} specifies a \textit{Simple} Cinema Database, which contain a fixed set of pre-rendered images for a fixed set of combinations of visualization operations.

Cinema is independent of any one specific visualization platform. Any system that can save images while varying a defined set of parameters can produce \textit{Simple} Cinema Databases. Any system that can do the above and produce depth and other component images of isolated objects in the scene can produce \Current Cinema Databases.

A Cinema \Current database is either a set of images of type \Simple or type \Current. As noted before, the specification for Simple Databases can be found in \cite{cinemaSimpleFileSpec}.

Dimensions of freedom for databases:

\begin{itemize}
\item Composable or non-composable
\item Number of composable elements
\item Dynamic or fixed colormap
\item Camera position
\end{itemize}

A \Current database is a collection of results sampled by a set of visualization parameters. Visualization parameters can be created for any control that the user might have in a traditional visualization session. Examples include isosurfaces, slice planes and viewpoint. Cinema viewing applications give the user a control for each parameter setting and display the corresponding precomputed results, as if the user had made the same choices in a traditional visualization tool.

Examples of typical parameters in a cinema database are:
\begin{itemize}
\item \textbf{Time}. Time varying data can be sampled at arbitrary points along the temporal domain.
\item \textbf{Camera positions}. In a static camera the position and orientation is fixed. In a spherical camera the position varies over a set of positions centered around a chosen focal point. More complicated camera tracks are possible. There is sufficient information in the cinema database to determine the world space camera position for each image.
\item Zero or more \textbf{operators}, such as clipping plane and isocontour samples along their respective ranges. Each result is sampled and saved in isolation from all others with nothing else visible in the scene. In a viewing application, the user can choose any number of these samples and see them rendered together with correct occlusion culling.
\item \textbf{Color} components as described next.
\end{itemize}

In a Cinema workflow, the application producing a Cinema Database creates a set of image constituents for each sample in the parameter space. These image constituents can be:
\begin{itemize}
\item \textbf{Depth} image. This encodes a depth value for every pixel, relative to the camera. Required for compositing.
\item \textbf{Luminance} image. This encodes a rendered shading brightness for each pixel. Required for lighting to be included in the final rendering
\item \textbf{Color} image. This encodes a standard RGB value for each pixel - the result of rendering the viewpoint from the camera.
\item \textbf{Value} image. This encodes an arbitrary array value associated with the data that is visualized at each pixel. Required if the final rendering is to be recolored.
\end{itemize}

It is important to note that not all image constituents must be present. Because Cinema viewing applications combine these components together to produce pictures on demand for the user, the final result is dependent upon what image constituents are available. Examples include:
\begin{itemize}
\item If a \textit{depth} image is available, compositing is possible.
\item If a \textit{float} image is available, the final rendering can be recolored.
\item If a \textit{luminance} image is available, the final rendering can include a lighting effect.
\item If only a \textit{color} image is available, the final rendering cannot be recolored.
\end{itemize}

In addition to the sampled data, a cinema database contains metadata that describes what the samples are, how they are stored and how they can be used. It must:
\begin{itemize}
\item identify the specific format (version number and content type) of the store,
\item enumerate the entire set of parameters that are explorable in the database,
\item map parameter value combinations to storage locations,
\item define the type (depth image, color image, value rendered image, ...) of each image stored in the database,
\item define the storage format (jpeg encoded buffer, png encoded buffer, raw float binary buffer, text file, etc...) of each image stored in the database,
\item describe relationships between parameters.
\end{itemize}

Relationships between parameters are included because in a visualization session some parameters are constrained by others. A scene with two unrelated objects in it could have entirely different sets of arrays for each one of them and thus the choice of colors to colormap by depends on the choice of object displayed. Relationships turn otherwise order independent options into a graph of parent child relationships.

Parameter constraints and the necessity to record depth information along with standard color images are the distinguishing features between cinema composite databases and cinema simple databases.

\section{Schema}
\input{schema}



\section{Example}
\input{example}

\bibliography{bib}{}
\bibliographystyle{unsrt}


\end{document}
