IOLink IOL_v1.8.0_release
Loading...
Searching...
No Matches
ImageViewFactory.h
1#pragma once
2
3#include <iolink/IOLinkAPI.h>
4#include <iolink/MemoryLayout.h>
5#include <iolink/storage/RandomAccess.h>
6#include <iolink/view/ImageView.h>
7#include <iolink/view/MultiImageView.h>
8
9#include <memory>
10
11namespace iolink
12{
13
26class IOLINK_API ImageViewFactory
27{
28public:
29 ImageViewFactory() = delete;
30 ImageViewFactory(const ImageViewFactory& other) = delete; // copy constructor
31 ImageViewFactory(ImageViewFactory&& other) = delete; // move constructor
32 ImageViewFactory& operator=(const ImageViewFactory& other) = delete; // copy assignment
33 ImageViewFactory& operator=(ImageViewFactory&& other) = delete; // move assignment
34
35 // ==================== //
36 // Creating Image Views //
37 // ==================== //
38
58 static std::shared_ptr<ImageView> allocate(const VectorXu64& shape,
59 DataType type,
60 std::shared_ptr<ImageProperties> properties,
61 std::shared_ptr<MetadataNode> metadata);
62
77 static std::shared_ptr<ImageView> allocate(const VectorXu64& shape, DataType type);
78
99 static std::shared_ptr<ImageView> copyInMemory(std::shared_ptr<ImageView> image);
100
122 static std::shared_ptr<ImageView> createOnDisk(const std::string& dirPath,
123 const VectorXu64& shape,
124 DataType type,
125 std::shared_ptr<ImageProperties> properties,
126 std::shared_ptr<MetadataNode> metadata);
127
146 static std::shared_ptr<ImageView> createOnDisk(const std::string& dirPath, const VectorXu64& shape, DataType type);
147
168 static std::shared_ptr<ImageView> createOnDisk(const VectorXu64& shape,
169 DataType type,
170 std::shared_ptr<ImageProperties> properties,
171 std::shared_ptr<MetadataNode> metadata);
172
189 static std::shared_ptr<ImageView> createOnDisk(const VectorXu64& shape, DataType type);
190
217 static std::shared_ptr<ImageView> copyOnDisk(std::shared_ptr<ImageView> image);
218
247 static std::shared_ptr<ImageView> copyOnDisk(std::shared_ptr<ImageView> image, const std::string& dirPath);
248
270 static std::shared_ptr<ImageView> fromBuffer(const VectorXu64& shape,
271 DataType type,
272 void* buffer,
273 size_t bufferSize,
274 std::shared_ptr<ImageProperties> properties,
275 const std::shared_ptr<MetadataNode> metadata);
276
293 static std::shared_ptr<ImageView> fromBuffer(const VectorXu64& shape, DataType type, void* buffer, size_t bufferSize);
294
314 static std::shared_ptr<ImageView> fromRandomAccess(std::shared_ptr<RandomAccess> accessor,
315 MemoryLayout layout,
316 const VectorXu64& shape,
317 const DataType type,
318 std::shared_ptr<ImageProperties> properties,
319 const std::shared_ptr<const MetadataNode> metadata);
320
336 static std::shared_ptr<ImageView> fromRandomAccess(std::shared_ptr<RandomAccess> accessor,
337 MemoryLayout layout,
338 const VectorXu64& shape,
339 const DataType type);
340
362 static std::shared_ptr<ImageView> fromRandomAccess(std::shared_ptr<RandomAccess> accessor,
363 const VectorXu64& shape,
364 const DataType type,
365 std::shared_ptr<ImageProperties> properties,
366 std::shared_ptr<const MetadataNode> metadata);
367
386 static std::shared_ptr<ImageView> fromRandomAccess(std::shared_ptr<RandomAccess> accessor,
387 const VectorXu64& shape,
388 const DataType type);
389
404 static std::shared_ptr<ImageView> fromImageView(std::shared_ptr<ImageView> view,
405 std::shared_ptr<const ImageProperties> properties,
406 std::shared_ptr<const MetadataNode> metadata);
407
426 static std::shared_ptr<ImageView> uniform(const VectorXu64& shape,
427 DataType type,
428 void* value,
429 std::shared_ptr<ImageProperties> properties,
430 std::shared_ptr<const MetadataNode> metadata);
431
446 static std::shared_ptr<ImageView> uniform(const VectorXu64& shape, DataType type, void* value);
447
448 // ==================== //
449 // Adapting Image Views //
450 // ==================== //
451
485 static std::shared_ptr<ImageView> adaptDynamicRange(std::shared_ptr<ImageView> view,
486 DataType type,
487 const Vector2d& inputRange,
488 const Vector2d& outputRange);
489
515 static std::shared_ptr<ImageView> adaptDataType(std::shared_ptr<ImageView> view, DataType type);
516
536 static std::shared_ptr<ImageView> extractChannel(std::shared_ptr<ImageView> view, size_t idxChannel);
537
556 static std::shared_ptr<ImageView> extractRegion(std::shared_ptr<ImageView> view, const RegionXu64& region);
557
580 static std::shared_ptr<ImageView> extractAdjustedRegion(std::shared_ptr<ImageView> view, const RegionXu64& region);
581
612 static std::shared_ptr<ImageView> stack(std::shared_ptr<MultiImageView> view, ImageDimension newDimension);
613
640 static std::shared_ptr<ImageView> stack(std::shared_ptr<MultiImageView> view);
641
674 static std::shared_ptr<ImageView> stack(std::shared_ptr<MultiImageView> view,
675 ImageDimension newDimension,
676 size_t threadCount);
677
696 static std::shared_ptr<ImageView> assembleChannels(std::shared_ptr<ImageView> image);
697
717 static std::shared_ptr<ImageView> disassembleChannels(std::shared_ptr<ImageView> image);
718
751 static std::shared_ptr<ImageView> interlace(std::shared_ptr<MultiImageView> multiView,
752 ImageInterpretation newInterpretation,
753 bool hasAlpha);
754
785 static std::shared_ptr<ImageView> interlace(std::shared_ptr<MultiImageView> multiView);
786
813 static std::shared_ptr<ImageView> reinterpret(std::shared_ptr<ImageView> image, ImageType newImageType);
814
852 static std::shared_ptr<ImageView> reinterpretAxes(std::shared_ptr<ImageView> image,
853 std::initializer_list<ImageDimension> dimensionsList);
854
874 static std::shared_ptr<ImageView> reinterpretAxes(std::shared_ptr<ImageView> image,
875 const ImageDimension* dimensionsList,
876 size_t count);
877
899 static std::shared_ptr<ImageView> subSample(std::shared_ptr<ImageView> image, size_t step);
900
919 static std::shared_ptr<ImageView> flip(std::shared_ptr<ImageView> image, ImageDimension dimension);
920
938 static std::shared_ptr<ImageView> flip(std::shared_ptr<ImageView> image, size_t dimensionIndex);
939
951 static std::shared_ptr<ImageView> makeThreadSafe(std::shared_ptr<ImageView> image);
952};
953
954} // end namespace iolink