| IOLink 1.11.0

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
11 namespace iolink
12{
13
26 class IOLINK_API ImageViewFactory
27{
28 public:
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
iolink::DataType
Stores information about a data type.
Definition DataType.h:162
iolink::ImageType
A flag system that describes the dimensions of an image.
Definition ImageType.h:43
iolink::ImageViewFactory
This factory is aimed at creating dataset views.
Definition ImageViewFactory.h:27
iolink::ImageViewFactory::extractChannel
static std::shared_ptr< ImageView > extractChannel(std::shared_ptr< ImageView > view, size_t idxChannel)
Returns an ImageView from another view containing only given channel Index (useful when channel is no...
iolink::ImageViewFactory::allocate
static std::shared_ptr< ImageView > allocate(const VectorXu64 &shape, DataType type, std::shared_ptr< ImageProperties > properties, std::shared_ptr< MetadataNode > metadata)
Creates a memory image with the given shape and type.
iolink::ImageViewFactory::fromRandomAccess
static std::shared_ptr< ImageView > fromRandomAccess(std::shared_ptr< RandomAccess > accessor, MemoryLayout layout, const VectorXu64 &shape, const DataType type, std::shared_ptr< ImageProperties > properties, const std::shared_ptr< const MetadataNode > metadata)
Create an image from a RandomAccess.
iolink::ImageViewFactory::createOnDisk
static std::shared_ptr< ImageView > createOnDisk(const std::string &dirPath, const VectorXu64 &shape, DataType type, std::shared_ptr< ImageProperties > properties, std::shared_ptr< MetadataNode > metadata)
Create an image with the data stored into a temporary file (in given folder) on disk in raw.
iolink::ImageViewFactory::adaptDynamicRange
static std::shared_ptr< ImageView > adaptDynamicRange(std::shared_ptr< ImageView > view, DataType type, const Vector2d &inputRange, const Vector2d &outputRange)
Creates an ImageView from another view with given type by mapping dynamic range.
iolink::ImageViewFactory::allocate
static std::shared_ptr< ImageView > allocate(const VectorXu64 &shape, DataType type)
Creates a memory image with the given shape and type.
iolink::ImageViewFactory::createOnDisk
static std::shared_ptr< ImageView > createOnDisk(const std::string &dirPath, const VectorXu64 &shape, DataType type)
Create an image with the data stored into a temporary file (in given folder) on disk in raw.
iolink::ImageViewFactory::flip
static std::shared_ptr< ImageView > flip(std::shared_ptr< ImageView > image, ImageDimension dimension)
Flip an ImageView following the given dimension.
iolink::ImageViewFactory::extractRegion
static std::shared_ptr< ImageView > extractRegion(std::shared_ptr< ImageView > view, const RegionXu64 &region)
Creates an ImageView of given region from given view.
iolink::ImageViewFactory::createOnDisk
static std::shared_ptr< ImageView > createOnDisk(const VectorXu64 &shape, DataType type, std::shared_ptr< ImageProperties > properties, std::shared_ptr< MetadataNode > metadata)
Create an image with the data stored into a temporary file on disk in raw.
iolink::ImageViewFactory::fromBuffer
static std::shared_ptr< ImageView > fromBuffer(const VectorXu64 &shape, DataType type, void *buffer, size_t bufferSize)
Creates an image from existing buffer.
iolink::ImageViewFactory::flip
static std::shared_ptr< ImageView > flip(std::shared_ptr< ImageView > image, size_t dimensionIndex)
Flip an ImageView following the given dimension.
iolink::ImageViewFactory::fromImageView
static std::shared_ptr< ImageView > fromImageView(std::shared_ptr< ImageView > view, std::shared_ptr< const ImageProperties > properties, std::shared_ptr< const MetadataNode > metadata)
Allows to apply specific properties and metadata to a ImageView without impact on originals.
iolink::ImageViewFactory::adaptDataType
static std::shared_ptr< ImageView > adaptDataType(std::shared_ptr< ImageView > view, DataType type)
Creates an ImageView from another view with given type.
iolink::ImageViewFactory::interlace
static std::shared_ptr< ImageView > interlace(std::shared_ptr< MultiImageView > multiView)
Interlace frames of a MultiImageView into an ImageView.
iolink::ImageViewFactory::uniform
static std::shared_ptr< ImageView > uniform(const VectorXu64 &shape, DataType type, void *value, std::shared_ptr< ImageProperties > properties, std::shared_ptr< const MetadataNode > metadata)
Create an image with uniform value.
iolink::ImageViewFactory::stack
static std::shared_ptr< ImageView > stack(std::shared_ptr< MultiImageView > view, ImageDimension newDimension)
Creates an ImageView from a multiImageView by agglomerating frames into a new given dimension.
iolink::ImageViewFactory::copyInMemory
static std::shared_ptr< ImageView > copyInMemory(std::shared_ptr< ImageView > image)
Copy given image in memory.
iolink::ImageViewFactory::interlace
static std::shared_ptr< ImageView > interlace(std::shared_ptr< MultiImageView > multiView, ImageInterpretation newInterpretation, bool hasAlpha)
Interlace frames of a MultiImageView into an ImageView.
iolink::ImageViewFactory::fromRandomAccess
static std::shared_ptr< ImageView > fromRandomAccess(std::shared_ptr< RandomAccess > accessor, const VectorXu64 &shape, const DataType type, std::shared_ptr< ImageProperties > properties, std::shared_ptr< const MetadataNode > metadata)
Create an image from a given RandomAccess.
iolink::ImageViewFactory::subSample
static std::shared_ptr< ImageView > subSample(std::shared_ptr< ImageView > image, size_t step)
Create a sub-sampled imageView from original.
iolink::ImageViewFactory::createOnDisk
static std::shared_ptr< ImageView > createOnDisk(const VectorXu64 &shape, DataType type)
Create an image with the data stored into a temporary file on disk in raw.
iolink::ImageViewFactory::stack
static std::shared_ptr< ImageView > stack(std::shared_ptr< MultiImageView > view)
Creates an ImageView from a multiImageView by agglomerating frames into a new unidentified dimension.
iolink::ImageViewFactory::copyOnDisk
static std::shared_ptr< ImageView > copyOnDisk(std::shared_ptr< ImageView > image, const std::string &dirPath)
Load an image data into a temporary raw file on disk.
iolink::ImageViewFactory::reinterpretAxes
static std::shared_ptr< ImageView > reinterpretAxes(std::shared_ptr< ImageView > image, const ImageDimension *dimensionsList, size_t count)
Reinterpret an ImageView by identifying each dimension (axis).
iolink::ImageViewFactory::reinterpretAxes
static std::shared_ptr< ImageView > reinterpretAxes(std::shared_ptr< ImageView > image, std::initializer_list< ImageDimension > dimensionsList)
Reinterpret an ImageView by identifying each dimension (axis).
iolink::ImageViewFactory::disassembleChannels
static std::shared_ptr< ImageView > disassembleChannels(std::shared_ptr< ImageView > image)
Adapt a N dimensions vectorial ImageView into a N+1 dimensions scalar one.
iolink::ImageViewFactory::fromRandomAccess
static std::shared_ptr< ImageView > fromRandomAccess(std::shared_ptr< RandomAccess > accessor, MemoryLayout layout, const VectorXu64 &shape, const DataType type)
Create an image from a RandomAccess.
iolink::ImageViewFactory::assembleChannels
static std::shared_ptr< ImageView > assembleChannels(std::shared_ptr< ImageView > image)
Adapt a N dimensions scalar ImageView into a N-1 dimensions vectorial one.
iolink::ImageViewFactory::makeThreadSafe
static std::shared_ptr< ImageView > makeThreadSafe(std::shared_ptr< ImageView > image)
Make an ImageView threadsafe.
iolink::ImageViewFactory::uniform
static std::shared_ptr< ImageView > uniform(const VectorXu64 &shape, DataType type, void *value)
Create an image with uniform value.
iolink::ImageViewFactory::stack
static std::shared_ptr< ImageView > stack(std::shared_ptr< MultiImageView > view, ImageDimension newDimension, size_t threadCount)
Creates an ImageView from a multiImageView by agglomerating frames into a new given dimension.
iolink::ImageViewFactory::reinterpret
static std::shared_ptr< ImageView > reinterpret(std::shared_ptr< ImageView > image, ImageType newImageType)
Reinterpret an ImageView with a new ImageTypeId.
iolink::ImageViewFactory::extractAdjustedRegion
static std::shared_ptr< ImageView > extractAdjustedRegion(std::shared_ptr< ImageView > view, const RegionXu64 &region)
Creates an ImageView of given region from given view, packing flat dimensions.
iolink::ImageViewFactory::fromRandomAccess
static std::shared_ptr< ImageView > fromRandomAccess(std::shared_ptr< RandomAccess > accessor, const VectorXu64 &shape, const DataType type)
Create an image from a given RandomAccess.
iolink::ImageViewFactory::copyOnDisk
static std::shared_ptr< ImageView > copyOnDisk(std::shared_ptr< ImageView > image)
Load an image data into a temporary raw file on disk.
iolink::ImageViewFactory::fromBuffer
static std::shared_ptr< ImageView > fromBuffer(const VectorXu64 &shape, DataType type, void *buffer, size_t bufferSize, std::shared_ptr< ImageProperties > properties, const std::shared_ptr< MetadataNode > metadata)
Creates an image from existing buffer.
iolink::RegionX
A Region using dynamic vectors.
Definition RegionX.h:14
iolink::Vector
An arithmetic vector.
Definition Vector.h:37
iolink::VectorX
A dynamically sized arithmetic vector.
Definition VectorX.h:18
iolink
All IOLink symbols are enclosed in this namespace.
Definition ArrayX.h:8
iolink::ImageInterpretation
ImageInterpretation
Interpretation of an Image.
Definition ImageInfoProperty.h:17
iolink::MemoryLayout
MemoryLayout
This enum indicates how a multidimensionnal array is stored in continuous memory.
Definition MemoryLayout.h:11
iolink::ImageDimension
ImageDimension
Enum used in ImageType to represent each dimension of an Image.
Definition ImageType.h:16