vertical_segment.h 4.25 KB
Newer Older
1 2 3 4 5 6 7 8 9 10
/* ALTA --- Analysis of Bidirectional Reflectance Distribution Functions

   Copyright (C) 2013, 2014 Inria

   This file is part of ALTA.

   This Source Code Form is subject to the terms of the Mozilla Public
   License, v. 2.0.  If a copy of the MPL was not distributed with this
   file, You can obtain one at http://mozilla.org/MPL/2.0/.  */

11 12 13 14 15 16 17
#pragma once

// Include STL
#include <vector>
#include <string>

// Interface
18
#include "common.h"
19 20 21 22 23
#include "function.h"
#include "data.h"
#include "fitter.h"
#include "args.h"

24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
/*! \ingroup core
 *
 *  \brief
 *  A vertical segment data class
 *
 *  This class implement a data representation of vertical segments in the
 *  sens of Pacanowski et al. [2012]. Each data point is in fact composed
 *  of a middle point \f$ x \f$ and an upper \f$ \overline{x} \f$ and lower 
 *  bound \f$ \underline{x} \f$.
 *
 *  To retreive the complete vertical segment data \f$ [x, \underline{x}, 
 *  \overline{x}] \f$, a special function is provided. The functions 
 *  inherited from \a data will only return the middle point.
 *
 *  It is possible to load regular ALTA file using a vertical segment data
 *  loader. It will automatically generate vertical segments. You can 
 *  control the behaviour of the vertical segments using the following
 *  option in the command line:
 *  <ul>
 *		<li><b>\-\-dt</b> specify the size of the vertical segment. If the 
 *		option <b>\-\-dt-relative</b> is not set, this size is absolute: \f$ [x,
 *		x - dt, x + dt] \f$. If the <b>\-\-dt-relative</b> option is set, the 
 *		vertical segment size is relative to the middle point value \f$ x \f$: 
47 48 49
 *		\f$ [x, x (1 - dt), x (1 + dt)] \f$. You can specify the vertical
 *		segment to be equal to the max of the relative and absolute sizes
 *		using the <b>\-\-dt-max</b> option.
50 51 52
 *		<li><b>\-\-data-positive</b> for the vertical segment to stay in the 
 *		positive region. The negative values are replaced by zeros.
 *  </ul>
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
 *
 *  The data of the vertical segment can be restricted to subpart of the
 *  original data by specifying the bounding box of the input and output
 *  domain:
 *  <ul>
 *		<li><b>\-\-min</b> <it>[vec]</it> specify the minimun input 
 *		coordinate that should be loaded. All data with input coordinate
 *		less than this vector will be discarded.
 *		<li><b>\-\-max</b> <it>[vec]</it> specify the maximum input 
 *		coordinate that should be loaded. All data with input coordinate
 *		greater than this vector will be discarded.
 *		<li><b>\-\-ymin</b> <it>[vec]</it> specify the minimun output 
 *		coordinate that should be loaded. All data with associated value
 *		less than this vector will be discarded.
 *		<li><b>\-\-ymax</b> <it>[vec]</it> specify the maximum output 
 *		coordinate that should be loaded. All data with associated value
 *		greater than this vector will be discarded.
 *	 </ul>
71
 */
72 73 74 75 76 77
class vertical_segment : public data
{
	public: // methods

		// Load data from a file
		virtual void load(const std::string& filename) ;
78 79 80 81 82 83 84 85 86 87

        //! \brief Load data from a file using the command line arguments
        //!
        //! \details
        //! Specific arguments for the vertical segment data
        //!   --dt specify a value for the absolute/relative segment if not defined
        //!        in the data
        //!   --data-positive for the data to be positive
        //!   --dt-relative use a relative segment intervale. The dt is used
        //!     multipled by the data
88 89
		virtual void load(const std::string& filename, const arguments& args) ;

90

91
		// Acces to data
92 93
		virtual vec get(int i) const ;		
		virtual vec operator[](int i) const ;
94
		virtual vec value(vec, vec) const 
95
		{
96
			NOT_IMPLEMENTED();
97
		}
98
        virtual vec value(vec) const
99 100 101
        {
            NOT_IMPLEMENTED();
        }
102 103 104

		//! \brief Put the sample inside the data
		virtual void set(vec x);
105 106 107 108 109 110 111 112 113
		
		//! \brief Specific accessor to a vertical segment, this gives the
		//! complete vector, plus the ordinate segment
		virtual void get(int i, vec &x, vec &yl, vec &yu) const ;

		//! \brief Specific accessor to a vertical segment. Provides only the 
		//! ordinate segment.
		virtual void get(int i, vec& yl, vec& yu) const ;		

114 115 116 117 118 119 120 121 122 123 124

		// Get data size
		virtual int size() const ;

	private: // data

		// Store for each point of data, the upper
		// and lower value
		std::vector<vec> _data ;
} ;