ImfDeepImageIO.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. //
  2. // SPDX-License-Identifier: BSD-3-Clause
  3. // Copyright (c) Contributors to the OpenEXR Project.
  4. //
  5. #ifndef INCLUDED_IMF_DEEP_IMAGE_IO_H
  6. #define INCLUDED_IMF_DEEP_IMAGE_IO_H
  7. //----------------------------------------------------------------------------
  8. //
  9. // Functions to load deep images from OpenEXR files
  10. // and to save deep images in OpenEXR files.
  11. //
  12. //----------------------------------------------------------------------------
  13. #include "ImfUtilExport.h"
  14. #include "ImfNamespace.h"
  15. #include "ImfDeepImage.h"
  16. #include "ImfImageDataWindow.h"
  17. OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
  18. //
  19. // saveDeepImage (n, h, i,d) or
  20. // saveDeepImage (n, i)
  21. //
  22. // Saves image i in an OpenEXR file with name n. The file will be
  23. // tiled if the image has more than one level, or if a header, h, is
  24. // given and contains a tile description attribute; otherwise the
  25. // file will be scan-line based.
  26. //
  27. // If header h is given, then the channel list in h is replaced with
  28. // the channel list in i, and the levelMode and the levelRounding mode
  29. // fields of the tile description are replaced with the level mode
  30. // and the levelRounding mode of i. In addition, if the data window
  31. // source flag, d, is set to USE_IMAGE_DATA_WINDOW, then the data
  32. // window in the image is copied into the header; if d is set to
  33. // USE_HEADER_DATA_WINDOW, then the data window in the header is
  34. // replaced with the intersection of the original data window in the
  35. // header and the data window in the image. The modified header then
  36. // becomes the header of the image file.
  37. //
  38. IMFUTIL_EXPORT
  39. void
  40. saveDeepImage
  41. (const std::string &fileName,
  42. const Header &hdr,
  43. const DeepImage &img,
  44. DataWindowSource dws = USE_IMAGE_DATA_WINDOW);
  45. IMFUTIL_EXPORT
  46. void
  47. saveDeepImage
  48. (const std::string &fileName,
  49. const DeepImage &img);
  50. //
  51. // loadDeepImage (n, h, i) or
  52. // loadDeepImage (n, i)
  53. //
  54. // Loads deep image i from the OpenEXR file with name n.
  55. //
  56. // If header h is given, then the header of the file is copied into h.
  57. //
  58. IMFUTIL_EXPORT
  59. void
  60. loadDeepImage
  61. (const std::string &fileName,
  62. Header &hdr,
  63. DeepImage &img);
  64. IMFUTIL_EXPORT
  65. void
  66. loadDeepImage
  67. (const std::string &fileName,
  68. DeepImage &img);
  69. //
  70. // saveDeepScanLineImage (n, h, i, d) or
  71. // saveDeepScanLineImage (n, i)
  72. //
  73. // Saves image i in a scan-line based deep OpenEXR file with file name n.
  74. //
  75. // If header h is given, then the channel list in h is replaced with
  76. // the channel list in i. In addition, if the data window source flag, d,
  77. // is set to USE_IMAGE_DATA_WINDOW, then the data window in the image is
  78. // copied into the header; if d is set to USE_HEADER_DATA_WINDOW, then
  79. // the data window in the header is replaced with the intersection of
  80. // the original data window in the header and the data window in the
  81. // image. The modified header then becomes the header of the image file.
  82. //
  83. IMFUTIL_EXPORT
  84. void
  85. saveDeepScanLineImage
  86. (const std::string &fileName,
  87. const Header &hdr,
  88. const DeepImage &img,
  89. DataWindowSource dws = USE_IMAGE_DATA_WINDOW);
  90. IMFUTIL_EXPORT
  91. void
  92. saveDeepScanLineImage
  93. (const std::string &fileName,
  94. const DeepImage &img);
  95. //
  96. // loadDeepScanLineImage (n, h, i) or
  97. // loadDeepScanLineImage (n, i)
  98. //
  99. // Loads image i from a scan-line based deep OpenEXR file with file name n.
  100. // If header h is given, then the header of the file is copied into h.
  101. //
  102. IMFUTIL_EXPORT
  103. void
  104. loadDeepScanLineImage
  105. (const std::string &fileName,
  106. Header &hdr,
  107. DeepImage &img);
  108. IMFUTIL_EXPORT
  109. void
  110. loadDeepScanLineImage
  111. (const std::string &fileName,
  112. DeepImage &img);
  113. //
  114. // saveDeepTiledImage (n, h, i, d) or
  115. // saveDeepTiledImage (n, i)
  116. //
  117. // Saves image i in a tiled deep OpenEXR file with file name n.
  118. //
  119. // If header h is given, then the channel list in h is replaced with
  120. // the channel list i, and the levelMode and the levelRounding mode
  121. // fields of the tile description are replaced with the level mode
  122. // and the levelRounding mode of i. In addition, if the data window
  123. // source flag, d, is set to USE_IMAGE_DATA_WINDOW, then the data
  124. // window in the image is copied into the header; if d is set to
  125. // USE_HEADER_DATA_WINDOW, then the data window in the header is
  126. // replaced with the intersection of the original data window in the
  127. // header and the data window in the image. The modified header then
  128. // becomes the header of the image file.
  129. //
  130. // Note: USE_HEADER_DATA_WINDOW can only be used for images with
  131. // level mode ONE_LEVEL.
  132. //
  133. IMFUTIL_EXPORT
  134. void
  135. saveDeepTiledImage
  136. (const std::string &fileName,
  137. const Header &hdr,
  138. const DeepImage &img,
  139. DataWindowSource dws = USE_IMAGE_DATA_WINDOW);
  140. IMFUTIL_EXPORT
  141. void
  142. saveDeepTiledImage
  143. (const std::string &fileName,
  144. const DeepImage &img);
  145. //
  146. // loadDeepTiledImage (n, h, i) or
  147. // loadDeepTiledImage (n, i)
  148. //
  149. // Loads image i from a tiled deep OpenEXR file with file name n.
  150. // If header h is given, then the header of the file is copied into h.
  151. //
  152. IMFUTIL_EXPORT
  153. void
  154. loadDeepTiledImage
  155. (const std::string &fileName,
  156. Header &hdr,
  157. DeepImage &img);
  158. IMFUTIL_EXPORT
  159. void
  160. loadDeepTiledImage
  161. (const std::string &fileName,
  162. DeepImage &img);
  163. OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
  164. #endif