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 
7 #ifndef INCLUDED_IMF_MULTIVIEW_H
8 #define INCLUDED_IMF_MULTIVIEW_H
9 
10 #include "ImfExport.h"
11 #include "ImfNamespace.h"
12 
13 #include "ImfChannelList.h"
15 
16 //-----------------------------------------------------------------------------
17 //
18 // Functions related to accessing channels and views in multi-view
19 // OpenEXR files.
20 //
21 // A multi-view image file contains two or more views of the same
22 // scene, as seen from different viewpoints, for example, a left-eye
23 // and a right-eye view for stereo displays. Each view has its own
24 // set of image channels. A naming convention identifies the channels
25 // that belong to a given view.
26 //
27 // A "multiView" attribute in the file header lists the names of the
28 // views in an image (see ImfStandardAttributes.h), and channel names
29 // of the form
30 //
31 // layer.view.channel
32 //
33 // allow channels to be matched with views.
34 //
35 // For compatibility with singe-view images, the first view listed in
36 // the multiView attribute is the "default view", and channels that
37 // have no periods in their names are considered part of the default
38 // view.
39 //
40 // For example, if a file's multiView attribute lists the views
41 // "left" and "right", in that order, then "left" is the default
42 // view. Channels
43 //
44 // "R", "left.Z", "diffuse.left.R"
45 //
46 // are part of the "left" view; channels
47 //
48 // "right.R", "right.Z", "diffuse.right.R"
49 //
50 // are part of the "right" view; and channels
51 //
52 // "tmp.R", "right.diffuse.R", "diffuse.tmp.R"
53 //
54 // belong to no view at all.
55 //
56 //-----------------------------------------------------------------------------
57 
59 
60 //
61 // Return the name of the default view given a multi-view string vector,
62 // that is, return the first element of the string vector. If the string
63 // vector is empty, return "".
64 //
65 
67 std::string defaultViewName (const StringVector &multiView);
68 
69 
70 //
71 // Given the name of a channel, return the name of the view to
72 // which it belongs. Returns the empty string ("") if the channel
73 // is not a member of any named view.
74 //
75 
78  const StringVector &multiView);
79 
80 
81 //
82 // Return whether channel1 and channel2 are the same channel but
83 // viewed in different views. (Return false if either channel
84 // belongs to no view or if both channels belong to the same view.)
85 //
86 
88 bool areCounterparts (const std::string &channel1,
89  const std::string &channel2,
90  const StringVector &multiView);
91 
92 //
93 // Return a list of all channels belonging to view viewName.
94 //
95 
97 ChannelList channelsInView (const std::string &viewName,
98  const ChannelList &channelList,
99  const StringVector &multiView);
100 
101 //
102 // Return a list of channels not associated with any view.
103 //
104 
106 ChannelList channelsInNoView (const ChannelList &channelList,
107  const StringVector &multiView);
108 
109 //
110 // Given the name of a channel, return a list of the same channel
111 // in all views (for example, given X.left.Y return X.left.Y,
112 // X.right.Y, X.centre.Y, etc.).
113 //
114 
116 ChannelList channelInAllViews (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 ChannelList &channelList,
130  const StringVector &multiView,
131  const std::string &otherViewName);
132 
133 //
134 // Given a channel name that does not include a view name, insert
135 // multiView[i] into the channel name at the appropriate location.
136 // If i is zero and the channel name contains no periods, then do
137 // not insert the view name.
138 //
139 
141 std::string insertViewName (const std::string &channel,
142  const StringVector &multiView,
143  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 
154 std::string removeViewName (const std::string &channel,
155  const std::string &view);
156 
157 
159 
160 #endif
#define OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
Definition: ImfNamespace.h:80
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:79
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)