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 // SPDX-License-Identifier: BSD-3-Clause
3 // Copyright (c) Weta Digital, Ltd and Contributors to the OpenEXR Project.
4 //
5 
6 #ifndef INCLUDED_IMF_MULTIVIEW_H
7 #define INCLUDED_IMF_MULTIVIEW_H
8 
9 #include "ImfExport.h"
10 #include "ImfNamespace.h"
11 
12 #include "ImfChannelList.h"
14 
15 //-----------------------------------------------------------------------------
16 //
17 // Functions related to accessing channels and views in multi-view
18 // OpenEXR files.
19 //
20 // A multi-view image file contains two or more views of the same
21 // scene, as seen from different viewpoints, for example, a left-eye
22 // and a right-eye view for stereo displays. Each view has its own
23 // set of image channels. A naming convention identifies the channels
24 // that belong to a given view.
25 //
26 // A "multiView" attribute in the file header lists the names of the
27 // views in an image (see ImfStandardAttributes.h), and channel names
28 // of the form
29 //
30 // layer.view.channel
31 //
32 // allow channels to be matched with views.
33 //
34 // For compatibility with singe-view images, the first view listed in
35 // the multiView attribute is the "default view", and channels that
36 // have no periods in their names are considered part of the default
37 // view.
38 //
39 // For example, if a file's multiView attribute lists the views
40 // "left" and "right", in that order, then "left" is the default
41 // view. Channels
42 //
43 // "R", "left.Z", "diffuse.left.R"
44 //
45 // are part of the "left" view; channels
46 //
47 // "right.R", "right.Z", "diffuse.right.R"
48 //
49 // are part of the "right" view; and channels
50 //
51 // "tmp.R", "right.diffuse.R", "diffuse.tmp.R"
52 //
53 // belong to no view at all.
54 //
55 //-----------------------------------------------------------------------------
56 
58 
59 //
60 // Return the name of the default view given a multi-view string vector,
61 // that is, return the first element of the string vector. If the string
62 // vector is empty, return "".
63 //
64 
66 std::string defaultViewName (const StringVector& multiView);
67 
68 //
69 // Given the name of a channel, return the name of the view to
70 // which it belongs. Returns the empty string ("") if the channel
71 // is not a member of any named view.
72 //
73 
76 viewFromChannelName (const std::string& channel, const StringVector& multiView);
77 
78 //
79 // Return whether channel1 and channel2 are the same channel but
80 // viewed in different views. (Return false if either channel
81 // belongs to no view or if both channels belong to the same view.)
82 //
83 
85 bool areCounterparts (
86  const std::string& channel1,
87  const std::string& channel2,
88  const StringVector& multiView);
89 
90 //
91 // Return a list of all channels belonging to view viewName.
92 //
93 
96  const std::string& viewName,
97  const ChannelList& channelList,
98  const StringVector& multiView);
99 
100 //
101 // Return a list of channels not associated with any view.
102 //
103 
106  const ChannelList& channelList, const StringVector& multiView);
107 
108 //
109 // Given the name of a channel, return a list of the same channel
110 // in all views (for example, given X.left.Y return X.left.Y,
111 // X.right.Y, X.centre.Y, etc.).
112 //
113 
116  const std::string& channame,
117  const ChannelList& channelList,
118  const StringVector& multiView);
119 
120 //
121 // Given the name of a channel in one view, return the corresponding
122 // channel name for view otherViewName. Return "" if no corresponding
123 // channel exists in view otherViewName, or if view otherViewName doesn't
124 // exist.
125 //
126 
129  const std::string& channel,
130  const ChannelList& channelList,
131  const StringVector& multiView,
132  const std::string& otherViewName);
133 
134 //
135 // Given a channel name that does not include a view name, insert
136 // multiView[i] into the channel name at the appropriate location.
137 // If i is zero and the channel name contains no periods, then do
138 // not insert the view name.
139 //
140 
143  const std::string& channel, const StringVector& multiView, int i);
144 
145 //
146 // Given a channel name that does may include a view name, return
147 // string without the view name. If the string does not contain
148 // the view name, return the string unaltered.
149 // (Will only remove the viewname if it is in the correct position
150 // in the string)
151 //
152 
155 removeViewName (const std::string& channel, const std::string& view);
156 
158 
159 #endif
#define OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
Definition: ImfNamespace.h:83
GLsizei const GLchar *const * string
Definition: glcorearb.h:814
IMF_EXPORT std::string removeViewName(const std::string &channel, const std::string &view)
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:54
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:80
Definition: core.h:982
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)