Scope
ScopeMultiImageEncoder.h
1 #pragma once
2 #include "hresult_exception.h"
3 #include "ScopeMultiImage.h"
4 
5 namespace scope {
6 
10 
11 protected:
14 
16  const bool dosave;
17 
19  const uint32_t channels;
20 
22  const bool compresstiff;
23 
25  uint32_t framecount;
26 
28  IWICImagingFactory* factory;
29 
31  std::vector<IWICStream*> streams;
32 
34  std::vector<IWICBitmapEncoder*> encoders;
35 
37  std::vector<IWICBitmapFrameEncode*> frameencoders;
38 
39 protected:
42 
45 
46 public:
51  ScopeMultiImageEncoder(const bool& _dosave, const uint32_t& _channels, const bool& _compresstiff = true);
52 
55 
58  void Initialize(const std::vector<std::wstring>& _filenames);
59 
61  void NewFrame();
62 
65  void WriteMetadata();
66 
69  void WriteFrame(ScopeMultiImagePtr const _multiimage);
70 
73  void WriteFrameNewPart(ScopeMultiImagePtr const _multiimage);
74 
76  uint32_t Framecount() const { return framecount; }
77 };
78 
79 }
void NewFrame()
Creates a new frame, initializes its frameencoder, and writes metadata.
IWICImagingFactory * factory
our Windows Imaging Component factory
ScopeMultiImageEncoder operator=(const ScopeMultiImageEncoder &)
because we want RAII but not frequent calling of CoInitialize etc...
void Initialize(const std::vector< std::wstring > &_filenames)
Creates and initializes encoders and streams for disk writing.
std::vector< IWICBitmapFrameEncode * > frameencoders
a frameencoder for each channel (remade for each frame)
std::vector< IWICStream * > streams
a stream for each channel
const bool compresstiff
do TIFF compressiong?
ScopeMultiImageEncoder(const ScopeMultiImageEncoder &)
disable copy and assignment
const bool dosave
do we actually save (true) or only count the frames (false)
~ScopeMultiImageEncoder()
Releases resources and uninitializes COM.
void WriteFrameNewPart(ScopeMultiImagePtr const _multiimage)
Writes the new part of a multiimage into the current frames.
void WriteMetadata()
Writes metadata via the current frameencoder into a frame Is not functional, due to limitations in WI...
uint32_t framecount
keeping track of how many frames we encoded
Encodes multi images to TIFF using Windows Imaging Components.
void WriteFrame(ScopeMultiImagePtr const _multiimage)
Writes a complete multi image into the current frames.
std::vector< IWICBitmapEncoder * > encoders
an encoder for each channel
const uint32_t channels
how many channels to encode