IOLink 1.16.1
Loading...
Searching...
No Matches
ImageViewFactory.h
1#pragma once
2
3#include <iolink/IOLinkAPI.h>
4#include <iolink/LookUpTable.h>
5#include <iolink/MemoryLayout.h>
6#include <iolink/storage/RandomAccess.h>
7#include <iolink/view/ImageView.h>
8#include <iolink/view/MultiImageView.h>
9
10#include <memory>
11
12namespace iolink
13{
14
15// Forward declaration for interoperability
16class TensorView;
17
30class IOLINK_API ImageViewFactory
31{
32public:
33 ImageViewFactory() = delete;
34 ImageViewFactory(const ImageViewFactory& other) = delete; // copy constructor
35 ImageViewFactory(ImageViewFactory&& other) = delete; // move constructor
36 ImageViewFactory& operator=(const ImageViewFactory& other) = delete; // copy assignment
37 ImageViewFactory& operator=(ImageViewFactory&& other) = delete; // move assignment
38
39 // ==================== //
40 // Creating Image Views //
41 // ==================== //
42
62 static std::shared_ptr<ImageView> allocate(const VectorXu64& shape,
63 DataType type,
64 std::shared_ptr<ImageProperties> properties,
65 std::shared_ptr<MetadataNode> metadata);
66
81 static std::shared_ptr<ImageView> allocate(const VectorXu64& shape, DataType type);
82
103 static std::shared_ptr<ImageView> copyInMemory(std::shared_ptr<ImageView> image);
104
126 static std::shared_ptr<ImageView> createOnDisk(const std::string& dirPath,
127 const VectorXu64& shape,
128 DataType type,
129 std::shared_ptr<ImageProperties> properties,
130 std::shared_ptr<MetadataNode> metadata);
131
150 static std::shared_ptr<ImageView> createOnDisk(const std::string& dirPath, const VectorXu64& shape, DataType type);
151
172 static std::shared_ptr<ImageView> createOnDisk(const VectorXu64& shape,
173 DataType type,
174 std::shared_ptr<ImageProperties> properties,
175 std::shared_ptr<MetadataNode> metadata);
176
193 static std::shared_ptr<ImageView> createOnDisk(const VectorXu64& shape, DataType type);
194
222 static std::shared_ptr<ImageView> copyOnDisk(std::shared_ptr<ImageView> image);
223
253 static std::shared_ptr<ImageView> copyOnDisk(std::shared_ptr<ImageView> image, const std::string& dirPath);
254
276 static std::shared_ptr<ImageView> fromBuffer(const VectorXu64& shape,
277 DataType type,
278 void* buffer,
279 size_t bufferSize,
280 std::shared_ptr<ImageProperties> properties,
281 const std::shared_ptr<MetadataNode> metadata);
282
299 static std::shared_ptr<ImageView> fromBuffer(const VectorXu64& shape, DataType type, void* buffer, size_t bufferSize);
300
320 static std::shared_ptr<ImageView> fromRandomAccess(std::shared_ptr<RandomAccess> accessor,
321 MemoryLayout layout,
322 const VectorXu64& shape,
323 const DataType type,
324 std::shared_ptr<ImageProperties> properties,
325 const std::shared_ptr<const MetadataNode> metadata);
326
342 static std::shared_ptr<ImageView> fromRandomAccess(std::shared_ptr<RandomAccess> accessor,
343 MemoryLayout layout,
344 const VectorXu64& shape,
345 const DataType type);
346
368 static std::shared_ptr<ImageView> fromRandomAccess(std::shared_ptr<RandomAccess> accessor,
369 const VectorXu64& shape,
370 const DataType type,
371 std::shared_ptr<ImageProperties> properties,
372 std::shared_ptr<const MetadataNode> metadata);
373
392 static std::shared_ptr<ImageView> fromRandomAccess(std::shared_ptr<RandomAccess> accessor,
393 const VectorXu64& shape,
394 const DataType type);
395
410 static std::shared_ptr<ImageView> fromImageView(std::shared_ptr<ImageView> view,
411 std::shared_ptr<const ImageProperties> properties,
412 std::shared_ptr<const MetadataNode> metadata);
413
432 static std::shared_ptr<ImageView> uniform(const VectorXu64& shape,
433 DataType type,
434 void* value,
435 std::shared_ptr<ImageProperties> properties,
436 std::shared_ptr<const MetadataNode> metadata);
437
452 static std::shared_ptr<ImageView> uniform(const VectorXu64& shape, DataType type, void* value);
453
454 // ==================== //
455 // Adapting Image Views //
456 // ==================== //
457
491 static std::shared_ptr<ImageView> adaptDynamicRange(std::shared_ptr<ImageView> view,
492 DataType type,
493 const Vector2d& inputRange,
494 const Vector2d& outputRange);
495
521 static std::shared_ptr<ImageView> adaptDataType(std::shared_ptr<ImageView> view, DataType type);
522
542 static std::shared_ptr<ImageView> extractChannel(std::shared_ptr<ImageView> view, size_t idxChannel);
543
562 static std::shared_ptr<ImageView> extractRegion(std::shared_ptr<ImageView> view, const RegionXu64& region);
563
586 static std::shared_ptr<ImageView> extractAdjustedRegion(std::shared_ptr<ImageView> view, const RegionXu64& region);
587
618 static std::shared_ptr<ImageView> stack(std::shared_ptr<MultiImageView> view, ImageDimension newDimension);
619
647 static std::shared_ptr<ImageView> stack(std::shared_ptr<MultiImageView> view);
648
682 static std::shared_ptr<ImageView> stack(std::shared_ptr<MultiImageView> view,
683 ImageDimension newDimension,
684 size_t threadCount);
685
704 static std::shared_ptr<ImageView> assembleChannels(std::shared_ptr<ImageView> image);
705
725 static std::shared_ptr<ImageView> disassembleChannels(std::shared_ptr<ImageView> image);
726
759 static std::shared_ptr<ImageView> interlace(std::shared_ptr<MultiImageView> multiView,
760 ImageInterpretation newInterpretation,
761 bool hasAlpha);
762
793 static std::shared_ptr<ImageView> interlace(std::shared_ptr<MultiImageView> multiView);
794
822 static std::shared_ptr<ImageView> reinterpret(std::shared_ptr<ImageView> image, ImageType newImageType);
823
862 static std::shared_ptr<ImageView> reinterpretAxes(std::shared_ptr<ImageView> image,
863 std::initializer_list<ImageDimension> dimensionsList);
864
885 static std::shared_ptr<ImageView> reinterpretAxes(std::shared_ptr<ImageView> image,
886 const ImageDimension* dimensionsList,
887 size_t count);
888
910 static std::shared_ptr<ImageView> subSample(std::shared_ptr<ImageView> image, size_t step);
911
930 static std::shared_ptr<ImageView> flip(std::shared_ptr<ImageView> image, ImageDimension dimension);
931
949 static std::shared_ptr<ImageView> flip(std::shared_ptr<ImageView> image, size_t dimensionIndex);
950
962 static std::shared_ptr<ImageView> makeThreadSafe(std::shared_ptr<ImageView> image);
963
974 static std::shared_ptr<ImageView> attachLut(std::shared_ptr<ImageView> src, const LookUpTable& lut);
975
989 static std::shared_ptr<ImageView> fromTensor(std::shared_ptr<TensorView> src, AxesInterpretation interpretation);
990
1003 static std::shared_ptr<ImageView> fromTensor(std::shared_ptr<TensorView> src);
1004};
1005
1006} // end namespace iolink