HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ImfMultiView.h
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (c) 2007, Weta Digital Ltd
4 //
5 // All rights reserved.
6 //
7 // Redistribution and use in source and binary forms, with or without
8 // modification, are permitted provided that the following conditions are
9 // met:
10 // * Redistributions of source code must retain the above copyright
11 // notice, this list of conditions and the following disclaimer.
12 // * Redistributions in binary form must reproduce the above
13 // copyright notice, this list of conditions and the following disclaimer
14 // in the documentation and/or other materials provided with the
15 // distribution.
16 // * Neither the name of Weta Digital nor the names of
17 // its contributors may be used to endorse or promote products derived
18 // from this software without specific prior written permission.
19 //
20 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 //
32 ///////////////////////////////////////////////////////////////////////////
33 
34 
35 #ifndef INCLUDED_IMF_MULTIVIEW_H
36 #define INCLUDED_IMF_MULTIVIEW_H
37 
38 #include "ImfChannelList.h"
40 #include "ImfExport.h"
41 #include "ImfNamespace.h"
42 
43 //-----------------------------------------------------------------------------
44 //
45 // Functions related to accessing channels and views in multi-view
46 // OpenEXR files.
47 //
48 // A multi-view image file contains two or more views of the same
49 // scene, as seen from different viewpoints, for example, a left-eye
50 // and a right-eye view for stereo displays. Each view has its own
51 // set of image channels. A naming convention identifies the channels
52 // that belong to a given view.
53 //
54 // A "multiView" attribute in the file header lists the names of the
55 // views in an image (see ImfStandardAttributes.h), and channel names
56 // of the form
57 //
58 // layer.view.channel
59 //
60 // allow channels to be matched with views.
61 //
62 // For compatibility with singe-view images, the first view listed in
63 // the multiView attribute is the "default view", and channels that
64 // have no periods in their names are considered part of the default
65 // view.
66 //
67 // For example, if a file's multiView attribute lists the views
68 // "left" and "right", in that order, then "left" is the default
69 // view. Channels
70 //
71 // "R", "left.Z", "diffuse.left.R"
72 //
73 // are part of the "left" view; channels
74 //
75 // "right.R", "right.Z", "diffuse.right.R"
76 //
77 // are part of the "right" view; and channels
78 //
79 // "tmp.R", "right.diffuse.R", "diffuse.tmp.R"
80 //
81 // belong to no view at all.
82 //
83 //-----------------------------------------------------------------------------
84 
86 
87 //
88 // Return the name of the default view given a multi-view string vector,
89 // that is, return the first element of the string vector. If the string
90 // vector is empty, return "".
91 //
92 
94 std::string defaultViewName (const StringVector &multiView);
95 
96 
97 //
98 // Given the name of a channel, return the name of the view to
99 // which it belongs. Returns the empty string ("") if the channel
100 // is not a member of any named view.
101 //
102 
105  const StringVector &multiView);
106 
107 
108 //
109 // Return whether channel1 and channel2 are the same channel but
110 // viewed in different views. (Return false if either channel
111 // belongs to no view or if both channels belong to the same view.)
112 //
113 
115 bool areCounterparts (const std::string &channel1,
116  const std::string &channel2,
117  const StringVector &multiView);
118 
119 //
120 // Return a list of all channels belonging to view viewName.
121 //
122 
124 ChannelList channelsInView (const std::string &viewName,
125  const ChannelList &channelList,
126  const StringVector &multiView);
127 
128 //
129 // Return a list of channels not associated with any view.
130 //
131 
133 ChannelList channelsInNoView (const ChannelList &channelList,
134  const StringVector &multiView);
135 
136 //
137 // Given the name of a channel, return a list of the same channel
138 // in all views (for example, given X.left.Y return X.left.Y,
139 // X.right.Y, X.centre.Y, etc.).
140 //
141 
143 ChannelList channelInAllViews (const std::string &channame,
144  const ChannelList &channelList,
145  const StringVector &multiView);
146 
147 //
148 // Given the name of a channel in one view, return the corresponding
149 // channel name for view otherViewName. Return "" if no corresponding
150 // channel exists in view otherViewName, or if view otherViewName doesn't
151 // exist.
152 //
153 
156  const ChannelList &channelList,
157  const StringVector &multiView,
158  const std::string &otherViewName);
159 
160 //
161 // Given a channel name that does not include a view name, insert
162 // multiView[i] into the channel name at the appropriate location.
163 // If i is zero and the channel name contains no periods, then do
164 // not insert the view name.
165 //
166 
168 std::string insertViewName (const std::string &channel,
169  const StringVector &multiView,
170  int i);
171 
172 //
173 // Given a channel name that does may include a view name, return
174 // string without the view name. If the string does not contain
175 // the view name, return the string unaltered.
176 // (Will only remove the viewname if it is in the correct position
177 // in the string)
178 //
179 
181 std::string removeViewName (const std::string &channel,
182  const std::string &view);
183 
184 
186 
187 #endif
#define OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
Definition: ImfNamespace.h:109
GLsizei const GLchar *const * string
Definition: glcorearb.h:813
IMF_EXPORT std::string removeViewName(const std::string &channel, const std::string &view)
png_uint_32 i
Definition: png.h:2877
IMF_EXPORT std::string viewFromChannelName(const std::string &channel, const StringVector &multiView)
IMF_EXPORT std::string insertViewName(const std::string &channel, const StringVector &multiView, int i)
IMF_EXPORT std::string channelInOtherView(const std::string &channel, const ChannelList &channelList, const StringVector &multiView, const std::string &otherViewName)
IMF_EXPORT bool areCounterparts(const std::string &channel1, const std::string &channel2, const StringVector &multiView)
#define IMF_EXPORT
Definition: ImfExport.h:59
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER IMF_EXPORT std::string defaultViewName(const StringVector &multiView)
IMF_EXPORT ChannelList channelsInNoView(const ChannelList &channelList, const StringVector &multiView)
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER typedef std::vector< std::string > StringVector
#define OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
Definition: ImfNamespace.h:108
IMF_EXPORT ChannelList channelInAllViews(const std::string &channame, const ChannelList &channelList, const StringVector &multiView)
IMF_EXPORT ChannelList channelsInView(const std::string &viewName, const ChannelList &channelList, const StringVector &multiView)